Rate limits and etiquette on the X API
Stay inside the limits and your tool keeps working. Ignore them and you’ll get 429s.
Read the headers
Every response carries your budget. Watch these and back off before you hit zero:
x-rate-limit-limit: 300
x-rate-limit-remaining: 12
x-rate-limit-reset: 1730500000 // unix seconds
Exponential backoff
async function withBackoff(fn, tries = 5){
for (let i = 0; i < tries; i++){
const r = await fn();
if (r.status !== 429) return r;
await sleep(2 ** i * 1000); // 1s, 2s, 4s…
}
}
Cache aggressively. Most “rate limit” problems are really “requesting the same data too often” problems.
Frequently asked questions
What happens when I hit a rate limit?
The API returns HTTP 429. Read x-rate-limit-reset for when your budget refills, and retry after that with backoff.
What are the posting limits?
X documents 200 POST requests per 15 minutes at the user level, and 300 per 3 hours across posts and retweets.