Rate limits
The Akiles API limits how many requests a client can make. The limits keep the platform fast for everyone, and stop a client with a bug (for example, a loop) from causing problems.
A well-built integration does not get near the limits. If you get a 429 response, it usually means that the integration does much more work than it needs. See How to stay under the limits.
How the limits work
Each limit is a bucket of requests:
- The bucket starts full. You can make a burst of requests up to the bucket size at once.
- The bucket fills again at a fixed rate.
- When the bucket is empty, requests get a
429response until it fills again.
For example, “3600, then 6 per second” means: 3600 requests at once, and after that 6 requests per second on average. A client that makes 6 requests per second or less never gets a 429.
API requests
Each OAuth application can make 3600 requests at once, then 6 per second, for each organization.
If your application is connected to many organizations, each organization has its own bucket. The requests that you make for one organization do not use the bucket of another organization.
A WebSocket connection to /v2/ws counts as one request when it opens. The events that it receives do not count.
Access tokens
You can refresh an access token (POST https://auth.akiles.app/oauth2/token with grant_type=refresh_token) 20 times at once, then 1 time every 10 minutes, for each organization.
An access token is valid for 1 hour (see Token types). You need about 1 new token per hour for each organization. Do not get a new access token for each API call:
- Keep the access token and use it until it expires. The token response has
expires_in, in seconds. - Get a new token only when the token is about to expire, or when the API returns
401. - If your integration runs on more than one server or worker, keep the token in a place that all of them share, such as your database.
- Store the new refresh token from each token response. See Refresh token flow.
Invitation emails
When you add an email to a member (POST /members/{id}/emails), Akiles sends an invitation email to that address. One address gets at most 3 invitations per day from one organization.
Above this limit, Akiles does not send the invitation email. The API call still succeeds, and the email is added to the member. There is no 429 for this limit.
Add the email address of the person who uses the access, for example the guest of a reservation. If you do not have it, give the member a PIN or a magic link (see Credentials).
Reveals
Each reveal of a PIN, a magic link or a member token (POST .../reveal) is recorded as an event in the organization’s log. Each OAuth application can reveal 500 at once, then 1 every 10 minutes, for each organization.
You almost never need to reveal:
- When you create a PIN, a magic link or a member token, the response already has its value (
pin,linkortoken). Store it. Do not reveal it after you create it. - PINs, magic links and member tokens never change. If you see the same ID as before, it is the same value. Do not reveal them again on every sync to check them: compare the IDs.
Reveal only the PINs, magic links and member tokens that someone else created, for example an administrator in the admin panel, and only once.
The 429 response
When a request is above a limit, the API returns HTTP status 429 Too Many Requests and a Retry-After header. Retry-After is the number of seconds to wait before you try again.
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 12
{
"type": "rate_limited",
"message": "Too many attempts, try again later",
"args": {
"retry_after": 12
}
}
The token endpoint uses the OAuth 2.0 error format:
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 300
{
"error": "rate_limited",
"error_description": "Too many access tokens requested. An access token is valid for an hour: use it until it expires",
"error_hint": "Retry in 300 seconds."
}
A request that gets a 429 was not done. Send it again after Retry-After seconds.
How to stay under the limits
- Handle
429. Wait for the number of seconds inRetry-After, then send the request again. Do not retry immediately: a retry beforeRetry-Aftergets a429again. - Reuse access tokens until they expire. See Access tokens.
- Store the PIN, magic link or member token from the create response. Do not reveal it. See Reveals.
- Get related objects in one call. Use expands in place of one call per object. For example,
GET /members?expand=pins&limit=100gets 100 members with their PINs in one call. One call per member (GET /members/{id}/pins) needs 100 calls. - Do not poll for changes. Receive events with webhooks or WebSockets. If you must poll, poll the events list, not the full list of members.
- Spread out large jobs. A nightly sync of thousands of objects does not have to run in one minute.
If your integration needs more than these limits, contact us at support@akiles.app. Tell us what the integration does and how many requests it needs.