Restrictions on requests

Restrictions for requests to Yandex Market API For sellers, they are divided into the following types:

  • global restrictions (limits on the number of simultaneous requests);

  • resource restrictions (restrictions on the number of requests to the same resource over a long period of time, for example, per day);

  • functional limitations (restrictions on the amount of data to be sent or returned in a single request).

Global restrictions

They affect the number of simultaneous (parallel) requests. A maximum of four simultaneous requests are allowed.

The limit is applied to a specific entity depending on URL Request:

  • for queries like /campaigns/{campaignId}/... — to the store (campaignId);
  • for queries like /businesses/{businessId}/... — to the cabinet (Businesssid);
  • for other requests:
    • when logging in by Api-Key-the token — to the account (BusinessID) where the token was created;
    • when logging in by The OAuth token — to the employee (userId) in whose name the token was issued.

If the limit is exceeded, the server returns a special HTTP code. 420 Enhance Your Calm with an explanatory message:

Hit rate limit of 4 parallel requests for campaignId 12345

Resource constraints

They affect the volume of requests to the same API resource over a long period of time from a single login.

For different methods, restrictions apply either to the number of requests or to the total amount of data transmitted or returned. The specific type of restriction and its meaning are indicated on the pages of the corresponding methods.

In each response to the request, the server returns special HTTP headers that indicate the resource limit status for the entity:

  • heading X-RateLimit-Resource-Limit contains the numeric value of the restriction.

  • heading X-RateLimit-Resource-Until contains the date until which the restriction applies, in the format RFC822 (for example, Thu, 10 Jul 2018 00:42:42 GMT);

  • heading X-RateLimit-Resource-Remaining contains the numeric value of the amount of requests to this resource remaining before the limit is exceeded.

Reducing the resource limit

The resource limit is reduced by the cost of the request. The cost depends on the type of restriction:

  • if there is a limit on the number of requests — the cost is 1 (each request reduces the limit by one);
  • if there is a limit on the amount of data — The cost is equal to the size of the collection in the request or response.

Reduction rules:

  • with successful responses (2xx), the resource limit is reduced.
  • in case of client errors (4xx, for example 400 Bad Request or 404 Not Found) the resource limit is also reduced;
  • in case of errors from the Market (5xx, including 500), the resource limit is not reduced.

If the limit is exceeded, the server issues a special HTTP code. 420 Enhance Your Calm with an explanatory message, for example:

Hit rate limit of 10000 points per 1 day for resource /regions/{regionId}.json for userId 67890

Functional limitations

They affect the amount of data sent or returned for a resource per request. The restrictions are individual for each resource, and their values are specified in the descriptions of the methods themselves.

In addition, there is a common restriction for all requests: the maximum size of the request body is 512 KB. If the volume is larger, split the request into several.

If the limit is exceeded, the server issues a special HTTP code. 400 Bad Request with an explanatory message.