Quotas

To ensure maximum availability of the service, we put limits on API requests from users.

Several types are used simultaneously:

  • by IP — restrict the number of requests per second/minute/hour from a single IP;
  • by API User ID — restrict the number of requests per second/minute/hour from a single user;
  • by request error from API User ID — temporarily blocked the user access to API if their request had an error. The restriction is valid even you fixed error.

The requests rate is calculated separately for each restriction type. Some API segments can have additional types with their requests rate.

Exceeding quotas

If one of the quotas is exceeded, the API returns a response with HTTP status 429 (Too Many Requests). The message will contain the following information about the restriction type:

  • quota name;
  • current quota value;
  • limit quota value;
  • timestamp when the quota resets;
  • the number of seconds until the quota resets;
  • quota status.

The following example shows the response to a request than exceeded a minute quota:

{
  "code": 429,
  "message": "Too Many Requests",
  "data": {
    "error": {
      "info": {
        "quotas": [
          {
            "name": "RequestsByUserPerSecond",
            "count": 3,
            "limit": 10,
            "resetTime": 1500000291,
            "resetInSecond": 1,
            "exceeded": false
          },
          {
            "name": "RequestsByUserPerMinute",
            "count": 127,
            "limit": 100,
            "resetTime": 1500000320,
            "resetInSecond": 30,
            "exceeded": true
          },
          {
            "name": "RequestsByUserPerHour",
            "count": 100,
            "limit": 1000,
            "resetTime": 1500000800,
            "resetInSecond": 510,
            "exceeded": false
          }
        ]
      }
    }
  }
}

The response can include more than one quota and quotas that haven’t yet been exceeded. It can help you to know when you will be unblocked and what the request rate should be.