Error Reference

X (Twitter) API Error Reference

Comprehensive reference for X (Twitter) API errors. Find solutions for CreditsDepleted, usage caps, duplicate content, video length restrictions, and authentication errors.

13 error codes5 categoriesAPI v2

Marketing infrastructure for products

Building a product on X? Skip the X developer account.

X has no app review to pass, but its API calls spend credits bought in advance. Your users connect their own accounts through Zernio's X app, so you hold no X credits. Zernio bills X calls at X's published rates.

All Error Codes

#Authentication

unauthorizedrefresh-token

X (Twitter) credentials are invalid. Please reconnect your account.

Solution:

Your X/Twitter credentials are no longer valid. This can happen after a password change or if you revoked app access. Reconnect your account in settings.

invalid credentialsrefresh-token

X (Twitter) credentials are invalid. Please reconnect your account.

Solution:

Your authentication credentials are incorrect or expired. Go to your account settings and reconnect your X/Twitter account.

#Credits

CreditsDepleteduser-error

HTTP 402: Your enrolled account [id] does not have any credits to fulfill this request.

Solution:

The developer account that owns the X app has no prepaid credits left, and X blocks its calls until you buy more in the Developer Console (console.x.com). Auto-recharge is paused while the balance is zero or negative, so the first top-up is manual. With auto-recharge on, X tops up at most once every 5 minutes, so a burst can still drain it: raise the recharge amount. Creating a post costs $0.015, or $0.200 with a URL. The problem type is https://api.twitter.com/2/problems/credits.

#Rate Limiting

usage-cappeduser-error

X (Twitter) usage cap reached.

Solution:

X returns this when the app behind the request exceeds a usage cap. Pay-per-usage plans are capped at 3 million Post reads per monthly billing cycle. Retrying does not help before the next cycle. Check usage in the Developer Console, and ask X for an Enterprise plan if you need more.

usage capuser-error

X (Twitter) usage cap reached.

Solution:

Usage caps apply to the developer app, not to the X account that posts. Cache reads where you can, and check the app's usage and spending limit in the Developer Console.

#Content

duplicateuser-error

You have already posted this content. Please wait before posting again or modify your content.

Solution:

X prevents posting identical content too frequently. Wait at least 30 minutes before posting the same content, or modify your post slightly to make it unique.

you have already posted thisuser-error

You have already posted this content. Please wait before posting again or modify your content.

Solution:

You've posted this exact content recently. X's duplicate detection is very sensitive. Change your text, add different media, or wait before posting.

duplicate-rulesretry

You have already posted this post, please wait before posting again.

Solution:

Duplicate post detected. Wait at least 30-60 minutes before attempting to post similar content. This helps prevent spam on the platform.

invalid urluser-error

Your post contains a URL that is not allowed on X (Twitter).

Solution:

X blocks certain URLs that violate their policies. Remove the URL or use a different link. Avoid using link shorteners that X has blacklisted.

The Tweet contains an invalid URLuser-error

Your post contains a URL that is not allowed on X (Twitter).

Solution:

The URL in your post is blacklisted or considered spam. Use a different URL or remove the link entirely. Ensure the domain has a good reputation.

#Video

video longer than 2 minutesuser-error

Your account is not allowed to post videos longer than 2 minutes. Please upgrade to X Premium or shorten your video.

Solution:

Free X accounts are limited to 2-minute videos. Either: 1) Trim your video to under 2 minutes, or 2) Upgrade to X Premium/Premium+ for longer video support.

video lengthuser-error

Your account is not allowed to post videos longer than 2 minutes. Please upgrade to X Premium or shorten your video.

Solution:

Video length restrictions are based on your subscription tier. Free: 2min, Premium: 10min, Premium+: 120min. Upgrade or reduce your video length.

This user is not allowed to post a video longer than 2 minutesuser-error

Your account is not allowed to post videos longer than 2 minutes. Please upgrade to X Premium or shorten your video.

Solution:

Your account tier doesn't support videos of this length. Upgrade to X Premium ($8/month) for 10-minute videos or Premium+ for 2-hour videos.

Best Practices

Error Handling

  • Implement duplicate detection before posting
  • Alert on CreditsDepleted, and stop retrying until credits are added
  • Validate video length based on account tier
  • Monitor URL reputation

Prevention Tips

  • Avoid posting duplicate content within 30 minutes
  • Check video length limits for your account tier
  • Use reputable URLs only
  • Keep X API credits funded, and watch posts that contain URLs

Need Help with X Integration?

Our API handles error scenarios automatically with smart retry logic and detailed logging.