Hydrate Tweet IDs in 2026: 15-Line Python Script and Costs
A tested 15-line Python script to hydrate tweet IDs into JSONL, plus what X's terms allow, where Hydrator and twarc stand, and what 100,000 IDs cost.
Weir Team
Published · Updated · 7 min read
To hydrate tweet IDs, send them to a post-lookup API in batches of 100 and save the posts that come back.
This guide is for researchers and students with a dataset of X (Twitter) post IDs. You get X's sharing rules, where Hydrator and twarc stand, a tested script and the cost. We run Weir, the API used here.
Try it on three IDs, one of them deleted:
curl -s "https://api.weirapp.io/v1/x/posts?ids=2120974110335312297,2118449337814352016,1744829327294837236" \
-H "Authorization: Bearer $WEIR_API_KEY"
You need: a file of post IDs, Python 3 and a free Weir key.
- Clean the ID fileOne ID per line, kept as text.
- Run the script100 IDs per call, saved as JSONL.
- Read missing.txtDeleted and protected posts land here.
- Record the dateCounts drift, so note when you ran it.
Step 1: Get your Twitter dataset ready to hydrate
The script reads one ID per line and skips any other line, such as a header.
- Don't save the file from Excel. Excel keeps 15 digits, per Microsoft. A post ID has up to 19.
- Pull out the ID column first if your dataset is a CSV.
- Leave repeats in. The script drops them, so you never pay twice.
Step 2: Hydrate tweet IDs with this Python script
To rehydrate tweets in Python, this standard-library script sends 100 IDs per call to Weir's GET /v1/x/posts. It writes one post per line, a format called JSONL:
import json, os, sys, time, urllib.request
API = "https://api.weirapp.io/v1/x/posts?ids="
HEADERS = {"Authorization": "Bearer " + os.environ["WEIR_API_KEY"]}
ids = list(dict.fromkeys(line.strip() for line in open(sys.argv[1]) if line.strip().isdigit()))
with open(sys.argv[2], "a", encoding="utf-8") as out, open("missing.txt", "a") as missing:
for start in range(int(sys.argv[3]) if len(sys.argv) > 3 else 0, len(ids), 100):
batch = ids[start:start + 100]
with urllib.request.urlopen(urllib.request.Request(API + ",".join(batch), headers=HEADERS), timeout=60) as res:
page = json.load(res)
out.writelines(json.dumps(post, ensure_ascii=False) + "\n" for post in page["data"])
missing.writelines(post_id + "\n" for post_id in page["meta"]["notFound"])
print(f"ids {start + 1}-{start + len(batch)}: {len(page['data'])} found, "
f"{len(page['meta']['notFound'])} missing, {res.headers['x-credits-charged']} credits")
time.sleep(4) # each batch counts as 2 requests; the free tier allows 30 a minute
Set your key and run it:
export WEIR_API_KEY="weir_live_..."
python hydrate.py ids.txt posts.jsonl
In PowerShell, use $env:WEIR_API_KEY = "weir_live_..." instead.
- It appends posts to your JSONL file and misses to
missing.txt, so delete both before a fresh run. - It pauses 4 seconds after each batch. That keeps a free account under its limit; after any purchase, 1 second is enough.
We ran it on 17 November 2026 with 24 IDs: 21 @NASA posts, one @XDevelopers post, one deleted post and one ID that never existed.

Each line of posts.jsonl is one full post, with every field in our tweet JSON example.
At about 1.2 KB a post, 100,000 posts make a 116 MB file.
Step 3: Check what came back for deleted or protected posts
An ID that X no longer serves comes back in meta.notFound, costs nothing and lands in missing.txt.
The curl call at the top returned this on 17 November 2026, for 3 credits:
{
"data": [{ "id": "2120974110335312297" }, { "id": "2118449337814352016" }],
"meta": { "notFound": ["1744829327294837236"] }
}
That missing ID is the post the SEC's account published at 4:11 pm ET on 9 January 2024, after someone took control of it. The SEC says its staff deleted it that day.
- Weir can't say why a post is missing. Deleted, suspended, protected, withheld and never-existing posts all land in
notFound. X's ownGET /2/tweetslists misses in anerrorsarray with a type. - Old sets shrink. Only 62 of 100 random IDs from SemEval's 2013 file came back, as our sentiment datasets guide shows.
- Counts drift both ways. NASA's "Hello, Moon" post had 794,828 likes on 22 October 2026 and 792,527 in our run.
Keep missing.txt and your run date for your methods section. To check one post by hand, our deleted tweet finder asks X whether it can still be seen.
How much does it cost to hydrate 100,000 tweets?
On Weir, each call costs 1 credit, plus 1 per post found.
| Tweet IDs | Weir credits, at most | Weir cost | X API, posts only |
|---|---|---|---|
| 1,000 | 1,010 | $0.20 | $5 |
| 100,000 | 101,000 | $16.83 | $500 |
| 1,000,000 | 1,010,000 | $126.25 | $5,000 |
Weir's cost prices the credits used at the smallest pack that covers the job: $5, $20 or $200. X's pricing page lists $0.005 per post read, with a cap of 3 million post reads a month.
Misses are free on Weir. At SemEval's hit rate, 1,000 IDs would cost 630 credits.
What it costs: 1,000 IDs cost at most 1,010 credits; 5,000 credits a month are free; $5 buys 25,000.
Why Twitter datasets ship dehydrated, as IDs only
A dehydrated dataset holds post IDs and nothing else, because IDs are almost all X's developer terms let you pass on.
As of 17 November 2026, X's Developer Policy says you "may only distribute Post IDs, Direct Message IDs, and/or User IDs" when you share X content.
Three more rules shape every dataset:
- Research gets an exception. Academics may share IDs for non-commercial research that X approved in writing, or for peer review.
- IDs count as content. X's Developer Agreement, updated 27 April 2026, covers "the unique identification number generated for each Post."
- Deletions must follow X. You "must delete or modify any content you have if it is deleted or modified on X," protected posts included.
A fresh hydration handles the last rule, since deleted posts don't come back.
To find ID-only sets, see our guide to Twitter datasets. X's daily Community Notes files also list posts by ID alone. Twitter data for academic research adds an ethics checklist.
Hydrator, twarc and other tweet hydration tools in 2026
The classic tools were built for Twitter's old free access.

