Documentation
X API documentation
31 endpoints for reading public X data and 23 account actions, priced per request. Everything on these pages is generated from our OpenAPI spec, which you can also load into Postman or any OpenAPI client.
Quickstart
- 01
Create an account
Sign up with Google or an email address.
- 02
Copy your API key
Your dashboard shows the key once, the first time you open it. Store it somewhere safe; you can generate a new one at any time.
- 03
Send your first request
Pass the key in the
x-api-keyheader.curl "https://api.cheapxapi.com/twitter/user/info?userName=NASA" \ -H "x-api-key: YOUR_KEY"
Essentials
API for public X (Twitter) data and account actions.
Authentication — send your API key in the x-api-key request header. Keys in the URL are rejected.
Pricing (data endpoints) — $0.0006 per request, pay as you go. Every request is charged except when the failure is on our side:
charged: successful responses, "not found" style responses (e.g. user does not exist), invalid parameters, unknown endpoints;
not charged: rate-limited requests (429), insufficient balance (402), invalid key (401), items reported as not found with HTTP 404, and service errors (503).
Each charged response carries x-balance-remaining (USD); every response carries x-request-id.
Rate limits — 2 requests per second for new accounts, 10 per second for paid accounts; at most 10 requests in flight per account.
Not found results — most endpoints report a missing user, tweet or list as HTTP 200 with "status": "error" (charged). Always check the status field, not only the HTTP status code.
Pagination — paginated endpoints return has_next_page and next_cursor. Pass next_cursor as cursor to get the next page.
Stop when has_next_page is false or next_cursor is empty; the API sets both when the end is reached. Use has_next_page (some endpoints also return a legacy has_next field; ignore it).
Timeouts — most requests return in under a second, some take several seconds; set your client timeout to at least 75 seconds.
Account actions — post, like, retweet, follow, message and more as an X account you control.
First call Log in to an X account to get login_cookies, then send login_cookies and the same proxy with every action.
We pass these values through for the request only and never store or log your password, two-factor secret, login_cookies or proxy credentials.
Pricing: login $0.1 per request, every other action $0.0006 per request. HTTP 200 is charged, including when X rejects the action ("status": "error", the reason is in message); invalid fields (400), rate limits and service errors are not.
Do not retry an action automatically after a timeout: it may already have been applied on X.
X limits how often each account may act; we cap posts and messages at 5 per minute and follows at 15 per minute per X account to protect it.
X API endpoints
Users
- Get user profileGET /twitter/user/info
- Get user 'about' detailsGET /twitter/user_about
- Get users by IDsGET /twitter/user/batch_info_by_ids
- Search usersGET /twitter/user/search
- Get user's latest tweetsGET /twitter/user/last_tweets
- Get user's tweet timelineGET /twitter/user/tweet_timeline
- Get user mentionsGET /twitter/user/mentions
- Get user's articlesGET /twitter/user/articles
Followers
Tweets
- Get tweet by IDGET /twitter/tweets
- Advanced searchGET /twitter/tweet/advanced_search
- Get tweet repliesGET /twitter/tweet/replies
- Get tweet replies (sortable)GET /twitter/tweet/replies/v2
- Get thread contextGET /twitter/tweet/thread_context
- Get quote tweetsGET /twitter/tweet/quotes
- Get retweetersGET /twitter/tweet/retweeters
- Get articleGET /twitter/article
Lists
Communities
Account actions
- Log in to an X accountPOST /twitter/user_login_v2
- Post a tweet or replyPOST /twitter/create_tweet_v2
- Delete a tweetPOST /twitter/delete_tweet_v2
- Like a tweetPOST /twitter/like_tweet_v2
- Unlike a tweetPOST /twitter/unlike_tweet_v2
- RetweetPOST /twitter/retweet_tweet_v2
- Undo retweetPOST /twitter/unretweet_tweet_v2
- Pin a tweetPOST /twitter/pin_tweet_v2
- Unpin a tweetPOST /twitter/unpin_tweet_v2
- Bookmark a tweetPOST /twitter/bookmark_tweet_v2
- Remove a bookmarkPOST /twitter/unbookmark_tweet_v2
- Get bookmarksPOST /twitter/bookmarks_v2
- Follow a userPOST /twitter/follow_user_v2
- Unfollow a userPOST /twitter/unfollow_user_v2
- Mute a userPOST /twitter/mute_user_v2
- Unmute a userPOST /twitter/unmute_user_v2
- Block a userPOST /twitter/block_user_v2
- Unblock a userPOST /twitter/unblock_user_v2
- Send a direct messagePOST /twitter/send_dm_to_user
- Upload mediaPOST /twitter/upload_media_v2
- Update profilePATCH /twitter/update_profile_v2
- Update profile photoPATCH /twitter/update_avatar_v2
- Update header imagePATCH /twitter/update_banner_v2