# 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.

[![apidojo](/blog/authors/apidojo.png)**Apidojo** *15+ years of experience in data retrieval.*](/blog/authors/apidojo/)

**7 October 2026** Published

**3 min** Read

![Cover card reading 'How to Get Tweet Data by ID With an API'](/blog/covers/tweet-by-id.png)

**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](/blog/x-guides/view-tweet-by-id/). The search endpoints themselves are compared in the [Twitter search API](/blog/twitter-api/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](https://docs.x.com/x-api/posts/search)).

## 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](https://docs.x.com/x-api/getting-started/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](https://apify.com/apidojo/twitter-scraper-lite) 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](https://apify.com/apidojo/tweet-scraper)).

## 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](/blog/twitter-scraping/scrape-search-results/) and [how to scrape a Twitter thread and all its replies](/blog/twitter-scraping/scrape-thread-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](https://github.com/igorbrigadir/twitter-advanced-search)). The code is in [since: and until: explained](/blog/twitter-search/since-until-operators/).

## The scrapers behind this

-   [Twitter Scraper Unlimited Single tweets, reply threads, X Articles and small queries; no minimum $0.016 / query + $0.40 / 1K](/scrapers/twitter-scraper-lite/)
-   [Tweet Scraper V2 Tweets from searches, profiles, Lists and URLs; 49–64 tweets/sec; minimum 50 per query $0.40 / 1K tweets](/scrapers/twitter-scraper/)

## 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](/blog/twitter-api/x-api-vs-scraper/) and the [Twitter search API guide](/blog/twitter-api/search-api/).

## More on the X API

-   [Twitter Search API: Endpoints, Pricing and Examples X API recent and full-archive search explained: limits, operators, $0.005 per post pricing, code, and a cheaper scraper API option.](/blog/twitter-api/search-api/)
-   [How to Get Historical Tweets With an API Get tweets back to 2006 with X's full-archive search or a scraper API: code, costs per 1,000 posts, and how to size a job first.](/blog/twitter-api/historical-tweets/)
-   [Twitter Recent Search API: The 7-Day Limit Why the X API's recent search returns only 7 days of posts, how to reach older tweets, and what each option costs.](/blog/twitter-api/recent-search-7-days/)
-   [X API vs Twitter Scraper API: Which to Use Compare the X API and a Twitter scraper API on price, history, limits, write access and terms, with a decision table for 7 jobs.](/blog/twitter-api/x-api-vs-scraper/)

![apidojo](/blog/authors/apidojo.png)

## [Apidojo](/blog/authors/apidojo/)

15+ years of experience in data retrieval.

API Dojo is always ready for you. With 15+ years of experience, data acquisition has never been that easy. Cheapest prices with high availability.

-   🏯 15+ years of experience in data retrieval.
-   💰 Cheapest prices, qualified data.
-   ⚙️ High availability, extreme maintenance.
-   🐉 Hyper communicative, excellent support.

-   [apify.com](https://apify.com/apidojo)
-   [x.com](https://x.com/apidojo_)
-   [github.com](https://github.com/apidojo-io)
