API rate limits

To ensure stable work of Aviasales Data API and Travelpayouts statistics API, the number of requests to servers is limited. This allows us to avoid an increased workload from unscrupulous partners, which can result in lower API work speed for all partners.

Two indicators were introduced to make the imposed limitations more predictable for partners:

  • the maximum number of requests per five minutes;
  • the maximum number of requests per one hour.

This allows us to: 

  • adjust the peak load (for example, when a partner's website has many visitors at the same time, and requests to API are tied up in each click to the website);
  • optimize work with API in general (for example, use of cash by partners and distribution of requests to API evenly throughout the day).

The table provides limitations for all Aviasales and Travelpayouts API methods.

Method

Limitation of the Number of Requests Per Five Minutes

Limitation of the Number of Requests Per One Hour

/v1/prices/calendar

7800

72000

/v1/prices/cheap

3900

36000

/v1/prices/direct

5850

54000

/v1/prices/monthly

3900

36000

/v1/airline-directions

3900

36000

/v1/city-directions

3900

36000

/v2/prices/latest

31200

288000

/v2/prices/month-matrix

15600

144000

/v2/prices/nearest-places-matrix

3900

36000

/v2/prices/week-matrix

3900

36000

/v2/prices/special-offers

3900

36000

/data/something.json

3900

36000

/v2/statistics/balance

3900

36000

/statistics/v1/execute_query*

100

-

/graphql/v1/

300

2500

* execute_query has an additional limit of 30 requests per minute.

If the limitations are exceeded, the 429 error code will be sent in response to the request.

For example, you are using requests with the following limitations:

  • 3,900 requests under five minutes;
  • 36,000 requests under 60 minutes.

If you send over 3,900 requests per two minutes, access to API will be blocked for three minutes. If you send over 36,000 requests per 40 minutes, access will be blocked for 20 minutes. Meanwhile, you will continue to receive the 429 error code until the indicated time is over, at which point the block will be removed and access to API will be automatically unblocked.

We strongly recommend that you use cached data to limit the number of requests to API. If you need to know the number of sent requests, make sure to do so independently on your end.

Here are a few tips on how to optimize API requests:

  • Do not send excessive requests.
  • Optimize your code to exclude API requests, the responses to which don’t contain any necessary data.
  • Cache frequently-used data on the server or on the client by using DOM storage. You can also save the received information in the database or write it in a file.

If you have worked with API for a long time, switch to new methods (api/v3), which contain more data (so that you can send fewer requests).

If you have carried out the optimization, but the limitations are still being exceeded, feel free to contact our support team at support@travelpayouts.com.