Statistics API 404 on /api/v2/analytics/queues/realtime for active queue IDs

Stuck on fetching real-time queue stats via Deno Deploy. My edge function hits GET /api/v2/analytics/queues/realtime?queueIds=12345 with a valid bearer token but gets a 404 Not Found. I expect waitingCount and availableAgents.

  • Endpoint: /api/v2/analytics/queues/realtime
  • Method: GET
  • Status: 404

The queue ID is verified active in the UI. Is this endpoint deprecated or do I need a specific scope like analytics:view? Code snippet below.

This has the hallmarks of a classic endpoint mismatch rather than an authentication issue. The stack trace or HTTP 404 indicates the path itself is invalid for the current API version.

Cause:
The endpoint /api/v2/analytics/queues/realtime does not exist in the Genesys Cloud v2 API. Real-time analytics are served via the /api/v2/analytics/queues/stats endpoint. The realtime suffix is a common misconception from older documentation or different vendor APIs. Additionally, the query parameter queueIds is not the standard parameter name for this specific endpoint.

Solution:
Switch to the correct endpoint and use the queueIds query parameter correctly. Note that the parameter is actually queueIds (plural) but the endpoint path changes. Here is the corrected Deno fetch call:

const queueId = "12345";
const token = "your_bearer_token";

const response = await fetch(
 `https://api.mypurecloud.com/api/v2/analytics/queues/stats?queueIds=${queueId}`,
 {
 method: "GET",
 headers: {
 "Authorization": `Bearer ${token}`,
 "Accept": "application/json"
 }
 }
);

if (!response.ok) {
 throw new Error(`HTTP error! status: ${response.status}`);
}

const data = await response.json();
console.log(data);

Key adjustments:

  1. Path changed to /api/v2/analytics/queues/stats.
  2. The response will contain an items array. You need to iterate over data.items to find the queue with the matching ID.
  3. Ensure your OAuth token has the analytics:stats:view scope. Without this, you will get a 403, not a 404.

This structure aligns with the standard analytics SDK methods. If you are using the PureCloudPlatformClientV2 SDK, the method is getAnalyticsQueuesStats(queueIds).

If I remember correctly, **** is correct; use /api/v2/analytics/queues/stats instead. I run this endpoint in my ETL pipelines and it returns the waitingCount reliably.

  • Valid queue UUIDs
  • analytics:queue:view scope
  • Cache headers

Make sure you validate the endpoint path against the current OpenAPI spec before debugging auth issues.

Stuck on fetching real-time queue stats via Deno Deploy. My edge function hits GET /api/v2/analytics/queues/realtime?queueIds=12345 with a valid bearer token but gets a 404 Not Found.

The previous suggestions are correct. The /realtime suffix is invalid for v2. You need to use /api/v2/analytics/queues/stats. In my Terraform-driven CI pipelines, I often see this confusion when migrating from legacy scripts. The correct implementation uses the queueIds query parameter with the stats endpoint.

const url = "https://api.mypurecloud.com/api/v2/analytics/queues/stats";
const params = new URLSearchParams({
 queueIds: "12345",
 interval: "now" // Optional, defaults to current state
});

const response = await fetch(`${url}?${params}`, {
 headers: {
 "Authorization": `Bearer ${token}`,
 "Content-Type": "application/json"
 }
});

Ensure your service account has the analytics:queue:view scope. If you still get 404, verify the queue UUID format.

The problem here is the endpoint path. use /api/v2/analytics/queues/stats. for contract testing, verify the response schema matches the provider spec. the 404 confirms the path is invalid. ensure your consumer test mocks the correct url to prevent integration failures in the ci pipeline.