Docs state: “The API supports date ranges up to 90 days for aggregated metrics.” I’m hitting a 413 Entity Too Large when querying exactly that.
POST /api/v2/analytics/conversations/summary
{
“dateFrom”: “2023-10-01T00:00:00Z”,
“dateTo”: “2023-12-29T23:59:59Z”,
“groupings”: [{“type”: “interval”, “interval”: “P1D”}]
}
The payload is tiny. It’s the response size hitting the limit. How do I split this without losing alignment?
Split that range into three 30-day chunks. The API chokes on the full month aggregate. Use dateFrom/dateTo to stagger them, then stitch the results locally. Don’t try to force a single call for 90 days.
The documentation mentions the 90-day limit, but it doesn’t warn you that the response body for a daily interval over that range easily exceeds the gateway buffer. Splitting into three chunks works, but it’s messy to merge in post-processing if you need real-time alignment.
Here is a cleaner way to handle it using the granularity parameter instead of manual interval grouping. By switching to granularity: "P1D" in the request body, the API handles the aggregation server-side more efficiently. You can also reduce the payload size by removing unnecessary metrics from the request.
const queryPayload = {
dateFrom: "2023-10-01T00:00:00Z",
dateTo: "2023-12-29T23:59:59Z",
granularity: "P1D",
metrics: ["duration", "handle-time"], // Only request what you need
groupings: [] // Remove manual interval grouping
};
// Use the PureCloud SDK or direct fetch
const response = await platformClient.analyticsApi.postAnalyticsConversationsSummary({
body: queryPayload
});
If you still hit the 413 error, drop the granularity to P7D (weekly) and aggregate the days in your application logic. It’s much faster to sum seven numbers than to parse a massive JSON blob. Also, check your Accept-Encoding header. Making sure it’s set to gzip can sometimes bypass the raw size limit if the server supports it.
I’ve seen this issue pop up in high-volume orgs where the conversation count per day is high. The API engine tries to return every single bucket, and the serialization step is where it fails. Reducing the metric count is usually the quickest fix. If you need detailed breakdowns, stick to the chunking method but automate the merge process. Don’t manually copy-paste results.