Differentiation of 429 errors

There are 2 reasons a request can receive a 429 response. One for a per-second rate limit, and one for a per-day total limit.

But, the only way to potentially know which one you hit is to parse the message in the json. Could we possibly get an additional field added to the json error response maybe indicating which was hit?

{"code":429,
"limit": "daily",   //other value could be "rate" for the per-second one 
 "message":"You have reached the maximum per-second rate limit for this API. Try again later."
}

In summary, it would be nice to “subclass” the 429 error if possible with a “which limit” was hit.

Next request- mostly related. There is a ‘X-RateLimit-Remaining’ That only seems to be returned on 200 responses. It doesn’t give us enough info to make proper rate limiting decisions. It would be nice if ALL responses contained something like these 3 examples:

429 response(per second exceeded)

"x-Ratelimit-category: heavy"
"X-RateLimit-daily-Remaining: 2000"
"x-ratelimit-daily-limit: 5000"
"x-ratelimit-rate-reset: 20"  // Means the 429 you just got exceeded the rate limit and you should wait 20s

or

429 response(daily exceeded)

"x-Ratelimit-category: heavy"
"X-RateLimit-daily-Remaining: 0"
"x-ratelimit-daily-limit: 5000"
"x-Retry-After: date-time-limit-resets "

or

200 response

"x-Ratelimit-category: resource-intensive"
"X-RateLimit-daily-Remaining: 500"
"x-ratelimit-daily-limit: 1000"

Hey @robert.macaulay,

Thank you for the suggestions, I will add this as a feature request. (ZOOM-156553)

Thanks,
Tommy

1 Like

I see via the Changelog that the response headers X-RateLimit-Category and X-RateLimit-Type have been added to 429 responses, but the documentation has not yet been updated accordingly. Could you specify what the possible values for these headers are?

1 Like

Hey @gwhitney,

We will get the docs updated. CC @shrijana.g.

https://timeline.noticeable.io/8XMdMkIr8cTlKfj8DTtx/posts/api-updates-05-09-2020?cache=false

Thanks,
Tommy

1 Like

Hi @gwhitney,

Thank you for bringing this up.

The X-RateLimit-Category refers to the rate limit label of the API (value could be either Light, Medium, Heavy, Resource-intensive based on the API you’re calling). The X-RateLimit-Type indicates whether the Rate Limit is QPS (Query Per Second) or Daily-limit. We have added the examples in the table here: https://marketplace.zoom.us/docs/api-reference/rate-limits#best-practices-for-handling-errors

Best,
Shrijana

While exceeding the daily limit I got the following errors

data: {
    code: 429,
    message: 'You have exceeded the daily rate limit (100) of Meeting Create/Update API requests permitted for this particular user. You may resume these requests at GMT 00:00:00.'
  }

headers: {
   'x-ratelimit-category': 'Light',
    'x-ratelimit-limit': '6000',
    'x-ratelimit-remaining': '5851'
} 

I don’t see x-ratelimit-type set to Daily-limit.
Can you please confirm. Thank you.

@jitenshah Thanks for letting us know about this. I will check if this is a bug or not and get back to you.

Best,
Shrijana

1 Like

@tommy @jitenshah This is a bug and I have assigned a ticket for this to be resolved in a future release. [ ZOOM-173698]

2 Likes

@shrijana.g : Thank you. is there a way I can track this. How do we know when the API 's are updated ?

Hey @jitenshah,

I will provide updates here! You can also follow our changelog to see API updates:

https://marketplace.zoom.us/docs/changelog

Or you can follow #new-releases

Thanks @shrijana.g! :slight_smile:

Thanks,
Tommy

1 Like