Mashery Support Portals Developer Blog

Did you know? Mashery API responses contain quota limit information

If you are a Mashery API user - if not, sign-up here! - then you might not be aware of the fact that we're passing back, in the response header, information about your usage of the API, which can help you add in more resilency to your custom API programs, e.g. if you are about to hit a QPS limit, then perhaps you want to add in a slight delay to a next call. This information can be very useful for developers building custom applications using the Mashery API.

The headers returned are:

  • X-Packagekey-Qps-Allotted: The maximum QPS (queries per second) capacity set on your API key. This is the maximum number of calls that can be made in any given second.
  • X-Packagekey-Qps-Current: The current count of calls being applied against the above limit; in this case, it is a representation of how many calls your key is making at that particular second in time.
  • X-Packagekey-Quota-Allotted: The maximum number of calls that can be made on daily basis. 
  • X-Packagekey-Quota-Current: The current count of calls made in the current limit period, i.e. the current day.
  • X-Plan-Quota-Reset: The time when the quota count will reset to 0.

Example response headers are below:

X-Packagekey-Qps-Allotted: 25
X-Packagekey-Qps-Current: 1
X-Packagekey-Quota-Allotted: 2000000
X-Packagekey-Quota-Current: 105094
X-Plan-Quota-Reset: Saturday, July 30, 2016 12:00:00 AM GMT