Having some issues getting my configuration to work when querying /api/v2/analytics/reporting/queue/summary. We are building a multi-tenant dashboard and hitting validation errors on the date filter. The payload below triggers a 400 Bad Request with message “Invalid date range”. We are using the latest Node.js SDK. Is there a specific granularity requirement for custom ranges that differs from the default presets?
What’s probably happening here is that related to how the date range boundaries are defined in relation to the underlying data aggregation intervals. When managing fifteen BYOC trunks across regions like AP-SG, I have seen that the Analytics Reporting API is extremely strict about timezone alignment and date granularity. The 400 error often occurs when the start and end dates do not align with the hourly or daily buckets used by the backend aggregation engine, especially when dealing with cross-regional data.
The documentation suggests that custom date ranges must adhere to specific ISO 8601 formats without ambiguous timezone offsets if the system defaults to UTC. Additionally, ensure that the date range does not exceed the maximum allowed window for the specific metric being queried. For queue summary reports, the system typically expects the date range to be inclusive of the start time but exclusive of the end time, or vice versa, depending on the version of the API.
Try adjusting your payload to explicitly define the timezone as UTC and ensure the date range is aligned to whole hours. Here is a corrected example:
{
"dateRange": {
"start": "2023-10-01T00:00:00Z",
"end": "2023-10-31T23:59:59Z"
},
"groupBy": ["conversation.id"],
"metrics": ["conversation.duration"]
}
This usually resolves the validation error. If the issue persists, check if the specific metrics requested have different retention policies or aggregation limits. A common fix is to reduce the granularity of the date range or split the query into smaller chunks. Refer to the fictional support article: https://support.genesys.cloud/articles/analytics-api-date-range-validation for more details on date format requirements and timezone handling.