Calculating Service Level % from Analytics API interval data vs using the summary endpoint

We’re building a custom dashboard using the Embeddable Client App SDK to display real-time queue performance metrics. The goal is to calculate the Service Level percentage (calls answered within X seconds / total calls answered) for the last 4 hours.

The analytics/queues/v2/metrics endpoint returns a summary object that includes a pre-calculated serviceLevel field, which is convenient. However, the data seems to lag by about 2 minutes compared to the raw interval data, and we want to ensure consistency with our internal calculations.

I’m trying to replicate this calculation using the raw interval data from analytics/queues/v2/intervals. The documentation suggests summing up the answeredWithinSL and totalAnswered fields across all intervals in the time window.

Here’s the Python snippet I’m using to fetch and process the data:

import requests

headers = {
 'Authorization': f'Bearer {access_token}',
 'Accept': 'application/json'
}

params = {
 'interval': 'PT5M',
 'groupBy': 'interval',
 'from': start_time,
 'to': end_time,
 'metrics': 'answeredWithinSL,totalAnswered'
}

response = requests.get('https://api.mypurecloud.com/api/v2/analytics/queues/v2/intervals', headers=headers, params=params)
data = response.json()

total_answered = sum([interval['metrics']['totalAnswered'] for interval in data['intervals']])
total_within_sl = sum([interval['metrics']['answeredWithinSL'] for interval in data['intervals']])

if total_answered > 0:
 sl_percent = (total_within_sl / total_answered) * 100
else:
 sl_percent = 0

The issue is that the calculated sl_percent doesn’t match the serviceLevel value from the summary endpoint. For example, the summary endpoint returns 85.2%, but my calculation yields 84.7%.

I’ve checked the time ranges and they match exactly. Is there a discrepancy in how Genesys Cloud calculates the service level in the summary vs the raw intervals? Are there any hidden filters or rounding methods applied to the summary endpoint that aren’t visible in the interval data?

Also, should I be using answeredWithinSL or is there a different metric that accounts for calls that were abandoned after being in the queue but before the SL threshold? The docs aren’t super clear on this edge case.

Any insights into how the summary calculation differs would be appreciated. We need the numbers to match exactly for compliance reporting.