Quickstart
1Sign up with GoogleYour key is on the dashboard.
2Save it as an env var
TWITTERXAPI_KEY3Make your first requestFetch a profile below.
curl "https://twitterxapi.com/api/v1/users/marclou" \
-H "Authorization: Bearer $TWITTERXAPI_KEY"import os, requests
response = requests.get(
"https://twitterxapi.com/api/v1/users/marclou",
headers={"Authorization": f"Bearer {os.environ['TWITTERXAPI_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()const response = await fetch("https://twitterxapi.com/api/v1/users/marclou", {
headers: { Authorization: `Bearer ${process.env.TWITTERXAPI_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();- Read the next page. Pass
pagination.next_cursorascursoruntilhas_moreis false. Pagination
Basics
| Base URL | https://twitterxapi.com/api. REST routes are under /v1; the MCP server is /mcp. |
|---|---|
| Authentication | Authorization: Bearer <key> on every request. Quickstart |
| Response format | JSON. Choose level=moderate (default), contentful or raw. Response levels |
| Pagination | One page per request, continued with a cursor. Pagination |
| Billing | Prepaid credit, per record returned. Lookups cost $0.001. Failed requests are refunded. Errors and billing |
| Larger reads | Queue an account's posts or a search and download one NDJSON file. Queued jobs |
All endpoints
/v1/users/{username} | Profile by username |
/v1/users/by-id/{userId} | Profile by ID |
/v1/users/{username}/about | Account information |
/v1/users/{username}/tweets | Posts |
/v1/users/{username}/posts-and-replies | Posts and replies |
/v1/users/{username}/media | Media |
/v1/users/by-id/{userId}/followers | Followers |
/v1/users/by-id/{userId}/verified-followers | Verified followers |
/v1/users/by-id/{userId}/following | Following |
/v1/users/by-id/{userId}/subscriptions | Creator subscriptions |
/v1/posts/{postId} | Post details |
/v1/posts/{postId}/replies | Direct replies |
/v1/posts/{postId}/thread | Conversation thread |
/v1/posts/{postId}/retweeters | Retweeters |
/v1/search | Search posts |
/v1/search/users | Search accounts |
/v1/search/trend | Search a trend |
/v1/lists/{listId}/posts | List posts |
/v1/lists/{listId}/members | List members |
/v1/trends/{category} | Trends |
/v1/communities/{communityId} | Community information |
/v1/communities/{communityId}/posts | Community posts |
/v1/communities/{communityId}/members | Community members |
/v1/communities/{communityId}/moderators | Community moderators |
Status codes
| Status | Meaning |
|---|---|
200 | Success. Collection routes return one page. |
202 | Queued job accepted. |
400 | Invalid parameter, or a limit parameter on a live route. |
401 | Missing or invalid API key. |
402 | Balance too low for the request or queued job. |
404 | The account, post, List, community or job was not found. |
429 | Busy or rate limited. Wait for Retry-After when present, then retry. |
5xx | Temporary upstream or service failure. Retry with backoff. |
Error bodies carry a stable code and a request ID. Errors and billing