Service Level calculation from /api/v2/analytics/conversations/queries intervals

Trying to derive Service Level percentage from the intervals array in the Analytics API response. The docs mention offerCount and answeredCount, but the math isn’t matching our dashboard.

  • Endpoint: /api/v2/analytics/conversations/queries/conversations/groups:query
  • Body: interval: 15m, metrics: [offerCount, answeredCount]
  • Language: Kotlin, OkHttp client

Here’s the JSON snippet for a single interval:

{
 "intervalStart": "2023-10-27T14:00:00.000Z",
 "metrics": {
 "offerCount": { "count": 120 },
 "answeredCount": { "count": 95 }
 }
}

Dividing answeredCount by offerCount gives 79%, but the dashboard shows 85% for that slot. Is there a specific threshold metric I’m missing in the query body? The answeredWithinSLA metric isn’t listed as available for groups queries.

The dashboard uses the SL metric directly because it handles the target time threshold logic internally. If you’re just dividing answeredCount by offerCount, you’re calculating Answer Rate, not Service Level. Service Level requires knowing how many offers were answered within the specific target time (e.g., 20 seconds).

You need to add SL and SLTarget to your metrics array. The API does the heavy lifting there. Here’s how the payload should look:

{
 "interval": "PT15M",
 "metrics": [
 "offerCount",
 "answeredCount",
 "SL",
 "SLTarget"
 ],
 "groupBy": ["queueId"]
}

Make sure SLTarget matches what your queue is actually configured for. If the queue target is 20s but you query for 30s, the numbers will look weird. Also, check the timezone on the query. Tokyo time vs PST will shift your intervals entirely if you’re not careful. The SL value in the response is already a percentage (0-100), so no extra math needed.

Just verify the SLTarget matches your queue config.

is spot on. You’re mixing up answer rate with SL. Add SL to your metrics array and use that value. The API calculates the threshold logic for you.