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.
Headers
Section titled "Headers"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 RequestsContent-Type: application/problem+jsonRetry-After: <seconds>X-RateLimit-Limit: <limit>X-RateLimit-Remaining: 0The 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.
Retrying after Retry-After
Section titled "Retrying after 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)); } }}async function send(url, options, attempts = 5) { for (let attempt = 1; ; attempt++) { const response = await fetch(url, options);
if (response.status !== 429 || attempt === attempts) { return response; }
const seconds = Number(response.headers.get('Retry-After')) || 1; await new Promise((resolve) => setTimeout(resolve, seconds * 1000)); }}import time
import requests
def send(method: str, url: str, attempts: int = 5, **kwargs) -> requests.Response: for attempt in range(1, attempts + 1): response = requests.request(method, url, **kwargs)
if response.status_code != 429 or attempt == attempts: return response
time.sleep(int(response.headers.get("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.