Calculating Service Level from Genesys Cloud Analytics API interval data

We are attempting to calculate the Service Level percentage (e.g., 80% of calls answered within 20 seconds) using the raw interval data from the Genesys Cloud Analytics API. The endpoint in question is the standard analytics summary query for queues.

The JSON response provides metricValues for answered, abandoned, and wait-time, but these are aggregated totals for the hour. There is no direct serviceLevel metric in the interval breakdown. We have tried to reconstruct the SL% by summing the answered calls where the wait-time is less than 20 seconds, but the granularity of the wait-time metric seems to be an average, not a distribution.

Here is the Python logic we are currently using:

for interval in response['intervals']:
 answered = interval['metricValues']['answered']['count']
 avg_wait = interval['metricValues']['wait-time']['average']
 # This logic is flawed because average wait != SL%
 sl_percent = (answered * (1 - avg_wait/20)) / answered 

This calculation is obviously incorrect because an average wait time does not tell us how many calls fell within the threshold. Is there a way to query the distribution of wait times per interval, or do we need to use a different endpoint to get the raw timestamps for each call? We need this data to build a Terraform module that validates reporting configurations, so we cannot rely on the pre-built dashboard widgets.