Analytics API 413 Error: Splitting 90-day query into chunks

What’s the standard way to chunk a request that hits the 413 Entity Too Large limit on the Analytics API?

I’m trying to pull conversation analytics for a 90-day period. The payload size exceeds the limit when I send the full date range in one go. I’ve tried narrowing the time window, but I need the full dataset.

Here’s what I’ve tried:

  • Sending the request with a 30-day window. Works fine.
  • Sending the request with a 60-day window. Works fine.
  • Sending the request with a 90-day window. Returns 413 Entity Too Large.
  • Checking the request body size. It’s under 1MB.

The error response is:

{
 "code": "413",
 "message": "Entity Too Large"
}

The request looks like this:

POST /api/v2/analytics/conversations/details/query

{
 "dateFrom": "2023-10-01T00:00:00.000Z",
 "dateTo": "2023-12-31T23:59:59.999Z",
 "groupings": [
 {
 "type": "dimension",
 "dimension": "queue"
 }
 ],
 "size": 1000
}

I need to split the 90-day window into smaller chunks. Is there a best practice for doing this? Should I split by month, week, or day? I’ve seen examples of splitting by month, but I’m not sure if that’s the most efficient way.

I’m using Python with the requests library. I can handle the logic to split the date range and make multiple requests. I just need to know the recommended approach.

Any pointers on how to handle this? I’ve looked at the docs, but they don’t mention chunking strategies.