X API Error Codes: Fix 402, 403 and 429 When Posting
X API error codes for posting in 2026: what 402 credits-depleted, 403, 453, 429 and 503 mean on POST /2/tweets, and which ones a retry will never fix.
Retry only 429 and 5xx. A 402 means the pay-per-use balance behind your app is empty (type credits-depleted). A 403 on POST /2/tweets usually means the posting account was blocked, not your keys: duplicate content, anti-spam, a reply you weren't summoned to, or a limited app. 453 means you called an endpoint outside your access.
X API error codes tell you two things when a post fails: whether waiting will fix it, and which part of your setup X refused. On the official X API v2, only 429 and the 5xx codes clear on their own. A 402, 403, 453 or 401 on POST /2/tweets comes back the same way on every retry until you change the balance, the app’s access, the content or the keys.
This guide covers the X API error codes you hit when publishing (not reading), including the ones X’s own reference leaves out, such as 402 credits-depleted and the bare 403 that shows up when everything in your developer console looks fine.
PostGate handles OAuth, publishing and delivery evidence for every network through one API. Start free or read the docs.
How do you read an X API error response?
Every X API error has three layers. The HTTP status says what kind of failure it is. The body, in application/problem+json format, carries a type URI, a short title and a detail with the specific cause. The x-rate-limit-* headers say when a rate-limited window resets. X documents the format in its response codes and errors reference:
{
"title": "Payment Required",
"detail": "credits depleted",
"type": "https://api.x.com/2/problems/credits-depleted"
}
Branch on the status and the type, never on the wording of detail, which X can change at any time. That’s the same rule behind any sound approach to social media API error handling: sort errors by what you do next, not by the message text. One more catch: a 200 can still carry an errors array when you ask for several resources and some are missing, so check for it even on success.
X API error codes for posting: the full table
| Status | Type or code | What it means when you post | Fix | Retry? |
|---|---|---|---|---|
| 400 | invalid-request |
Malformed JSON, missing or wrong parameter | Fix the field the detail names |
No |
| 401 | Generic | X can’t verify the caller: wrong, revoked or regenerated keys, bad OAuth 1.0a signature | Regenerate keys, check the auth method | No |
| 402 | credits-depleted |
The pay-per-use balance behind this app is empty | Add credits, or use the funded app’s keys | No |
| 403 | client-forbidden, reason client-not-enrolled |
The app isn’t enrolled in the access this endpoint needs | Put the app in a pay-per-use project, regenerate keys | No |
| 403 | 453 | You called an endpoint outside your access, often a v1.1 one | Call POST /2/tweets instead |
No |
| 403 | about:blank “Forbidden” |
The posting account can’t create this post right now | See the 403 section below | No |
| 404 | resource-not-found |
The Post you reply to or delete doesn’t exist | Check the ID | No |
| 429 | rate-limit-exceeded |
Window limit hit (100 posts per 15 min per user) | Wait for x-rate-limit-reset |
Yes |
| 429 | usage-capped |
Usage cap for the billing cycle reached | Wait for the next cycle or go Enterprise | Later |
| 500, 502, 503, 504 | Generic | Failure inside X; 503 means X is overloaded | Back off and retry | Yes |
What does a 402 Payment Required mean on the X API?
A 402 means X refused a billable call because the credit balance behind your app has nothing left to spend. Since X launched pay-per-use pricing on February 6, 2026, new developers buy credits up front, and every post draws them down. Per X’s pricing page, creating a Post costs $0.015, a Post that contains a URL costs $0.20, and a summoned reply costs $0.01 (rates in effect since April 20, 2026).
The 402 isn’t listed in X’s response codes reference, which is why it confuses people. Common causes, from the most frequent:
- The balance is at zero or slightly below. X’s docs say a balance can go a little negative, and requests stay blocked until new credits cover the gap.
- Auto-recharge didn’t keep up. It fires at most once every 5 minutes and pauses at a zero or negative balance. A burst that drains a full top-up in under 5 minutes still returns “out of credits”.
- You hit your own spending limit. A spending limit blocks requests until the next billing cycle.
- The request never used the funded credentials. In a November 2026 forum thread, X staff found the only failing
POST /2/tweetshad been sent nine minutes before the credit purchase went through, and no request had arrived since. Media upload had succeeded earlier because it doesn’t deduct credits.
That last point explains a pattern people often misread: the media upload returns 200, then the post itself returns 402. The upload costs nothing, but the post does. Failed requests aren’t billed.
Why does POST /2/tweets return 403 when your keys work?
A 403 means X accepted your credentials and refused the action. Answering a developer with a funded, read-write app, X staff put it plainly: a 403 on POST /2/tweets means the account isn’t permitted to create that post right now, which is different from an auth failure (401) or a billing failure (402). The causes they listed: platform posting limits, spam or integrity blocks, and replying to a conversation you can’t take part in.
Start with one test: post the same text from the same account on x.com. If the web app also refuses, it’s an account problem for X Support, not your code. If the web app works, look at these:
- Duplicate or near-duplicate content. X rejects a post that repeats a recent one, and staff have warned that template posts that differ only in numbers can look like duplicates too.
- Anti-spam on the posting account. In another November 2026 thread, staff traced intermittent 403s to X’s automated protections reacting to a sharp rise in one account’s posting volume, while the account was well under the published limits. Fewer, more distinct posts made the errors stop.
- Replies you weren’t summoned to. Since February 23, 2026, self-serve apps can reply through
POST /2/tweetsonly when the original author @mentioned your account or quoted one of your Posts, according to the X API changelog. Programmatic @mentions and quotes have extra limits. - A muzzled app. If the console shows your app as limited, writes fail with “Application cannot perform write actions”. In one case, staff said the cause was unsolicited @mentions and that the feature had to come out of the app.
- Writes your tier no longer includes. Since April 20, 2026, likes, follows and quote posts through the API are gone from every self-serve tier.
- Read-only permissions or a stale token. The app needs Read and write permissions for a post. After changing them, regenerate the access token and secret; staff gave the same advice in a 453 thread.
If the body has "reason": "client-not-enrolled", the problem is the app, not the account. Check that the app sits in a pay-per-use project and that you are using that app’s keys.
What does X API error 453 mean?
Error 453 comes with a long message: “You currently have access to a subset of X API V2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only.” In practice, the request went to an endpoint your access doesn’t include, usually the old v1.1 statuses/update that older libraries still call. Send posts to POST /2/tweets. The v1.1 media upload and OAuth endpoints are the exceptions the message itself names. If you get 453 on a v2 endpoint, regenerate the credentials, confirm you have credits and recheck Read and write permissions before you open a thread.
Which X API errors should you retry?
Only 429 and 5xx. For a 429, wait until the Unix time in x-rate-limit-reset instead of a fixed delay. Posting allows 100 requests per 15 minutes per user and 10,000 per 24 hours per app; the X API 429 Too Many Requests guide covers the headers and the difference between a window limit and the billing cap.
For 500, 502, 503 and 504, back off with growing pauses and stop after 4 or 5 tries. One caution for posting: a timeout or a 503 doesn’t always mean the post wasn’t created. Check the account’s latest Posts before you send again, or the retry can turn into a duplicate-content 403. Pick a retry policy that reads typed error codes instead of guessing from the status alone.
If you’d rather not maintain this table yourself, PostGate publishes to X along with 11 other networks, and the same publishing works from the no-code dashboard, from an AI agent over MCP or through the REST API. Its X connection uses OAuth 1.0a, and it files X’s duplicate-content 403 as a content failure, so you aren’t told to reconnect an account that’s working. The X platform notes in the docs list what each option supports.
A triage checklist before you post on the forum
- Write down the status, the
type, thereasonand the fulldetail. - 401: regenerate keys and check the signature and clock. 402: check the balance of the app whose keys you’re using.
- 403: try the same post on x.com, then go through the six causes above.
- 453: check the endpoint version.
- 429 or 5xx: back off, then check the timeline before retrying a post.
- Still stuck: the X developer forum asks for your App ID, the endpoint, API version, SDK, the full error and a recent failing timestamp in UTC. Never paste tokens.
For which networks offer a posting API at all, see platforms with a public posting API.
Frequently asked questions
Is a 402 from the X API a bug?
Usually not. It means the pay-per-use balance behind the app has no credits, the balance went slightly negative, auto-recharge was paused, or your own spending limit was hit. If the console shows credits and every billable call still returns 402, post the App ID and a failing UTC timestamp on the developer forum so staff can check which balance the app draws from.
Why does the X API return 403 for a post that works on x.com?
Then the account itself is allowed to post, and the block comes from something specific to API requests: a reply you weren’t summoned to, a write your tier lost (likes, follows, quote posts), missing Read and write permissions, a stale token, or an app that X limited. The detail and reason fields narrow it down.
What is the X API error for duplicate content?
It is a 403 whose detail mentions duplicate content. Retrying the same text returns the same error. Change the post or wait, and if a timeout left you unsure whether the first attempt went through, check the timeline first.
Are Twitter API error codes the same as X API error codes?
Yes. The same API answers on api.x.com and on the older api.twitter.com host, so “twitter api error 403” and “x api error 403” are the same error. Older numbered codes such as 453 still appear in some responses next to the newer type URIs.
