WEIR

Twitter Thread API: Get Any Thread as Markdown (2026)

A Twitter thread API call returns the author's whole thread from any post in it. Save it to Obsidian, summarize it in Claude, and compare X's own price.


Published ยท Updated ยท 7 min read

Cover image: One post id, the whole thread

A Twitter thread API takes one post and returns the author's whole thread, in reading order, as data you can save or summarize.

This guide is for you if you want X (Twitter) threads in a script, a notes app or an AI chat. You get one call, a tested Obsidian script, and X's own route with its price. We run Weir, the API in the examples.

Paste this to print a thread as plain text:

import html, os, requests

post_id = "2092730109480325625"  # any post in the thread
r = requests.get(f"https://api.weirapp.io/v1/x/posts/{post_id}/thread",
                 headers={"Authorization": f"Bearer {os.environ['WEIR_API_KEY']}"},
                 timeout=60)
for post in r.json()["data"]:
    print(html.unescape(post["text"]), end="\n\n")

You need Python 3, a free Weir key and the link to any post in the thread:

  1. Get a keySign up with no card and set WEIR_API_KEY.
  2. Fetch the threadGET /v1/x/posts/{id}/thread with any post's id.
  3. Save it to ObsidianA tested script writes a Markdown note.
  4. Summarize itAsk Claude through Weir's MCP server.

Step 1: Call the Twitter thread API with any post id

Weir's thread endpoint, GET /v1/x/posts/{id}/thread, returns the author's thread around the post you pass. You get the earlier posts, the post itself, then the posts that continue it.

Sign up with no card, create a key, and set it as WEIR_API_KEY. Then run the snippet at the top of this page.

We made this call on 22 October 2026 for the second post of an @XDevelopers thread from 26 August. It returned both posts, first post first, for 3 credits. Trimmed:

[
  {
    "id": "2092730108041695449",
    "text": "Introducing ๐• Chat Agents powered by our new ๐• Chat API & Chat XDK. https://t.co/pNBXXnnsQX",
    "inReplyToId": null
  },
  {
    "id": "2092730109480325625",
    "text": "Official skeleton framework to go from 0 to Chat Agent: https://t.co/qtqUOy9uch ...",
    "inReplyToId": "2092730108041695449"
  }
]

Three things stand out:

  • We passed the second post and got the first. Any post in the thread works.
  • Other people's replies stayed out. The first post shows 86 replies, but only the author's two posts came back. Our guide to exporting tweet replies covers the rest.
  • You get text as X stores it, with & for "&" and t.co short links. Each post's full links sit in its entities.urls list.

Each call costs 1 credit plus 1 per post. A 10-post thread is 11 credits, and your first 5,000 credits each month are free.

Step 2: Save a Twitter thread to Obsidian as Markdown

Obsidian keeps notes as "Markdown-formatted plain text files" in a vault folder. Its help pages say properties sit "in YAML format at the top of the file," so the script writes those first.

This function builds the note. It swaps each t.co link for the real one and puts photos and videos under their post:

import html, os, re, sys, requests

def to_markdown(posts):
    first = posts[0]
    lines = ["---", f'author: "@{first["author"]["username"]}"', f"source: {first['url']}",
             f"posted: {first['createdAt'][:10]}", "tags:", "  - x-thread", "---", ""]
    for post in posts:
        links = iter(post["entities"]["urls"])  # expanded links, in the order they appear
        text = re.sub(r"https://t\.co/\w+", lambda m: next(links, ""), html.unescape(post["text"]))
        media = [f"![Image from the thread]({m['url']})" if m["type"] == "photo"
                 else f"[{m['type']}]({m['url']})" for m in post["media"] if m["url"]]
        lines += [text.strip(), *media, ""]
    return "\n".join(lines)

The rest fetches the thread and writes the file:

r = requests.get(f"https://api.weirapp.io/v1/x/posts/{sys.argv[1]}/thread", timeout=60,
                 headers={"Authorization": f"Bearer {os.environ['WEIR_API_KEY']}"})
r.raise_for_status()
posts = r.json()["data"]
path = f"{posts[0]['author']['username']}-{posts[0]['id']}.md"
with open(path, "w", encoding="utf-8") as file:
    file.write(to_markdown(posts))
print(f"saved {path}: {len(posts)} posts, {r.headers['x-credits-charged']} credits")

Save both parts as thread_md.py and run it inside your vault's folder:

python thread_md.py 2092730109480325625

On our thread it wrote XDevelopers-2092730108041695449.md:

---
author: "@XDevelopers"
source: https://x.com/XDevelopers/status/2092730108041695449
posted: 2026-08-26
tags:
  - x-thread
---

