Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Rate Limiting - Per minute warning after 59 calls in preceding minute

Started by Philip Compton -   in API Endpoints

Are there any additional details on how exactly the 'per minute' rate limit is calculated?

We manage our call rate proactively and carefully to make sure we don't exceed the limit, but we still do.

We do this across a number of external API's to our own system, and Xero is the only API that doesn't like our counting.

e.g.
We received a rate limit warning at "01:57:41.321" telling us to retry after 10 seconds.

Looking at the API call history log that is available and counting every call between "01:56:41.321" and "01:57:41.321" (the preceding minute from the warning) there were only *59 calls*.
According to the docs we should be allowed *60* calls in this minute right? So we should only be rate limited after making _more than_ 60 calls within any minute period.
When we introduced the OAuth 2.0 system we changed slightly how the minute is calculated. The previous behaviour was to check how many calls were made in the previous 60 seconds - it sounds like this is how you are calculating the limit.

Under OAuth 2.0 each app has fixed reset times (for both the minute limit and daily limit).

That said, this would typically allow more than 60 calls in the previous 60 seconds - as the reset would have occurred at some stage through the 60 seconds.

In any case, we suggest that you use the response headers to see how far through the limit you are at any given time. These are included on all calls and let your app see how many calls remain on each of the limits.
 

Robin B (Community Manager)  

"each app has fixed reset times" - is there any way for us to find out this reset time so we can continue proactive rate limiting?

Otherwise we will probably have to shift to being reactive as you suggest.
 

Philip Compton