Facing Rate Limits on Analytics Conversation Details Query

I inherited this org about six months ago and I am still trying to figure out some of the legacy scripts. We have a nightly job that pulls conversation details for the previous day. It works fine for small batches, but when I try to run it for our holiday peaks, I start getting 429 errors from the API. I checked the documentation but I am not sure if I should be using a different endpoint or just slowing down my requests.

Welcome to the wonderful world of undocumented rate limits! I have spent a lot of time researching this. The /api/v2/analytics/conversations/details/query endpoint has a sliding window limit that is shared across the entire org. If you have multiple scripts running at the same time, they will all trip over each other.

You should check the x-ratelimit-remaining header in the response. If it is low, just sleep for a second.

It is better than getting blocked entirely.

Correct. The analytics detail query is expensive. For large historical exports, you should not use the real-time query endpoint.

You should utilize the /api/v2/analytics/conversations/details/jobs endpoint instead. This allows you to submit a bulk request that the platform processes asynchronously.

Once the job is complete, you can download the results in a single compressed file. This avoids the 429 errors associated with synchronous queries.