Need some troubleshooting help with a 404 Not Found error when attempting to fetch real-time queue statistics via the CXone Reporting API. I am using the endpoint /api/v2/reporting/queues/realtime with a valid OAuth token that has the reports:read scope. My GET request includes the standard headers and a Content-Type: application/json. However, the response body is consistently empty, or I receive a 404 if I try to filter by a specific queue ID that I know is active in Architect. I have verified the queue ID against the /api/v2/queues endpoint. Here is the basic request structure I am using in Python:
import requests
url = "https://{organization}.mypurecloud.com/api/v2/reporting/queues/realtime"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
params = {
"interval": "now-5m/now",
"groupBy": "queueId"
}
response = requests.get(url, headers=headers, params=params)
print(response.status_code)
print(response.json())
The response returns a 200 OK but with an empty JSON object {} or sometimes a 404 depending on the query parameters. Is there a specific date range format required for realtime data, or is there a known issue with this endpoint in the current CXone release? I am based in Stockholm and noticing this behavior during peak hours.
check your openapi spec version, as the realtime queue stats endpoint was deprecated in v2.15 in favor of the webchat metrics api. the generator removes deprecated paths by default, so you likely hit a 404. use /api/v2/analytics/queues/realtime instead with reports:read scope.
{
"view": "realtime",
"entities": [{"id": "queue-id-here"}]
}
The suggestion above points to the correct base path, but the payload structure is wrong for analytics/queues/realtime. You must use interval instead of view.
{
"interval": "2023-10-01T00:00:00.000Z/2023-10-01T01:00:00.000Z",
"entities": [{"id": "your-queue-id"}],
"metrics": ["offerCount", "answerCount"]
}
Omitting the ISO 8601 interval causes the API to reject the request silently or return an empty array. Verify your OAuth token includes analytics:read. The reports:read scope is insufficient for this specific endpoint.
make sure you drop the content-type header entirely. the analytics endpoint ignores it and sometimes chokes on it. also, ensure your token has analytics:read, not just reports:read. the scopes are distinct in cxone. try this curl with the correct interval format.
curl -X POST "https://api.mypurecloud.com/api/v2/analytics/queues/realtime" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"interval":"2023-10-01T00:00:00.000Z/2023-10-01T01:00:00.000Z","entities":[{"id":"queue-id"}],"metrics":["offerCount"]}'
If you check the docs, they mention the 404 is strictly about the resource path validity, not just missing scopes, but the empty response you’re seeing is a different beast entirely. If you’re hitting /api/v2/analytics/queues/realtime and getting nothing back, check your interval length. The API silently drops queries where the interval exceeds 15 minutes for real-time data, or if the start time is in the future relative to the server clock.
I usually solve this by forcing the interval to a tight 5-minute window and ensuring the metrics array is populated. An empty metrics array returns an empty response body, which looks like a 200 OK but contains no data. Also, verify your OAuth scope. reports:read is for historical data. You need analytics:read for real-time analytics endpoints.
Here is a working curl command that handles the interval and metrics correctly:
curl -X POST "https://api.mypurecloud.com/api/v2/analytics/queues/realtime" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"interval": "2023-10-01T12:00:00.000Z/2023-10-01T12:05:00.000Z",
"entities": [
{ "id": "your-queue-id" }
],
"metrics": [
"offerCount",
"answerCount",
"avgWaitTime"
]
}'
If you still get a 404, double-check that the queue ID exists and is active. The API won’t return stats for archived queues. See the official docs for more details on interval constraints: https://developer.mypurecloud.com/api/rest/v2/analytics/queues/realtime/.