The #1 Pain Point for Twitter API Developers
If you've worked with the X (formerly Twitter) API for any length of time, you've hit a rate limit. It's practically a rite of passage. The dreaded 429 Too Many Requests response has derailed more projects than any other single issue in the Twitter developer ecosystem
In 2026, X's API rate limits remain one of the most confusing and frustrating aspects of building on the platform. The pricing model has changed repeatedly since the Elon Musk acquisition, and understanding exactly what you pay for (and how to work within those constraints) is critical for any serious project
This guide covers everything: the current pricing structure, how rate limit headers work, strategies for staying under the limit, and what to do when you inevitably hit one
X API v2 Pricing Overview (2026)
Since February 2026 X has billed the API pay-per-use for everyone. The official pricing page now lists only per-request rates, and the flat Basic ($200/month) and Pro ($5,000/month) subscriptions that older guides describe are legacy plans:
- Post read: $0.005 per post returned ($5 per 1,000)
- User read: $0.010 per user ($10 per 1,000), including users returned by follower and following lists
- Owned reads (your own account's data): $0.001
- Create a post: $0.015, or $0.20 when the post contains a URL (since April 20, 2026)
- Following, liking and quote-posting through the API were removed from all self-serve tiers in April 2026
- Cap: 3 million post reads per monthly billing cycle, anything above that is Enterprise only
- Free allowance: none on the pricing page. New accounts can get a one-time $20 credit for saving a card and a one-time match of the first auto-recharge up to $50, and credits expire after 3 months
- Enterprise: no public price, 2023 reports put it at $42,000/month and up
What this means for rate limits
Per-window rate limits still exist on each endpoint and a 429 is still the signal to back off, so everything in the sections below about headers, backoff and caching applies. The older per-tier request caps (for example roughly 15 requests per 15 minutes on Basic) belonged to the legacy plans, so check the current limit for your endpoint in the official docs rather than relying on a number from an older guide
Quick Cost Table
| Reads | Official X API (pay-per-use) |
|---|---|
| 1,000 posts | $5 |
| 100,000 posts | $500 |
| 1,000 user profiles | $10 |
| 3,000,000 posts (the monthly cap) | $15,000 |
App-Level vs User-Level Rate Limits
One of the most confusing aspects of X's rate limiting is the distinction between app-level and user-level limits
App-Level Limits
These apply to your entire application regardless of how many users are authenticated. If your app exhausts an endpoint's request budget for the current window, all subsequent requests get rejected, even for different users
App-level limits use App-Only authentication (Bearer Token). Most read endpoints fall under this category
User-Level Limits
These apply per authenticated user. If you're building an app where users sign in with their X account (OAuth 2.0), each user gets their own rate limit bucket. This can effectively multiply your capacity
For example, the GET /2/tweets/:id endpoint allows:
- App-level: 300 requests per 15 minutes
- User-level: 900 requests per 15 minutes (per user)
The catch? User-level auth requires OAuth 2.0 PKCE flow, which adds significant complexity to your application
Understanding Rate Limit Headers
Every response from the X API includes three rate limit headers:
x-rate-limit-limit: 300
x-rate-limit-remaining: 247
x-rate-limit-reset: 1704067200
-
x-rate-limit-limit: Maximum number of requests allowed in the current window -
x-rate-limit-remaining: How many requests you have left -
x-rate-limit-reset: Unix timestamp (seconds) when the window resets
Always read these headers, they're your early warning system. Don't wait until you get a 429: check remaining proactively and slow down when it gets low
import requests
import time
def check_rate_limit(response):
remaining = int(response.headers.get("x-rate-limit-remaining", 0))
reset_time = int(response.headers.get("x-rate-limit-reset", 0))
if remaining < 5:
sleep_time = reset_time - int(time.time()) + 1
if sleep_time > 0:
print("Rate limit nearly exhausted. Sleeping " + str(sleep_time) + "s...")
time.sleep(sleep_time)
return remaining
Handling 429 Too Many Requests
When you exceed your rate limit, the API returns a 429 status code with a body like:
{
"title": "Too Many Requests",
"detail": "Too Many Requests",
"type": "about:blank",
"status": 429
}
The wrong way to handle this: immediately retry the request. This can cascade into a retry storm that keeps you locked out longer
The right way: implement exponential backoff with jitter
Exponential Backoff Implementation
import requests
import time
import random
def request_with_backoff(url, headers, max_retries=5):
"""Make an API request with exponential backoff on 429 errors."""
for attempt in range(max_retries):
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response
if response.status_code == 429:
# Check the reset header first
reset_time = int(response.headers.get("x-rate-limit-reset", 0))
now = int(time.time())
if reset_time > now:
# Sleep until the window resets
wait = reset_time - now + 1
print("Rate limited. Waiting " + str(wait) + "s until reset...")
time.sleep(wait)
else:
# Fallback: exponential backoff with jitter
base_wait = min(2 ** attempt, 64)
jitter = random.uniform(0, base_wait * 0.5)
wait = base_wait + jitter
print("Rate limited (attempt " + str(attempt + 1) + "). Backing off " + str(round(wait, 1)) + "s...")
time.sleep(wait)
else:
# Non-rate-limit error, raise immediately
response.raise_for_status()
raise Exception("Max retries exceeded after " + str(max_retries) + " attempts")
Why jitter matters: If 10 clients all hit the rate limit at the same time and all retry after exactly 2 seconds, they'll all collide again. Adding random jitter (noise) to the backoff spreads out the retries and reduces thundering herd problems
Strategies to Maximize Your Quota
Rate limits don't have to ruin your project. Here are battle-tested strategies to get the most out of your allocation:
1. Aggressive Caching
Cache every response. Most Twitter data doesn't change second-by-second. A user's profile can be cached for 15-60 minutes. Tweet data can be cached even longer since tweets are immutable (aside from like/retweet counts)
import time
class SimpleCache:
def __init__(self):
self.store = {}
def get(self, key, ttl=900):
"""Get a cached value if it exists and hasn't expired."""
if key in self.store:
value, timestamp = self.store[key]
if time.time() - timestamp < ttl:
return value
return None
def set(self, key, value):
self.store[key] = (value, time.time())
cache = SimpleCache()
def get_user(username, headers):
cached = cache.get("user:" + username, ttl=900) # 15 min cache
if cached:
return cached
url = "https://api.x.com/2/users/by/username/" + username
response = request_with_backoff(url, headers)
data = response.json()
cache.set("user:" + username, data)
return data
2. Batch Requests
Instead of fetching users one by one, use batch endpoints. The /2/users endpoint accepts up to 100 user IDs in a single request. That's 100x more efficient than individual lookups
# Bad: 100 requests for 100 users
for user_id in user_ids:
response = requests.get(
"https://api.x.com/2/users/" + user_id,
headers=headers
)
# Good: 1 request for 100 users
ids_param = ",".join(user_ids[:100])
response = requests.get(
"https://api.x.com/2/users?ids=" + ids_param,
headers=headers
)
3. Request Queuing
Instead of making requests as fast as possible, queue them and process at a controlled rate. This prevents bursts that eat through your 15-minute window
import time
from collections import deque
class RateLimitedQueue:
def __init__(self, max_per_window=150, window_seconds=900):
self.max_per_window = max_per_window
self.window_seconds = window_seconds
self.timestamps = deque()
def wait_if_needed(self):
"""Block until we can safely make another request."""
now = time.time()
# Remove timestamps outside the current window
while self.timestamps and self.timestamps[0] < now - self.window_seconds:
self.timestamps.popleft()
if len(self.timestamps) >= self.max_per_window:
# Wait until the oldest request falls outside the window
sleep_time = self.timestamps[0] - (now - self.window_seconds) + 0.1
if sleep_time > 0:
print("Queue full. Sleeping " + str(round(sleep_time, 1)) + "s...")
time.sleep(sleep_time)
self.timestamps.append(time.time())
queue = RateLimitedQueue(max_per_window=140) # Leave 10 request buffer
def queued_request(url, headers):
queue.wait_if_needed()
return requests.get(url, headers=headers)
4. Use Fields and Expansions Wisely
Every X API request supports tweet.fields, user.fields, and expansions parameters. Request only the fields you need. Smaller responses are faster and count the same toward your rate limit as large ones, so there's no penalty for being specific, but you do cut down bandwidth and processing time
# Instead of getting everything:
url = "https://api.x.com/2/tweets/" + tweet_id
# Only request what you need:
url = ("https://api.x.com/2/tweets/" + tweet_id
+ "?tweet.fields=created_at,public_metrics"
+ "&expansions=author_id"
+ "&user.fields=username,verified")
5. Use Conditional Requests
For endpoints that support it, use If-None-Match headers with ETags. If the data hasn't changed, the API returns 304 Not Modified, which does not count against your rate limit
Billing and Caps: The Hidden Rate Limit
Beyond the per-window limits, every post you read is billed, and reads are capped at 3 million posts per monthly billing cycle. Billing is separate from the 15-minute window system and arguably more painful
Take a monitoring dashboard that checks 20 accounts every hour and pulls the latest 50 posts from each:
- 1,000 posts per hour
- 24,000 posts per day, about $120 at $0.005 per post
- About $3,600 per month, since reads are billed per post returned even when most of them are duplicates of the previous poll
Caching and incremental fetching (only asking for posts newer than the last one you saw) cut that bill directly, which is why they matter more now than they did under flat monthly plans
Common Pitfalls
Pagination Drains
Each page of results counts as a separate request. Fetching a user's followers with 50 per page across 20 pages uses 20 requests. If that user has 100K followers, you'll pay $10 per 1,000 users returned, about $1,000 for the full list
Search is Expensive
The /2/tweets/search/recent endpoint has tighter limits than most other endpoints, and every post it returns is billed at $0.005. Complex queries with multiple operators don't reduce the count either: each request is one request regardless of query complexity
Streaming Costs
The filtered stream endpoint (/2/tweets/search/stream) was historically reserved for the legacy $5,000/month Pro plan. Check the current docs for stream access before you design around it
Deleted Tweets Still Count
If you request a tweet that has been deleted, the API returns an error response, but it still counts against your rate limit. There's no way around it
Rate Limiting Best Practices Checklist
- Always read rate limit headers before making the next request
- Implement exponential backoff with random jitter for 429 responses
- Cache aggressively: most Twitter data can be cached for 5-60 minutes
- Use batch endpoints wherever possible (users, tweets)
- Queue requests instead of firing them as fast as possible
- Monitor monthly quotas separately from per-window limits
- Log every 429 so you can analyze patterns and optimize
- Test with lower limits in development to catch issues early
- Use webhooks instead of polling where available
- Estimate your read volume first: at $0.005 per post, a poll loop that re-reads the same posts is the most expensive bug you can ship
The Bigger Picture
Rate limits exist for a reason: they protect the platform from abuse and ensure fair access. But per-post billing at $0.005 makes mid-size and large read workloads costly, and the 3 million post monthly cap pushes anything bigger to Enterprise. Our X API pricing comparison breaks down what the official API works out to per tweet read
Many developers spend more engineering time working around rate limits than building their actual product. Between implementing caching layers, backoff logic, request queues, and quota monitoring, the infrastructure overhead adds up fast
Search is where these limits bite first, since recent search is both rate-capped per window and quota-capped per month. Our guide to searching tweets with twitter-api-v2 in Node.js shows where the 429s show up in practice and how to page around them
Alternatively, services like XCROP provide higher limits without the complexity of managing Twitter's rate limit tiers. Instead of dealing with 15-minute windows and per-post billing at $5 per 1,000 posts, you get a simple credit-based system where you pay a fixed number of credits per result returned (10 credits minimum per call): no surprise throttling, no tier math. See how credits map to each endpoint and the full pricing tiers; the free plan includes 5,000 credits/month to test with
Whatever approach you choose, understanding rate limits deeply is essential. The strategies in this guide will help you build more resilient applications and avoid the most common traps that catch developers off guard
FAQ
What are the X API v2 rate limits in 2026?
Limits are set per endpoint in 15-minute windows, and a 429 means you exceeded the current one. Since February 2026 the official API is also pay-per-use: $0.005 per post read, $0.010 per user read, and a cap of 3 million post reads per monthly billing cycle. The older flat Basic and Pro plans with fixed monthly read quotas are legacy
How do you fix a 429 Too Many Requests error?
Do not retry immediately, that turns into a retry storm and keeps you locked out longer. Read the x-rate-limit-reset header and sleep until the window resets. If the header is missing, fall back to exponential backoff with random jitter so multiple clients do not collide on the same retry
What is the difference between app-level and user-level rate limits?
App-level limits apply to your whole application regardless of how many users are signed in, and they use Bearer-token app-only auth. User-level limits apply per authenticated user, so each signed-in user gets their own bucket, which effectively multiplies capacity. The catch is that user-level auth needs the OAuth 2.0 PKCE flow
Which rate limit headers should you read?
Three come back on every response: x-rate-limit-limit is the ceiling for the current window, x-rate-limit-remaining is what you have left, and x-rate-limit-reset is the Unix timestamp when the window resets. Check remaining proactively and slow down as it drops rather than waiting for the 429
Originally published on the XCROP blog.
Top comments (0)