API consumption limit (rate limit)
The BTG Pactual Empresas APIs impose a per-minute request limit on their APIs.
To let the integrating system identify whether it is approaching the limit, this information is provided via headers in the response of all APIs.
| Header | Description |
|---|---|
| X-RateLimit-Limit | Request limit per minute within the window |
| X-RateLimit-Remaining | Remaining requests in the request window |
| X-RateLimit-Reset | Unix timestamp for the request window reset |
Consumption is calculated per clientId making the request. In other words, if your system consumes a very high volume and has only 1 clientId, it is essential to implement a flow that checks these values.
Consumption occurs regardless of whether the API response returns success or error.
Once the limit is reached, our system returns the 429 code with the following payload:
{
"limit":120, //Quota of calls per minute
"reset_in_seconds":4, //Time in seconds until the quota resets
"identifier":"1a4b0f90-9e5a-4b51-a097-c88660c19ad4",
"message":"Too many requests. Please try again later."
}