Service Level calculation logic mismatch with Analytics API interval data

Trying to understand why my manual Service Level calculation diverges from the Genesys Cloud dashboard when using the Analytics API.

I am pulling raw interval data via POST /api/v2/analytics/conversations/queues/query for a specific queue. The payload includes interval=PT5M and filters for conversationType=voice. I receive a valid 200 OK with detailed interval buckets.

Here is the snippet of the relevant JSON response for a single interval:

{
 "interval": "2024-05-15T10:00:00.000Z",
 "metrics": {
 "answered": {
 "value": 120,
 "count": 120
 },
 "notAnswered": {
 "value": 30,
 "count": 30
 },
 "avgWaitTime": {
 "value": 45000,
 "count": 120
 },
 "serviceLevel": {
 "value": 0.85, // This is what I want to replicate
 "count": 120
 }
 }
}

My logic assumes Service Level is simply answered / (answered + notAnswered). For this bucket: 120 / 150 = 0.80. However, the API reports 0.85.

I suspect the serviceLevel metric in the response is pre-calculated based on the queue’s specific SLA target (e.g., 20 seconds). But the API docs for serviceLevel in the metrics object are vague about whether it represents percentage of calls answered within target or just a raw ratio.

When I try to filter by serviceLevel=true in the query body, the answered count drops, but the serviceLevel value in the metrics object disappears or becomes null.

{
 "groupBy": [],
 "filter": {
 "terms": [
 {
 "dimension": "queueId",
 "value": "my-queue-id"
 }
 ]
 }
}

Is there a specific metric combination I need to sum manually? Or is the serviceLevel value in the response strictly tied to the queue configuration and not derivable from answered and avgWaitTime alone? I need to reconcile this for our custom reporting dashboard.

Note: The dashboard shows 85% SL for this hour, matching the API’s serviceLevel value, not my 80% calculation.

What’s happening here is that the API returns raw counts, not the weighted percentage you see in the dashboard.

  1. Filter the response for intervals where answered > 0.
  2. Calculate answered_within_sla / answered for each bucket.
  3. Weight each interval by its duration (5 mins) and sum the results.