X's API is not free. It has no free plan today, apart from free access for Public Utility Apps. It bills per resource returned, $0.005 per post read and $0.010 per user or follower read, with no subscription. Our API reads the same public data from 1 credit a call.
What X charges to read
X bills each resource a read returns, in pay-per-use pricing.
| Read | Price per resource |
|---|---|
| Posts | $0.005 |
| User | $0.010 |
| Following and followers | $0.010 |
| Your own posts, followers or bookmarks | $0.001 |
Asking for the same resource again the same day is charged once. X lists no separate search price, so we count each search result as a post read. X's API is the better pick for posting, DMs, your own account's data, streaming and enterprise contracts, and it returns up to 100 posts or 1,000 followers per request.
Is there still a free tier?
No. X retired its fixed Free, Basic and Pro plans in stages and now bills pay-per-use. Apps X classifies as Public Utility Apps get free scaled access.
A new account can get up to $70 in one-time credits. X gives $20 when you save your first eligible credit or debit card, and matches your first auto-recharge up to $50, so that part needs you to pay in first. The credits expire 3 months after they are granted.
X's limits for search, posts and followers
The limits are rate limits plus your credit balance, and X keeps them separate.
- Recent search: posts from the last 7 days, 100 posts per request, 450 requests per 15 minutes per app.
- A user's posts: up to 100 per request.
- Followers: up to 1,000 per request, 300 requests per 15 minutes. We priced a full export in the Twitter API followers list.
Read X posts and followers with ToolzerHub
We make ToolzerHub. Our X API returns public posts, search results and follower lists as JSON with one API key and no X developer account. A call costs 1 credit for a profile, 5 for profile posts, 5 for a search and 3 for followers. A posts call returns 20 posts, a search 19 or 20, and a followers call 200 profiles, each with a cursor for the next page.
The script follows the cursor and writes posts to CSV. Give it handles, or search: plus a query.
import csv
import os
import sys
import time
import requests
BASE = "https://api.toolzerhub.com/v1/x"
HEADERS = {"x-api-key": os.environ["TOOLZERHUB_API_KEY"]}
FIELDS = ["source", "post_id", "handle", "posted", "likes", "replies", "reposts", "quotes",
"views", "bookmarks", "text", "url"]
calls = 0
def cell(value):
# Spreadsheets run text that starts with = + - or @ as a formula; an apostrophe keeps it text.
if isinstance(value, str) and value[:1] in ("=", "+", "-", "@", "\t", "\r"):
return "'" + value
return value
def get(path, params, tries=5):
# 429 and 503 are retryable; the error body may say how long to wait.
global calls
for attempt in range(tries):
r = requests.get(f"{BASE}/{path}", headers=HEADERS, params=params, timeout=90)
calls += 1
if r.status_code == 400: # malformed handle or query: skip it, keep the rest of the run
print("bad request:", r.json()["error"]["message"].splitlines()[0])
return None
if r.status_code not in (429, 503) or attempt == tries - 1:
r.raise_for_status()
return r.json().get("data") # None when the account does not exist
try:
wait = r.json()["error"]["details"]["retryAfter"]
except (ValueError, KeyError, TypeError):
wait = 5 * (attempt + 1)
time.sleep(min(wait, 60))
def posts(source, max_pages):
# source is a handle ("NASA") or a search ("search:artemis"); follow the cursor page by page.
if source.startswith("search:"):
path, params = "search", {"query": source[7:].strip(), "sort": "latest"}
else:
path, params = "profile/posts", {"handle": source.lstrip("@")}
for page in range(max_pages):
data = get(path, params)
if not data or not data["posts"]:
if page == 0:
print(f"skipped {source}: no record or no posts")
return
yield from data["posts"]
if not data["has_more"]:
return
params["cursor"] = data["cursor"]
def row(source, p):
return {
"source": source, "post_id": p["id"], "handle": p["author"]["handle"],
"posted": p["created_at"], "likes": p["like_count"], "replies": p["reply_count"],
"reposts": p["repost_count"], "quotes": p["quote_count"], "views": p["view_count"],
"bookmarks": p["bookmark_count"], "text": (p["text"] or "").replace("\n", " "),
"url": p["url"],
}
def main(sources, pages="3", out="x_posts.csv"):
seen = set()
with open(out, "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=FIELDS)
writer.writeheader()
for source in [s.strip() for s in sources.split(",") if s.strip()]:
for p in posts(source, int(pages)):
if p["id"] not in seen:
seen.add(p["id"])
writer.writerow({k: cell(v) for k, v in row(source, p).items()})
print(f"wrote {len(seen)} posts to {out} in {calls} calls")
if __name__ == "__main__":
main(*sys.argv[1:])
export TOOLZERHUB_API_KEY=your_key
python x_posts.py "NASA, github, search:artemis" 3 x_posts.csv
Three pages for each source gave 60 posts, 180 in all, with every post id unique:
| Source | Posts | Median likes | Median views |
|---|---|---|---|
| NASA | 60 | 2,513 | 974,391 |
| github | 60 | 242 | 69,200 |
| search:artemis | 60 | 0 | 1 |
The search sorts by latest, so it returns posts minutes old with no engagement yet. Use sort=top when you want engagement.
What it costs
1,000 posts are 50 calls at 5 credits, or 250 credits, and 1,000 followers are 15 credits.
| Job | X, pay-per-use | ToolzerHub |
|---|---|---|
| 1,000 posts | $5.00 | 250 credits |
| 1,000 followers | $10.00 | 15 credits |
| 1 profile | $0.010 | 1 credit |
You get 100 free credits a month; $19 buys 10,000 credits that never expire, and plans for higher volume cover more posts. Set your key and run the script on your first handle.
Trends are priced separately on X, at $0.010 a request; our Twitter trends API guide compares the two. Reddit and Meta also limit or charge for their APIs: see what Reddit's API costs and Threads keyword search limits. Google closed its Finance API altogether: see does Google Finance have an API.
We are not affiliated with X Corp.