Skip to content

Rate limits

Requests are limited separately for each installation of an app. An app installed in several organizations has a limit in each; a private app's tokens share the limit of its one installation.

Every authenticated response tells you what is left of the installation's limit:

Header Content
X-RateLimit-Limit How many requests the current window allows.
X-RateLimit-Remaining How many are still available in the current window.

Over the limit, the response is 429 Too Many Requests, with a Retry-After header: the number of seconds after which you can send again.

HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json
Retry-After: <seconds>
X-RateLimit-Limit: <limit>
X-RateLimit-Remaining: 0

The limits can be adjusted over time: read them from the headers, never hard-code them.

Requests without valid credentials

Section titled "Requests without valid credentials"

401 responses (a missing, wrong, expired or revoked token) are counted separately, per IP address: at most 30 per minute. A 401 carries the X-RateLimit-Limit and X-RateLimit-Remaining headers of this limit. Past it, every request from that address gets a 429 with Retry-After, without its token being read, until the moment in Retry-After.

<?php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use Psr\Http\Message\ResponseInterface;
function send(Client $client, string $method, string $uri, array $options, int $attempts = 5): ResponseInterface
{
for ($attempt = 1; ; $attempt++) {
try {
return $client->request($method, $uri, $options);
} catch (ClientException $e) {
$response = $e->getResponse();
if ($response->getStatusCode() !== 429 || $attempt === $attempts) {
throw $e;
}
sleep((int) ($response->getHeaderLine('Retry-After') ?: 1));
}
}
}

To stay under the limit: read with large pages (limit) instead of many small requests, sync incrementally with updated_since and use webhooks instead of repeated polling.