Skip to content

REST

Twitter REST API: Endpoints, Auth and Examples

Updated July 2026

A Twitter REST API is an HTTP interface where each piece of X data has its own URL, you fetch it with a normal GET, and you get JSON back. TwitterAPIs serves 51 endpoints from api.twitterapis.com, split into 37 reads and 14 writes, authenticated by a single Authorization Bearer header, paged by cursor, and billed at $0.0008 per call with no rate-limit window to schedule around.

We bill each standard REST call at $0.0008 (source: our published pricing), with no monthly plan and no minimum.

The smallest call that works

One header and one URL. Nothing to install, no client library, no handshake before the first request. This returns a profile record as JSON and costs $0.0008.

1curl -H "Authorization: Bearer YOUR_API_KEY" \
2 "https://api.twitterapis.com/twitter/user/info?userName=nasa"

Swap the path for /twitter/user/tweets to read posts, or /twitter/tweet/advanced_search to run a query. The header, the query-string convention and the JSON envelope are identical on all 51 endpoints, so this first call generalises to the rest of the surface.

The conventions, in one table

Every endpoint obeys the same eight rules. Learn them once and you can call anything on the surface without re-reading a reference page each time.

ConventionHow it behaves
Base URLhttps://api.twitterapis.com, HTTPS only, no versioned path prefix to migrate off later.
AuthOne header on every request: Authorization: Bearer YOUR_API_KEY. No OAuth handshake, no app registration, no token refresh loop.
VerbsGET reads, POST writes. A read never changes state and a write is always a POST, so retries on a GET are always safe.
ParametersQuery-string parameters on both reads and writes. Only session registration takes a JSON body.
ResponsesJSON on every path, success or failure, so a client never has to branch on content type.
PagingCursor-based. A paged response carries next_cursor plus a has_more boolean. Loop while has_more is true; no offset arithmetic and no server-side state.
ErrorsStandard HTTP status codes with a JSON body carrying the reason. 401 means the key is wrong, 402 means the balance is empty, 404 means the account or post does not exist.
Rate limitsNone imposed by us. There is no 15-minute window to schedule around, so throughput is a function of your own concurrency.

The 51 endpoints, grouped by what they touch

Six families cover the whole surface. Each one has a page that goes deeper on its own endpoints, parameters and pricing.

FamilyEndpointsExample callWhat it coversGo deeper
User reads14GET /twitter/user/infoProfiles, posts, likes, media, mentions, home timeline, searchTwitter user API
Write actions12POST /twitter/tweet/favoriteLike, repost, bookmark, follow, publish, delete, and every undoTwitter engagement API
Follower graph6GET /twitter/user/followersFollowers, following, verified followers, mutuals, follow checksTwitter followers API
Post details4GET /twitter/tweet/detailSingle post, replies, reposters, full thread expansionTwitter analytics API
Search2GET /twitter/tweet/advanced_searchKeyword and operator search over posts, plus user searchTwitter search API
Trends, lists, DMs, account9GET /twitter/trendsTrending topics, list members, direct messages, billing readsTwitter list API

The surface splits into 37 reads and 14 writes. Reads need nothing but your Bearer token; writes additionally need a registered X session, which is a single free setup call.

Walking a paged result to the end

Anything that returns a list pages the same way. Omit cursor on the first call, then feed the returned next_cursor back while has_more stays true. Because no state is held server-side, a loop can be interrupted and resumed from a saved cursor on a different machine.

1import requests
2
3BASE = "https://api.twitterapis.com"
4HEAD = {"Authorization": "Bearer YOUR_API_KEY"}
5
6def page_all(path, params):
7 cursor, out = None, []
8 while True:
9 q = dict(params)
10 if cursor:
11 q["cursor"] = cursor
12 res = requests.get(f"{BASE}{path}", params=q, headers=HEAD)
13 if res.status_code == 402:
14 raise RuntimeError("balance empty, top up and resume from " + str(cursor))
15 res.raise_for_status()
16 body = res.json()
17 out.extend(body.get("tweets") or body.get("followers") or [])
18 if not body.get("has_more"):
19 return out
20 cursor = body["next_cursor"]
21
22rows = page_all("/twitter/user/tweets", {"userName": "nasa"})
23print(len(rows))

