Service Level calc mismatch when aggregating Analytics API intervals

I’ve been trying to replicate the Service Level percentage shown in the Genesys Cloud dashboard using raw data from the Analytics API. The goal is to build a custom report that matches the platform’s native metrics exactly, but the numbers just don’t line up. I’m pulling data from the /api/v2/analytics/conversations/queues/data endpoint with a 15-minute interval size. The JSON response gives me waitTime and answerTime metrics, but it’s not clear how to map these to the SL target of 80% in 20 seconds.

Here’s the logic I’m running in Python:

sl_percent = 0
total_calls = 0

for interval in response['items']:
 answered = interval['metrics']['answerTime']['count']
 wait_time = interval['metrics']['waitTime']['average']
 
 # Assuming average wait time applies to all answered calls
 if wait_time < 20: 
 sl_percent += answered
 
 total_calls += answered

final_sl = (sl_percent / total_calls) * 100

The issue is that waitTime.average is… well, an average. It doesn’t tell me how many individual calls were answered within the 20-second threshold. If I have 10 calls where 9 took 1 second and 1 took 100 seconds, the average is ~11 seconds, which looks good, but only 90% actually met the SL. The API doesn’t seem to return a count for calls under a specific wait time bucket directly in the standard metrics object. I’ve tried adding waitTime.buckets to the metrics parameter in the query, but the response structure is flat and doesn’t give me a breakdown by time range.

Is there a specific metric key I’m missing? Or is the only way to get accurate SL data by querying the individual conversation transcripts and filtering by waitTime manually? That seems incredibly expensive for large queue volumes. I need the calculation to match the dashboard, not just approximate it. The current output is off by about 15% on high-volume days.