How to Get Tweet Data by ID With an API
To get tweet data by ID, call the X API's post lookup endpoint, GET /2/tweets/:id, or pass up to 100 IDs to GET /2/tweets?ids=, at $0.005 per post returned.

To get tweet data by ID, call the X API’s post lookup endpoint, GET /2/tweets/:id, or pass up to 100 IDs to GET /2/tweets?ids=, at $0.005 per post returned. For a handful of posts without an X developer account, apidojo’s Twitter Scraper Unlimited fetches single tweets from their URLs.
This guide covers both routes, the fields to request, and which is cheaper at each volume. Finding a tweet’s ID in the first place is covered in how to view a tweet by ID on X. The search endpoints themselves are compared in the Twitter search API guide.
How Do You Look Up a Tweet by ID With the X API?
You look up a tweet by ID with an authenticated GET request to https://api.x.com/2/tweets/ followed by the ID, adding the fields you want returned. By default the response holds only the ID and text; ask for more with tweet.fields and expansions.
curl "https://api.x.com/2/tweets/1728108619189874825?tweet.fields=created_at,public_metrics,lang&expansions=author_id&user.fields=username" \
-H "Authorization: Bearer $BEARER_TOKEN"
| Parameter | Adds |
|---|---|
tweet.fields=created_at |
Posting time |
tweet.fields=public_metrics |
Likes, reposts, replies, quotes |
tweet.fields=lang |
Detected language |
expansions=author_id with user.fields=username |
The author’s profile |
You need a developer account, an App and its bearer token (X API docs).
How Do You Look Up Many Tweets by ID?
To look up many tweets, send up to 100 comma-separated IDs in one request to GET /2/tweets?ids=. Billing is per post returned, not per request, so 100 posts cost $0.50 whether you fetch them in 1 request or 100 (X API pricing).
import os, requests
ids = ["1728108619189874825", "1140437409710116865"]
resp = requests.get(
"https://api.x.com/2/tweets",
headers={"Authorization": f"Bearer {os.environ['BEARER_TOKEN']}"},
params={"ids": ",".join(ids), "tweet.fields": "created_at,public_metrics"},
)
for post in resp.json().get("data", []):
print(post["id"], post["created_at"], post["public_metrics"]["like_count"])
Deleted or protected posts come back in an errors array instead of data. The same post requested again within one 24-hour UTC window is charged once (X API pricing).
How Do You Get Tweet Data by ID Without the X API?
Without an X developer account, put tweet URLs in the startUrls input of apidojo’s Twitter Scraper Unlimited on Apify. It returns each post with id, text, createdAt, engagement counts and an author object (Apify).
{
"startUrls": ["https://x.com/elonmusk/status/1728108619189874825"]
}
A single-tweet query costs $0.05 plus the per-item price. Tweet Scraper V2 doesn’t fetch single tweets, so this job belongs on Twitter Scraper Unlimited (Apify).
Which Is Cheaper for Tweet Lookups by ID?
The X API is cheaper for looking up tweets by ID: $0.005 per post, against $0.05 per single-tweet query on Twitter Scraper Unlimited. The scraper wins when you’d rather not run an X developer app for a few posts, or when you already collect data through Apify.
| Posts looked up | X API | Twitter Scraper Unlimited |
|---|---|---|
| 10 | $0.05 | $0.50 plus item price |
| 1,000 | $5 | $50 plus item price |
For posts you can reach with a search instead, such as an account’s recent posts or a thread, a search query is far cheaper than ID lookups; see how to scrape Twitter search results and how to scrape a Twitter thread and all its replies.
Can You Get a Tweet’s Date From Its ID Without Any API?
Yes, a tweet ID encodes its creation time: shift it right by 22 bits and add 1288834974657 to get milliseconds since 1970. This works for posts since June 2010 and needs no request at all (twitter-advanced-search reference). The code is in since: and until: explained.
Questions people ask
What does the X API return for a deleted tweet?
An error entry for that ID instead of post data.
Can you look up a protected tweet by ID?
Only with a user token for an account that follows the protected account; public lookups return an error.
Is there a free way to look up tweets by ID?
Opening x.com/i/status/ID in a browser is free for single posts; bulk lookups cost money on both routes.
Where do you compare the options?
In X API vs Twitter scraper API and the Twitter search API guide.