Twitter (X) Developer API — Getting Started in 2026

By Michael Park•6 min read

The Twitter (X) developer API is the single biggest data source for anyone building products around social conversation — sentiment analytics, cashtag trackers, brand monitoring, election research, competitor intel. In 2026 the landscape has consolidated to two practical entry points: X's own developer.x.com platform (post-2022 restructure) and third-party gateways that resell the same underlying data at per-call pricing.

This getting-started walks the current 2026 landscape end-to-end — what each path costs, what auth setup looks like, what endpoint families exist, and how to pick the right path for your workflow. Concrete code, real cost math.

01 — Section

The 2026 landscape — 2 practical paths

Path A — X official (developer.x.com): X's own API platform. Pay-per-usage, no subscriptions: $0.005 per post read, $0.010 per user read, $0.015 per post created ($0.200 with a URL). Pay-per-usage is capped at 3 million post reads per monthly billing cycle; above that, Enterprise via an interest form (no public price).

Path B — twitterapi.io (third-party gateway): pay-per-use gateway on top of X's public data. $0.00015 per returned tweet, $0.00018 per profile lookup per twitterapi.io/pricing. No tier gate; signup + API-key.

Why not others? Historical scraper-based paths (Apify, Bright Data, DIY Playwright) still exist but sit in a browser-automation gray zone with breakability + ToS ambiguity. For 90%+ of new-build workflows in 2026, Path A or Path B is the answer.

02 — Section

Path A — X official pay-per-use rates

Reads — $0.005 per post read; $0.010 per user read, per follower/following read and per DM event read. 100K posts read = $500; 1M = $5,000.

Writes — $0.015 per post created, $0.200 if the post contains a URL.

Cap — pay-per-usage stops at 3 million post reads per monthly billing cycle (3M × $0.005 = $15,000 of post reads).

Enterprise — above the cap, X routes you to Enterprise through an interest form; there is no public price. Credits — saving a first eligible card adds $20 in free credits, plus a match of the first auto-recharge up to $50.

All rates per docs.x.com/x-api/getting-started/pricing (verified 2026). Rate limits per docs.x.com/x-api/fundamentals/rate-limits.

The console itself, from sign-in to credits and the enrollment errors people hit, is walked through step by step on our X Developer Portal (Developer Console) guide.

03 — Section

Path B — twitterapi.io pay-per-use

Pay-per-tweet / per-profile pricing per twitterapi.io/pricing. No monthly minimum, no tier ceiling on volume. Historical archive (2006-present) available on standard endpoints at the same per-tweet price.

Practical use case: 10K tweets/day workload = ~$45/month on twitterapi.io vs ~$1,500/month on X official pay-per-use (300K post reads × $0.005). For any read-heavy workflow above small-scale, twitterapi.io economics dominate.

Write operations (post tweet, follow, etc.) are supported via session-cookie auth — good for automation workflows; less clean for native-X-app integrations where you want X-issued OAuth tokens.

04 — Section

First-call bootstrap comparison

X official first call (~30 min):

  1. developer.x.com → Sign up for a developer account + save a payment card
  2. Create a Project + App inside the Developer Portal
  3. Generate API Key + Secret + Bearer Token in the app settings
  4. (For write ops) Configure OAuth 2.0 callback + tweet.read / tweet.write scopes
  5. Install tweepy or use raw requests with Bearer header

The sign-up form's free-text question about your use case is covered clause by clause, with six sample answers and the policy lines that get applications rejected, in our guide to how will you use the Twitter API or Twitter data.

twitterapi.io first call (~5 min):

  1. twitterapi.io → Sign in with Google
  2. Copy API key from dashboard
  3. curl -H 'X-API-Key: ...' — done
python
# First call comparison — same intent (search recent tweets), 2 auth patterns
import os, requests

# ---- twitterapi.io ----
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
r = requests.get(
    "https://api.twitterapi.io/twitter/tweet/advanced_search",
    headers=HEADERS,
    params={"query": "openai lang:en min_faves:10"},
    timeout=15,
)
print(f"twitterapi.io returned {len(r.json().get('tweets', []))} tweets")

# ---- X official (via tweepy) ----
import tweepy
client = tweepy.Client(bearer_token=os.environ["X_BEARER_TOKEN"])
resp = client.search_recent_tweets(query="openai lang:en min_faves:10", max_results=100)
print(f"X official returned {len(resp.data or [])} tweets")

# Cost per call:
#   twitterapi.io: N × $0.00015 per twitterapi.io/pricing
#   X official pay-per-use: N × $0.005 per post read, per docs.x.com/x-api/getting-started/pricing
05 — Section

Endpoint families you'll actually use

Search (/twitter/tweet/advanced_search on twitterapi.io, /2/tweets/search/recent on X official) — the workhorse for most workflows. Full search-operator grammar. See /blog/twitter-search-operators-api-guide-2026 for operator reference.

User lookup (/twitter/user/info / /2/users/by/username) — resolve handle → profile + metrics. See /blog/twitter-username-lookup-api-reference.

Followers / following (/twitter/user/followers, /twitter/user/followings / /2/users/:id/followers) — social-graph enumeration. Cursor-paginated. See /blog/twitter-export-following-list-api-tutorial.

Timeline — recent tweets by a specific account. Handled via search with from:@handle.

Streaming (twitterapi.io + X official Enterprise) — real-time push of new tweets. See /blog/twitter-streaming-api-real-time-guide.

Write ops (create tweet, retweet, follow, etc.) — POST endpoints with user-context auth. See /blog/twitter-automation-2026 for patterns.

06 — Section