Introducing ๐• Chat Agents powered by our new ๐• Chat API & Chat XDK.
[video](https://video.twimg.com/amplify_video/2092727787438149632/vid/avc1/1920x1080/HkDoB79IcXBNDXrh.mp4?tag=29)

Official skeleton framework to go from 0 to Chat Agent: https://github.com/xdevplatform/xchat-agent-skeleton

More specific technical details: https://docs.x.com/xchat/bots

Obsidian shows the author, source and date as properties, and the x-thread tag groups every thread you save.

Step 3: Summarize a Twitter thread with Claude

Weir's MCP server gives Claude the same call as a tool named get_x_thread. Add Weir once as a custom connector; our Claude setup guide covers each plan.

Then ask in plain words:

Use get_x_thread on https://x.com/XDevelopers/status/2092730109480325625, then summarize the thread in three bullets and list its links.

Claude calls the tool with the post's id, reads the posts, and writes the summary in the chat. You pay for the call the same as a REST call.

The same tool works in Claude Code, Cursor and other MCP clients. Our X MCP server page lists what else the server can read.

What is a Twitter thread in data terms?

A thread is a run of posts where the author replies to their own last post.

X's docs say every reply in a conversation carries the first post's id as its conversation_id. The first post's conversation_id is its own id.

That id groups the whole discussion, other people included. To get the thread, you follow the author's chain inside it, one parent at a time:

2092730108041695449  @XDevelopers  first post: conversationId = its own id
โ”œโ”€โ”€ 2092730109480325625  @XDevelopers  reply to the first post: the thread
โ””โ”€โ”€ replies from other accounts: same conversationId, not the thread

Weir names the fields conversationId and inReplyToId. X's API uses conversation_id and referenced_tweets, and Weir's endpoint walks the chain for you.

Twitter API conversation ID: X's own route

On X's API, you get a thread through search. X's docs use the conversation_id: operator, and adding from: keeps the author's posts:

curl -G https://api.x.com/2/tweets/search/all \
  --data-urlencode "query=conversation_id:2092730108041695449 from:XDevelopers" \
  -d tweet.fields=created_at,referenced_tweets \
  -H "Authorization: Bearer $X_BEARER_TOKEN"

Three catches, all from X's docs:

  • Recent search covers 7 days. Our example is older, so it uses full-archive search, which X offers to pay-per-use and Enterprise customers.
  • You sort the results. X's own example sorts by created_at. Then follow referenced_tweets from the first post, because from: also matches the author's replies to other people.
  • It returns the replies. Fetch the first post by its id as well.

X bills $0.005 per post read as of October 2026, so you pay for 10 reads on a 10-post thread:

Reading one 10-post thread, October 2026
X API, 10 post reads$0.05
Weir, 11 credits on the $5 pack$0.0022

TwitterAPI.io lists $0.15 per 1,000 tweets, less per post than Weir's $5 pack. Our X API cost calculator prices bigger jobs.

Why does my thread come back short?

  • X folded it. Weir builds the thread from X's first page of the conversation, so a thread long enough for "Show more" ends at the fold. Our two-post test didn't reach it.
  • It started as a reply. When the author's first post answers someone else, the thread starts at the author's post.
  • The author branched. If the author replied twice to one post, the endpoint follows the earlier reply.
  • The post is gone. A missing post returns a 404, and failed calls cost nothing.

When not to use Weir

  • You just want to read one thread. Thread Reader App unrolls it when you reply "@threadreaderapp unroll" under any post in it.
  • Your threads run past X's fold. X's own search pages through every reply.
  • Price per post is all that matters. TwitterAPI.io charges less per tweet and has a paged thread-context endpoint.
  • You need to post threads. Weir is read-only. To draft one, our free Twitter character counter splits long text into numbered posts.
  • A contract with X is required, or first-party data for compliance.

X's Terms of Service, effective 9 October 2026, say you "cannot scrape the Services without X's express written permission." Check what applies to you. This isn't legal advice.

FAQ

How do I download a Twitter thread as text?

Run the snippet at the top of this page with the id of any post in the thread. It prints each post's text in order. For a file with full links, the Step 2 script saves a Markdown note.

Does a thread API return other people's replies?

Not Weir's: it returns only the author's own posts. X's conversation_id: search returns everyone's replies unless you add from:. For other people's replies on Weir, use the replies endpoint, which pages with a cursor.

Can I get a thread older than 7 days?

Yes. Our test thread was almost two months old when we fetched it through Weir. With X's API, recent search covers only the last 7 days, so older threads need full-archive search.

What does a Twitter thread API call cost?

On Weir, 1 credit per call plus 1 per post, with 5,000 free credits a month. X's API charges $0.005 per post read as of October 2026, so a 10-post thread costs $0.05.

Sources

All checked on 22 October 2026: