Quickstart
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_cursor as cursor until has_more is 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 |
|---|
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