Cost math at 4 workload sizes

Per-tweet cost only. Ignore per-request overhead + per-window rate limits.

Workloadtwitterapi.ioX official pay-per-use ($0.005/post read)X Enterprise (no public price)
1K tweets/day (~30K/mo)~$4.50/mo$150/mooverkill
10K tweets/day (~300K/mo)~$45/mo$1,500/mooverkill
100K tweets/day (~3M/mo)~$450/mo$15,000/mo (at the 3M cap)custom, via interest form
1M tweets/day (~30M/mo)~$4.5K/moexceeds the 3M caprequired, no public price

Two takeaways: (a) twitterapi.io economics dominate for read-heavy at every workload size; (b) if your workflow is small (50K post reads/mo = $250 on X) AND you need X-native OAuth for write ops, X official pay-per-use is still viable — pick based on read-vs-write mix.

07 — Section

When to pick which path

Pick X official when: (a) native X OAuth token needed (in-app 'Sign in with X' flows, first-party integrations); (b) write operations are >30% of your workload; (c) Enterprise data compliance (regulated industries, election-integrity research); (d) already on Enterprise for other X-side workloads.

Pick twitterapi.io when: (a) read-heavy workload at any scale above hobby-tier; (b) bulk historical archive pulls at a per-tweet cost far below X's $0.005 per post read; (c) want session-cookie / API-key simplicity for automation; (d) cost-sensitive at production scale.

Hybrid works too: use twitterapi.io for read-heavy analytics + X official for the small write-op surface. Both API keys in your .env, route reads to one + writes to the other.

python
# Production-grade first workflow: sentiment analytics + cost tracking, both paths.
import os, requests, csv
from pathlib import Path
from datetime import date

HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
BASE = "https://api.twitterapi.io"

BRAND = "stripe"
COMPETITORS = ["paypal", "square"]
EXCLUDES = " ".join(f"-{c}" for c in COMPETITORS)

query = f"{BRAND} {EXCLUDES} lang:en min_faves:5 -filter:retweets"

tweets, cursor = [], None
for _ in range(10):
    params = {"query": query}
    if cursor: params["cursor"] = cursor
    r = requests.get(f"{BASE}/twitter/tweet/advanced_search", headers=HEADERS, params=params, timeout=15)
    r.raise_for_status()
    resp = r.json()
    tweets.extend(resp.get("tweets", []))
    cursor = resp.get("next_cursor")
    if not cursor: break

print(f"{BRAND} signal-only tweets: {len(tweets):,}")
print(f"Cost per twitterapi.io/pricing: {len(tweets)} × $0.00015 = ${len(tweets) * 0.00015:.4f}")

# Persist for downstream sentiment analysis
out = Path(f"{BRAND}_signal_{date.today()}.csv")
with open(out, "w") as f:
    w = csv.writer(f)
    w.writerow(["id", "author", "followers_count", "created_at", "favorite_count", "retweet_count", "text"])
    for t in tweets:
        a = t.get("author", {})
        w.writerow([
            t.get("id"), a.get("userName"), a.get("followers", 0),
            t.get("createdAt"), t.get("likeCount", 0), t.get("retweetCount", 0),
            (t.get("text") or "").replace("\n", " ")[:280],
        ])
print(f"saved {out}")

# Next steps: pipe text column through your sentiment classifier (LLM, VADER, transformers)
08 — Questions

Questions readers ask

Is there a free tier of X's API?

Not as a plan. X bills pay-per-usage with no subscriptions; new accounts get $20 in free credits after saving a first eligible card, plus a match of the first auto-recharge up to $50. At $0.005 per post read, $20 covers about 4,000 post reads. Production workloads pay per resource on X or use twitterapi.io pay-per-use.

Can I use OAuth with twitterapi.io for write ops?

twitterapi.io uses session-cookie auth for write operations (login flow → cookie → POST endpoints). Not X-issued OAuth. If you specifically need X-issued OAuth tokens (for in-app 'Sign in with X' flows), you need an X official developer app (pay-per-use).

How long is the historical archive on twitterapi.io?

Back to Twitter's launch (March 2006). Full archive. Query via since: and until: operators on /twitter/tweet/advanced_search. See /blog/twitter-historical-data-archive-api-guide.

Can I try before I buy on twitterapi.io?

Yes — new signups get free starter credits (up to $1 for new accounts that pass the automatic bot check, one per person and network, no card required, expiring after 31 days; see /pricing) to test the integration end-to-end before adding a payment method.

Does twitterapi.io throttle at the same rate as X's official rate-limits?

twitterapi.io limits requests per second, with no 15-minute windows: 0.2 requests/s (one every 5 seconds) before your first payment, 20 requests/s once you've topped up or bought a plan, 50 on Scale and 500 on Business (up to 1,000 on request). Exceeding it returns HTTP 429. There is no Retry-After header, so wait about a second and retry with backoff. That's separate from X's per-endpoint 15-minute limits on the official API.

What about X's old 'Elevated' access — is that still a thing?

No. Post-2022 X restructure removed the old Elevated tier gating, and X now bills pay-per-usage per resource instead of selling tiers. There is no per-endpoint elevation to apply for.

Any GDPR / data-sovereignty concern with third-party gateway?

For public tweet data, both twitterapi.io + X official process the same categories. For workflows involving private DMs or user-consented data, use X official OAuth 2.0 with proper scope declaration for GDPR/compliance clarity.

09 — Further reading

Continue

Sources & further reading
More from this series
Build it

Stop reading. Start building.

Starter credits cover real testing on real data. Google sign-in, no card, no application queue.

Get an API key

Already building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.