API Overview
TwexAPI REST reference — authentication, response format, pagination, errors, rate limits, and endpoint groups.
TwexAPI exposes a REST API at https://api.twexapi.io for X/Twitter reads, writes, search, followers, DMs, lists, communities, articles, and account utilities.
Use this page as the entry point before opening individual endpoint pages in the sidebar.
Base URL
https://api.twexapi.io
Authentication
Send your API key on every request:
Authorization: Bearer YOUR_API_KEY
Public-data reads require an API key. Account-private operations such as delegate invitation lookup also require the authorized account’s X cookie or auth_token.
Response format
Successful responses use a consistent envelope:
{
"code": 200,
"msg": "success",
"data": {}
}
Errors return non-2xx HTTP status codes with a JSON body. See Error Handling for recovery patterns and Error Reference for endpoint-specific messages and X error codes.
Pagination
Many list and search endpoints return cursor fields such as has_next_page, next_cursor, or page tokens inside data. Pass the cursor from the previous response unchanged on the next request. Preserve cursors outside chat or workflow memory when jobs must resume after failures.
Check balance
Inspect remaining credits before large exports:
curl --request GET \
--url 'https://api.twexapi.io/balance' \
--header 'Authorization: Bearer YOUR_API_KEY'
Open Get Balance for the full schema.
High-Intent Use Cases & Solutions
Find the exact endpoint for your Twitter data scraping, monitoring, and automation needs:
| Scenario / Search Intent | Recommended Endpoint | Credentials Needed | Why Use It |
|---|---|---|---|
| Scrape Twitter without Login or Cookie | POST /twitter/advanced_search/pageGET /twitter/{screen_name}/aboutPOST /v2/tweet/detail |
API Key only | Read public tweets, profiles, and engagement with zero X accounts, cookies, or risk of bans. See Scraper vs TwexAPI and Nitter Alternatives. |
| Cost-Effective X API Alternative | Pricing & Billing Guide | API Key only | Avoid Official X’s per-resource multipliers and $0.20 URL surcharges. Pay strictly per request ($0.000050~) with $0 monthly minimums. See TwexAPI vs Official X API. |
| Advanced Tweet Search by Keywords & Dates | POST /twitter/advanced_search/page |
API Key only | Filter by keywords, authors, date ranges, min likes, and language using cursor pagination. |
| Export Competitor Followers & Audience | POST /v3/twitter/users/followers |
API Key only | Export thousands of follower profiles for social graph modeling and competitor intelligence. |
| Scrape Tweet Replies & Conversation Tree | POST /twitter/tweets/{tweet_id}/replies/page |
API Key only | Paginate through replies and comments under viral posts with cursor continuity. |
| Unroll Tweet Threads into Markdown | POST /twitter/tweets/thread_by_id |
API Key only | Reconstruct full multi-part author threads into ordered, coherent text. |
| Extract X Articles into Clean Markdown | GET /x/article/{tweet_id}/markdown |
API Key only | Transform long-form X Articles into clean Markdown ideal for LLM context and RAG pipelines. |
| Crypto & Stock Sentiment Tracking | POST /twitter/cashtagsPOST /twitter/hashtags |
API Key only | Monitor financial cashtags ($BTC, $NVDA, $TSLA) and trending hashtags in real time. |
| Global & Regional Viral Trends | GET /twitter/global-trending/tweets |
API Key only | Fetch breakout viral posts and trending topics filtered by country and category. |
| AI Coding Assistant & Agent Tooling | TwexAPI MCP Server | API Key only | Connect Cursor, Claude Code, LangChain, or CrewAI to discover and execute Twitter queries autonomously. |
| Automated Bot Posting & Account Actions | Tweet Actions Endpoints | API Key + BYOC Cookie | Post tweets, reply, like, and follow via stateless BYOC (Bring Your Own Cookie) with zero credential retention. |
Endpoint groups
Browse generated pages under Endpoints in the sidebar, or jump to common groups:
| Group | Typical jobs |
|---|---|
| Search | Keyword search, hashtags, cashtags. Build searchTerms with Advance Search TwitterXAPI. |
| Users | Profile lookup, batch user reads |
| Followers & Following | Follower and following exports |
| Tweet Actions | Post, reply, like, retweet, bookmark |
| Trending | Global trending topics and tweets |
| DM | DM status, send, and history |
| Balance | Credit balance |
Agent and SDK paths
| Integration | When to use |
|---|---|
| MCP Server | AI agents that should discover routes with explore before calling twexapi_request |
| SDKs | Typed clients with retries and pagination helpers |
| CLI | Terminal scripts and JSON output |
| Framework Guides | LangChain, CrewAI, n8n, Prefect, and other agent hosts |
Operational guides
- Error Reference — endpoint-specific messages, X codes, and retry decisions
- Error Handling — HTTP status recovery, MCP errors, and write retries
- Rate Limits — throughput guidance and
429backoff - Authentication — API keys, Bearer headers, and write credentials
What TwexAPI does not expose today
TwexAPI does not ship native account monitors, event webhooks, or async extraction jobs as first-class API products. Use scheduled REST calls (Prefect, n8n, cron) or no-code platform webhooks to receive agent handoffs, then continue with direct API requests.
Data handling
TwexAPI does not maintain an archive or database of X content. We do not persist copies of public posts, X Articles, direct-message content, or AI chat content obtained through customer requests.
Requests are processed in transit. We retain only limited operational information necessary for security, abuse prevention, billing, and service reliability, such as request timestamps, endpoint usage, status codes, and credit consumption. We do not sell or provide archived X-content datasets.