X (Twitter)Updated
X (Twitter) API error codes and how to fix them
X API v2 errors come as an HTTP status plus a JSON body with a title and detail, or an errors array. 401 is an invalid token, 402 CreditsDepleted an empty pay-per-use balance, 403 covers duplicate text, reply rules, length and access tier, and 429 is a rate limit. Each case below has the fix. Siar, a unified social media API, keeps X (Twitter)’s own code and message on the post and adds the fix below.
Jump to a code: 402 CreditsDepleted, 403 duplicate, 401, 403 reply, 403 video, 403 too long, 403 client-not-enrolled, 403 quote, 400 invalid-request, 400 media, 404, 429, 503.
Codes and messages are what X (Twitter) returns. Where X (Twitter) documents a code, this page follows its docs.
402 CreditsDepleted · Your enrolled account does not have any credits… · the X credit balance is empty
X returns 402 CreditsDepleted when the pay-per-use credit balance behind your developer account is used up. Fix: add credits in the X developer console, then retry. Auto-recharge does not run while the balance is zero or below, so the first top-up after that must be manual.
What Siar does with it: With Siar, X usage is paid from your prepaid Siar X credit at X's own USD prices. Siar holds the cost before each X call. If your credit is short, the post stops before X is called, with "Not enough X credit. Top up in Billing → Credits, then retry." A credit.exhausted webhook fires at zero; other networks keep publishing.
X (Twitter)'s message: Your enrolled account does not have any credits to fulfill this request.
Related: X API pricing per post
403 duplicate · You are not allowed to create a Tweet with duplicate content · the same text was just posted
X rejects a post with 403 when the account has recently posted the same text. X does not publish the time window. Fix: change the text, for example add the date, a different link or a line of context, and post again. Don't retry the same request unchanged.
What Siar does with it: Siar keeps X (Twitter)'s code and message on the post, word for word, marks it "don't retry" or "unknown", and still publishes to the other networks in the post. Fix the cause, then call POST /post/{id}/retry: only the failed networks are sent again, and the retry doesn't count as another post.
X (Twitter)'s message: You are not allowed to create a Tweet with duplicate content.
Related: How Siar avoids posting twice
401 · Unauthorized · the token is invalid or revoked
The access token expired or the user revoked the app. Refresh the OAuth 2.0 token with the refresh token; if that fails, have the user authorize the app again.
What Siar does with it: Siar refreshes the token itself where X (Twitter) allows it. If that fails, Siar marks the account as needing reconnection and keeps this error on the post. Later posts to the account stop with "Reconnect this account, then retry the post." until your customer reconnects through the same connect link.
X (Twitter)'s message: Unauthorized
403 reply · Reply to this Tweet is not allowed… · replies are limited to conversations you're part of
API replies are only allowed to conversations that mention or quote the account. Only reply to posts that mention the connected account, or to its own posts.
What Siar does with it: Siar keeps X (Twitter)'s code and message on the post, word for word, marks it "don't retry" or "unknown", and still publishes to the other networks in the post. Fix the cause, then call POST /post/{id}/retry: only the failed networks are sent again, and the retry doesn't count as another post.
X (Twitter)'s message: Reply to this Tweet is not allowed because you have not been mentioned or otherwise engaged by the author of the Tweet you are replying to.
403 video · This user is not allowed to post a video longer than 20 minutes · the video is too long for this account
Video length exceeds the account tier (20 min standard, 125 min Premium). Trim the video or post from a Premium account.
What Siar does with it: Siar keeps X (Twitter)'s code and message on the post, word for word, marks it "don't retry" or "unknown", and still publishes to the other networks in the post. Fix the cause, then call POST /post/{id}/retry: only the failed networks are sent again, and the retry doesn't count as another post.
X (Twitter)'s message: This user is not allowed to post a video longer than 20 minutes.
403 too long · Your Tweet text is too long · the text is over 280 characters
Text exceeds 280 weighted characters on a non-Premium account (URLs count 23, emoji and CJK count 2). Shorten it to 280 weighted characters (links count 23, emoji 2), or split it into a thread.
What Siar does with it: Siar keeps the error on the post. To have Siar split long text into a numbered thread, set tweetStorm: true.
X (Twitter)'s message: Your Tweet text is too long.
403 client-not-enrolled · Client Forbidden · the app isn't attached to a project
The X app is not attached to a project with API access. Attach the app to a project in the X developer console.
What Siar does with it: With Siar, X calls run through Siar's own X app, so this error would mean a problem on Siar's side, not yours. The post keeps the message so you can report it.
X (Twitter)'s message: Client Forbidden
403 quote · Quoting is not available on this access tier · your access level can't quote
quote_tweet_id needs a higher X API access level. Post a link to the post instead of quoting it.
What Siar does with it: Siar keeps X (Twitter)'s code and message on the post, word for word, marks it "don't retry" or "unknown", and still publishes to the other networks in the post. Fix the cause, then call POST /post/{id}/retry: only the failed networks are sent again, and the retry doesn't count as another post.
X (Twitter)'s message: Quoting is not available on this access tier.
400 invalid-request · One or more parameters to your request was invalid · a field failed X's checks
A field failed X validation (poll options, media ids, reply id). Read errors[].message in the error meta and correct that field.
What Siar does with it: Siar keeps X (Twitter)'s code and message on the post, word for word, marks it "don't retry" or "unknown", and still publishes to the other networks in the post. Fix the cause, then call POST /post/{id}/retry: only the failed networks are sent again, and the retry doesn't count as another post.
X (Twitter)'s message: One or more parameters to your request was invalid.
400 media · Your media IDs are invalid · the media id expired or failed
A media id expired (24 h) or failed processing. Upload the media again and use the new id within 24 hours.
What Siar does with it: Siar keeps X (Twitter)'s code and message on the post, word for word, marks it "don't retry" or "unknown", and still publishes to the other networks in the post. Fix the cause, then call POST /post/{id}/retry: only the failed networks are sent again, and the retry doesn't count as another post.
X (Twitter)'s message: Your media IDs are invalid.
404 · Could not find tweet with id · the post doesn't exist or is protected
The post was deleted or is from a protected account. Check the post still exists.
What Siar does with it: Siar keeps X (Twitter)'s code and message on the post, word for word, marks it "don't retry" or "unknown", and still publishes to the other networks in the post. Fix the cause, then call POST /post/{id}/retry: only the failed networks are sent again, and the retry doesn't count as another post.
X (Twitter)'s message: Could not find tweet with id.
429 · Too Many Requests · a rate-limit window is used up
Per-user or per-app rate limit window exhausted. Wait until the `x-rate-limit-reset` time (a Unix timestamp), then retry.
What Siar does with it: Siar treats it as temporary and tries again on its own, up to three attempts in all. It waits for X (Twitter)'s reset time when Siar can read one from the response, otherwise 30 seconds, then 60. These attempts don't use the post's manual retries. If the last attempt fails too, the error stays on the post.
X (Twitter)'s message: Too Many Requests
503 · Service Unavailable · X is overloaded
X is overloaded. Retry with backoff.
What Siar does with it: Siar treats it as temporary and tries again on its own, up to three attempts in all. It waits for X (Twitter)'s reset time when Siar can read one from the response, otherwise 30 seconds, then 60. These attempts don't use the post's manual retries. If the last attempt fails too, the error stays on the post.
X (Twitter)'s message: Service Unavailable
Where to see a X (Twitter) error in Siar
Read a failed post with GET /post/{id}. The error field sums it up, errors lists the result per network, and errorsVerbose keeps X (Twitter)'s own code, message and HTTP status, a plain-English message, and a retry verdict: retryable, non_retryable or unknown. A signed post.published webhook fires when the post has published or failed, with each network's result. Fix the cause and retry with POST /post/{id}/retry.
Siar, a unified social media API, publishes to Facebook, Instagram, Threads, X, LinkedIn profiles, Bluesky, Mastodon, Discord and Slack today. See each network's status, or go back to Post to X (Twitter) via API.
Error codes for other networks
The same pattern, for each network Siar is built for: social media API error codes, by network. For errors from Siar's own API (a 401 for a missing key, a 429 rate limit), see Siar API errors and status codes.
TikTok API error codes · YouTube API error codes · Instagram API error codes · Facebook API error codes · Threads API error codes · LinkedIn API error codes · Pinterest API error codes · Reddit API error codes · Mastodon API error codes · Discord API error codes · Slack API error codes · Bluesky API error codes · Google Business Profile API error codes · Snapchat API error codes
Frequently asked questions
What does X API error 402 CreditsDepleted mean?
Your X developer account's pay-per-use credit balance is empty or below zero, so X blocks API requests until you add credits. Auto-recharge doesn't run at a zero or negative balance, so top up manually first. With Siar, X usage comes from your prepaid Siar X credit, checked before every X call.
Should I retry a failed X (Twitter) API request?
Only if the error is temporary. Rate limits (429 and X (Twitter)'s own rate-limit codes) and 5xx errors can be retried after the reset time. Token, permission, duplicate and content errors fail the same way every time, so fix the cause first. Each entry on this page says which kind it is.
Why does the X (Twitter) API reject a request that looks right?
Usually because of something outside the request body: an expired token, a permission the user didn't grant, the account's daily limit, or text the account posted recently. Read the code and message first, then match it to an entry on this page. Validating length and media before sending catches most of the rest.
Does Siar retry failed X (Twitter) posts automatically?
For temporary errors, yes: Siar tries up to three times in all, waiting for the network's reset time when it can read one. Other errors stay on the post with X (Twitter)'s own code and message. Fix the cause and retry: only the failed networks are sent again, and the retry doesn't count as another post.
Will retrying a failed post publish it twice?
Not through Siar's retry. Each network in a post is claimed once, and only the networks that failed are sent again. An interrupted send is checked against the account before anything is re-sent. But calling the create endpoint again makes a new post: Siar has no client idempotency key, so check your own records first.
Your first post is one request away.
Start with 20 free posts to try. No card. A one-time allowance, with no time limit.