Determine Remaining Requests Before Reaching Auth0 Rate Limits

Overview

Administrators must monitor an application's current API rate limit status to prevent service disruptions. When an application exceeds its allowed requests, Auth0 returns the following error:

 

429 HTTP Error (Too Many Requests)

 

Monitor specific HTTP response headers to determine if an application is approaching its request limit for a given time window.

Applies To

  • Auth0
  • Application Programming Interface (API)
  • Rate Limiting

Solution

How does Auth0 indicate rate limit status in HTTP response headers?

Determine the rate limit status by monitoring the following HTTP response headers included in every Auth0 API response.

  • x-ratelimit-limit: The maximum number of requests available in the current time frame.
  • x-ratelimit-remaining: The number of remaining requests in the current time frame.
  • x-ratelimit-reset: A UNIX timestamp (in seconds) of the expected time when the rate limit resets.

 

Example HTTP Response Headers Containing Rate Limit Information

Review the following example of an HTTP response containing the rate limit headers. There are a maximum of 1000 requests available for the current time frame, of which only 1 has been used so far, so there are 999 remaining, and the reset will happen at the given x-ratelimit-reset UNIX timestamp (in seconds):

HTTP/1.1 200 OK
Content-Type: application/json
x-ratelimit-limit: 1000
x-ratelimit-remaining: 999
x-ratelimit-reset: 1609459200

 

What other options are available besides monitoring HTTP response headers?

Auth0 tenant logs will also emit the log type api_limit_warning which will provide details regarding which service (Management API or Authentication API) is reaching the limit threshold. This signal can be streamed via a configured log stream to a monitoring service providing alerts that the rate limit threshold is close to breaching.

 

Related References

Recommended content

No recommended content found...