Hi Zendesk Support,
We are a data integration platform (Adverity) and are reporting an issue with the Ticket Metrics API (GET /api/v2/ticket_metrics) where results are not strictly sorted by created_at, despite the documentation stating otherwise.
Issue Summary
The https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metrics/#json-format
states:
▎ "Tickets are ordered chronologically by created date, from newest to oldest."
However, in practice, the ordering is not strictly chronological. When paginating through results using cursor-based pagination, some tickets with older or newer created_at values appear out of order within pages. This behaviour persists even when explicitly passing sort: -created_at.
How this affects us
We use cursor-based pagination to fetch ticket metrics for specific date ranges. Since we paginate from newest to oldest, we rely on the documented sort order to determine when we've reached tickets outside our requested date range (early return). Because some tickets appear out of order, we stop paginating before all tickets for the requested dates have been retrieved — resulting in missing data.
Expected Behavior
When sorting by -created_at (or the default chronological order), all tickets with the same created_at date should be grouped together in the pagination results. The sort order should be deterministic and strictly chronological, so that cursor-based pagination reliably returns all tickets within a given date range.
Could you please investigate whether this is a known issue and if there are plans to ensure strict sorting on the created_at field? In the meantime, if there is an alternative approach to guarantee complete results for a date range, we'd appreciate the guidance.
Thank you,
Rafik Ahmed
Adverity
