Configure quota settings
You can set a user quota limit, which is the maximum number of requests that your API can respond to within a specific time period, for keys included in a key collection. When the quota reaches its limit, edge servers stop forwarding traffic to your origin server until the quota resets. You can also decide whether to send quota limit headers in response to API requests.
- In API Keys and Traffic Management, from the key collections list, select the collection you want to set a user quota limit for.
- In the collection panel, click the pencil icon () next to Quota settings.
In the Edit quota
settings window, set the Enable quota switch to
Additional fields appear.
In the Each key is allowed area, do
In the text field, enter the maximum
number of requests each key in the collection can successfully make.
You can enter any number in the following range: 100-1000000000.Note: Staging and production environments have the same quota counters for API keys.
- From the drop-down menu, select the time period for the quota limit.
The drop-down menu determines how often the system should reset the quota. The times of the quota reset are fixed and you cannot change them. The following table lists the values available and their corresponding fixed reset times in the UTC time format.
Value Reset times Hour The start of each hour, XX:00:00 UTC 6 Hours 00:00:00 UTC, 06:00:00 UTC, 12:00:00 UTC, 18:00:00 UTC 12 Hours 00:00:00 UTC, 12:00:00 UTC Day 00:00:00 UTC Week The start of each week (Monday), 00:00:00 UTC Month The start of each month, 00:00:00 UTC
- In the text field, enter the maximum number of requests each key in the collection can successfully make.
In the Quota headers section, select
the response headers to return when the quota remains or when the quota is at its
Quota limit response headers refer to rate limit statistic data that an API returns to clients in response to their requests. The following table describes the purpose of each quota limit response header.
Quota limit response headers Header Description Sample value X-RateLimit-Limit The request limit per specified unit of time. 100 X-RateLimit-Remaining The remaining number of requests that API consumers can send in the current time window. 75 X-RateLimit-Reset The UTC epoch timestamp indicating the time of the next quota reset. Sent only when quota remains. 1521214822 X-RateLimit-Next The UTC epoch timestamp indicating the time of the next quota reset. Sent only when quota is full. 1521215291
To confirm the changes, click
You have applied the quota to all keys in the collection.