- Hydrator, DocNow's desktop app, lost its keys in 2023 and calls itself "no longer a useful application."
- twarc says it "is no longer actively supported," but
twarc2 hydratestill calls X's API with your own token. We didn't test it. - academictwitteR, the R package with
hydrate_tweets(), has been archived on GitHub since 2023.
If hydration fails
- Fewer IDs than expected: the script skips lines that aren't only digits, such as
2.12E+18from Excel. 401: checkWEIR_API_KEY.402: you're out of credits. Free credits return on the 1st (UTC). Don't retry.429or503: nothing is charged. Wait the seconds inRetry-After, then resume with the last number printed:python hydrate.py ids.txt posts.jsonl 51700.
When not to use Weir
- You need data licensed by X, or your ethics board wants the official API. Use
GET /2/tweets. - You hydrate millions of IDs a month. Sorsa lists 10,000 requests of 100 IDs for $49 a month.
- Price per post matters most. TwitterAPI.io lists $0.15 per 1,000 tweets, below our two smallest packs.
Weir reads public posts only and isn't licensed by X, so access can change. This isn't legal advice.
FAQ
What does it mean to hydrate tweets?
Hydrating, or rehydrating, tweets means turning a list of post IDs back into full posts by looking each one up again. You get the text, author, date and current counts. Deleted or protected posts don't come back, so old datasets shrink.
Does the Hydrator app still work?
No. Since April 2023, DocNow's README has said Twitter rescinded the app's keys and that it "is no longer a useful application." Its last release came out in August 2021. A short script does the same job.
Can twarc still hydrate tweets?
Its twarc2 hydrate command still calls X's post lookup, 100 IDs at a time, with your own bearer token. So you pay X's $0.005 per post, plus expansions from 22 November 2026. Its maintainers no longer actively support it.
How much does it cost to hydrate 1 million tweets?
On Weir, at most 1,010,000 credits, about $126 at the $200 pack's rate. On X's API, the posts alone cost $5,000, as of November 2026. Missing posts are free on Weir.
Sources
Checked 17 November 2026:
- X Developer Policy: https://docs.x.com/developer-terms/policy
- X Developer Agreement (updated 27 April 2026): https://docs.x.com/developer-terms/agreement
- X API pricing, post lookup: https://docs.x.com/x-api/getting-started/pricing and https://docs.x.com/x-api/posts/get-posts-by-ids
- X docs pull request #520 (opened 28 October 2026): https://github.com/xdevplatform/docs/pull/520
- Hydrator: https://github.com/DocNow/hydrator
- twarc: https://github.com/DocNow/twarc and https://pypi.org/project/twarc/
- academictwitteR: https://github.com/cjbarrie/academictwitteR
- TwitterAPI.io: https://twitterapi.io/pricing and https://docs.twitterapi.io/api-reference/endpoint/get_tweet_by_ids
- Sorsa API pricing: https://api.sorsa.io/pricing
- SEC, @SECGov statements (January 2024): https://www.sec.gov/secgov-x-account
- @SECGov post, Wayback copy (9 January 2024): https://web.archive.org/web/20240109212440/https://twitter.com/SECGov/status/1744829327294837236
- Microsoft, Excel limits: https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
- Weir post lookup and billing: https://docs.weirapp.io/reference/x/getXPosts and https://docs.weirapp.io/billing
- Our 3 Weir calls, 17 November 2026: 47 credits