Note the explicit 402 branch. Because billing is per call rather than per plan, running out of balance mid-job is the one failure worth handling by name, and the saved cursor makes the resume exact rather than a restart.

Where to go from the overview

For how the key itself is issued and rotated, read the Twitter API key page. For what the official X API meters and what we do not, see Twitter API rate limits. To weigh this against other providers, the Twitter API alternatives comparison is the shortest route, and to expose the same surface to an AI agent rather than to your own code, connect the MCP server.

By the numbers

REST access, in numbers.

Sourced figures behind endpoint access and limits.

  • The official X API bills pay-per-use reads at $0.010 per resource and requires an approved developer app before the first call. (X Developer Platform, 2026)

  • Official X API endpoints meter requests in 15-minute windows that differ per endpoint and per access tier. (X API docs, 2026)

  • TwitterAPIs bills each standard REST call at $0.0008 with no monthly plan, no minimum, and no rate-limit window. (TwitterAPIs pricing, 2026)

  • The surface is 51 endpoints over HTTPS, 37 reads and 14 writes, all authenticated by one Authorization Bearer header. (TwitterAPIs docs, 2026)

  • A new account starts with $0.50 in free credit and no card on file, enough to work through the whole endpoint surface. (TwitterAPIs pricing, 2026)

REST API, common questions

A Twitter REST API is an HTTP interface where each piece of X data has its own URL, you fetch it with a normal GET, and you get JSON back. There is no SDK you must install and no socket to keep open. TwitterAPIs serves 51 endpoints from https://api.twitterapis.com, split into 37 reads and 14 writes, authenticated with a single Authorization: Bearer header. Anything that can make an HTTPS request can call it, which includes curl, a browser fetch, a Postman collection, or a shell script.

Three practical differences. Access: the official API requires a developer account, an approved app and an OAuth flow, while this one requires a Bearer token you receive at signup. Pricing: the official pay-per-use model bills reads at $0.010 per resource against a monthly cap, while this bills $0.0008 per call with no cap. Limits: the official API enforces 15-minute rate-limit windows per endpoint per tier, while we impose none. The data underneath is the same public X content in both cases.

Four cover almost everything. 200 is a normal success with a JSON body. 401 means the Bearer token is missing or wrong, which is a configuration bug rather than something to retry. 402 means your balance has run out, so top up and replay the request. 404 means the account or post genuinely does not exist, usually because it was deleted or the handle was renamed, and retrying will not help. Because every response is JSON including the failures, a client can read the reason off the body without special-casing content type.

Yes. It is plain HTTPS with a header and query parameters, so the HTTP client already in your standard library is enough. There is nothing language-specific to install. The examples on this page cover curl, Python with requests and JavaScript with fetch, and the same three lines translate directly to Go, Ruby, PHP, Java or C#. An OpenAPI description is published if you would rather generate a typed client than hand-write one.

One line of curl is a complete working call: curl -H "Authorization: Bearer YOUR_API_KEY" "https://api.twitterapis.com/twitter/user/info?userName=nasa". That returns the NASA profile record as JSON and costs $0.0008. Swap the path for /twitter/user/tweets to get their posts, or /twitter/tweet/advanced_search with a query parameter to search. Every endpoint follows the same header, the same query-string convention, and the same JSON response shape, so the first call you learn generalises to all 48.

Cursor-based, uniformly. Leave the cursor parameter off your first request to land on page one. Every paged response ships a next_cursor token and a has_more boolean. Pass next_cursor back as the cursor parameter on the following request, and keep looping while has_more stays true. Nothing is stored server-side between calls, so a paging loop can be paused, resumed on another machine, or restarted from a saved cursor without any coordination.

We do not impose any. The official X API meters reads in 15-minute windows that vary by access tier, which is what forces most integrations into a queue and a backoff schedule. Here your throughput is bounded by your own concurrency and your balance instead. That removes the scheduling layer from a bulk job entirely: you can run a backfill as fast as your workers allow rather than pacing to a window.

Make your first REST call in a minute

One Bearer header, 51 endpoints, JSON everywhere. $0.0008 a call and $0.50 in free credit, no developer account.