# X Twitter Thread Scraper (`automation-lab/x-author-thread-tweets-from-known-posts`) Actor

Unroll X (Twitter) threads from post URLs or IDs. Exports only the author's own thread tweets in order, with text, media, links, timestamps and engagement. Start from any post in the thread. No login or cookies.

- **URL**: https://apify.com/automation-lab/x-author-thread-tweets-from-known-posts.md
- **Developed by:** [Automation Lab](https://apify.com/automation-lab) (community)
- **Categories:** Social media, AI
- **Features:** Limited permissions
- **Stats:** 3 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.08 / 1,000 thread tweet exporteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## X Twitter Thread Scraper

Unroll public X (Twitter) threads from post URLs or IDs and export **only the tweets the author wrote**, in reading order, with text, media, links, timestamps and engagement counts.

**X Twitter Thread Scraper** takes any post of a thread — the first post, one in the middle, or the last one — finds where the thread starts, follows the author's own replies to the end, and saves one clean row per thread tweet. Replies from other people are left out, so the dataset is the thread exactly as the author published it. No X account, login or cookies are needed.

### What does this X thread scraper do?

For each post URL or ID you supply, the Actor:

1. validates the URL or numeric ID (x.com, twitter.com and mobile links work);
2. loads X's public logged-out post page;
3. walks **up** the chain of the author's self-replies to the first post of the thread;
4. follows the author's self-replies **down** until X shows no further continuation;
5. drops every post written by other accounts;
6. numbers the thread tweets from 1 (oldest) to N and saves them to the dataset.

If two inputs belong to the same thread, the thread is exported once. A post that is not a thread is returned as a one-tweet thread.

### Who is it for?

- **Researchers and archivists** preserving long-form threads before they are edited or deleted.
- **Content teams and newsletter writers** turning creator threads into articles, summaries or quote collections.
- **Social media analysts** comparing how each part of a thread performs (likes, reposts, views per position).
- **AI and data engineers** feeding complete, ordered thread text into LLM summarization, RAG or training pipelines.
- **Brand and competitor monitors** saving announcement threads from companies and public figures.

Choose this Actor when you already know which posts you want. It does not search X by keyword and does not list a profile's posts.

### Why use this Actor?

- **Author-only output.** Other people's replies never appear as thread items, unlike generic "thread" tools that mix in the reply section.
- **Start anywhere.** A link to tweet 17 of 40 still returns tweets 1-40 in order.
- **Complete threads.** The Actor opens every thread tweet whose replies are not all visible yet, so long threads are not cut at the first page and later additions (such as an "Updated:" reply years later) are found.
- **Ready for reading order.** `threadPosition`, `threadLength`, `threadRootId` and `parentPostId` make it trivial to rebuild or join threads.
- **Clean text.** Leading reply handles are removed and t.co links are expanded to their real destination.
- **No login, no cookies, no browser.** Lightweight HTTP requests keep runs fast and inexpensive.
- **Clear failures.** Deleted, private or unavailable posts are reported in the log and status message instead of producing misleading empty success.

### What X thread data can I extract?

| Field | Meaning |
| --- | --- |
| `postId`, `postUrl` | ID and canonical URL of the thread tweet |
| `threadRootId`, `threadRootUrl` | First post of the thread |
| `threadPosition`, `threadLength` | Position (1 = first) and number of exported thread tweets |
| `isThreadRoot` | `true` for the first post |
| `sourceInput`, `sourcePostId` | The input value that led to this thread |
| `parentPostId`, `parentUsername` | The post this tweet replies to (the previous thread tweet, or the post the thread answers) |
| `text` | Visible text with t.co links expanded |
| `createdAt`, `language`, `isEdited` | Publication time, language code, edit status |
| `authorId`, `authorUsername`, `authorName` | Thread author |
| `authorProfileUrl`, `authorAvatarUrl` | Profile and 400x400 avatar URLs |
| `authorFollowers`, `authorFollowing` | Public follower and following counts |
| `authorVerified`, `authorVerifiedType` | Blue verification and organisation type (Business, Government) |
| `replyCount`, `repostCount`, `likeCount`, `quoteCount`, `bookmarkCount`, `viewCount` | Engagement counts per tweet |
| `media` | Photos, videos and GIFs: `type`, `url` (best MP4 for videos), `previewUrl`, `width`, `height`, `durationMs` |
| `links`, `hashtags`, `mentions` | Expanded links, hashtags and mentioned usernames |
| `quotedPostId`, `quotedPostUrl` | Quoted post, when the tweet quotes one |
| `scrapedAt` | When the row was produced |

Fields X does not show to logged-out visitors are `null` (for example `viewCount` on posts from before X counted views).

### How to get started

1. Open the Actor on Apify and click **Try for free**.
2. Paste one or more post URLs or IDs into **Post URLs or IDs**, for example `https://x.com/naval/status/1002103360646823936`.
3. Optionally lower **Maximum tweets per thread** to cap very long threads.
4. Click **Start** and wait a few seconds per thread.
5. Open the **Thread tweets** view in the Output tab, or export the dataset as JSON, CSV, Excel or HTML.

### Input parameters

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `postUrls` | array of strings | required | Post URLs (`https://x.com/<user>/status/<id>`, twitter.com, mobile links, `/photo/1` suffixes and query strings are fine) or numeric post IDs. Up to 500 per run. Any post of a thread works. |
| `maxTweetsPerThread` | integer | `100` | Maximum tweets exported per thread, counted from the first post. Range 1-1000. |
| `requestDelayMs` | integer | `300` | Pause before each X page request. Raise it for very large batches. |

Example input:

```json
{
    "postUrls": [
        "https://x.com/naval/status/1002103360646823936",
        "2087601629486813499"
    ],
    "maxTweetsPerThread": 100
}
```

Invalid URLs (not an X post link and not a numeric ID) and an empty list stop the run before anything is charged, with a clear message, so a misconfigured batch costs nothing. The start fee is charged once the input is valid, even if every post later turns out to be deleted or private.

### Output example

One row from a 10-tweet NASA thread, requested with an ID from the middle of the thread:

```json
{
    "postId": "2087592100812452254",
    "postUrl": "https://x.com/NASA/status/2087592100812452254",
    "threadRootId": "2087588849308344702",
    "threadRootUrl": "https://x.com/NASA/status/2087588849308344702",
    "threadPosition": 3,
    "threadLength": 10,
    "isThreadRoot": false,
    "sourceInput": "2087601629486813499",
    "sourcePostId": "2087601629486813499",
    "parentPostId": "2087591782922031307",
    "parentUsername": "NASA",
    "text": "Protect your eyes during the eclipse! Use eclipse glasses – not sunglasses – to look at the Sun. ... More tips: https://science.nasa.gov/eclipses/safety/",
    "createdAt": "2026-08-12T17:28:37.000Z",
    "language": "en",
    "isEdited": false,
    "authorId": "11348282",
    "authorUsername": "NASA",
    "authorName": "NASA",
    "authorProfileUrl": "https://x.com/NASA",
    "authorAvatarUrl": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",
    "authorFollowers": 92295970,
    "authorFollowing": 115,
    "authorVerified": true,
    "authorVerifiedType": "Government",
    "replyCount": 13,
    "repostCount": 48,
    "likeCount": 350,
    "quoteCount": 8,
    "bookmarkCount": 18,
    "viewCount": 115709,
    "media": [
        {
            "type": "video",
            "url": "https://video.twimg.com/amplify_video/2087591953508564992/vid/avc1/3840x2160/a_6DPFVboIYFb3ks.mp4?tag=29",
            "previewUrl": "https://pbs.twimg.com/amplify_video_thumb/2087591953508564992/img/z2iVU-FCCUse0YDW.jpg",
            "width": 3840,
            "height": 2160,
            "durationMs": 101205
        }
    ],
    "links": ["https://science.nasa.gov/eclipses/safety/"],
    "hashtags": [],
    "mentions": [],
    "quotedPostId": null,
    "quotedPostUrl": null,
    "scrapedAt": "2026-11-01T07:10:23.266Z"
}
```

### How much does it cost to scrape an X Twitter thread?

The Actor uses pay-per-event pricing: a small fee when a run starts plus a fee for each thread tweet saved to the dataset. You pay nothing per thread for inputs that fail to load.

| Event | FREE | BRONZE | SILVER | GOLD / PLATINUM / DIAMOND |
| --- | ---: | ---: | ---: | ---: |
| Run started (once per run) | $0.0005 | $0.0005 | $0.0005 | $0.0005 |
| Thread tweet exported | $0.0020654 | $0.001796 | $0.0014009 | $0.0010776 |

Example Actor charges at the BRONZE rate:

| What you export | Actor charge |
| --- | ---: |
| A single post (1 tweet) | about $0.0023 |
| A 10-tweet thread | about $0.018 |
| A 41-tweet thread such as naval's "How to Get Rich" | about $0.074 |
| 100 thread tweets in one run | about $0.18 |
| 1,000 thread tweets in one run | about $1.80 |

Apify shows the applicable price for your plan before every run, and you can set a maximum charge per run. The Actor never saves a tweet it could not charge for: when the maximum charge is reached it stops cleanly, keeps the tweets already saved (their thread length matches what was saved), and says so in the run's status message. If the maximum charge does not cover even one tweet after the start fee, no post is fetched. Use **Maximum tweets per thread** to cap spending on unexpectedly long threads.

### Thread rules: what counts as part of a thread?

A thread is the chain of posts in which an author replies to their own previous post.

- The **first post** is the earliest post in that chain. If the author started the thread as a reply to someone else, `parentPostId` and `parentUsername` on the first row point to that other post, but the other post is not exported.
- If the author replies to their own thread tweet more than once (a branch), every branch is included and rows are ordered by publication time. The Actor opens the page of every thread tweet whose reply count is higher than the replies already seen, including tweets that already have a known continuation, so a branch that X hides on the first page is still followed. Tweets with no replies need no extra page.
- Replies by other accounts, and the author's answers to those replies, are not part of the thread.
- Quoted posts are referenced through `quotedPostId` / `quotedPostUrl` and are not exported as separate rows.

### Integrations and workflow ideas

- **Thread-to-article pipeline:** run the Actor from Make, Zapier or n8n when a creator posts a thread, join `text` by `threadPosition`, and send it to an LLM for a blog draft.
- **Research archive:** schedule a daily run over a list of tracked thread URLs and store results in Google Sheets, Airtable or a database to keep a copy even if posts are deleted.
- **Engagement analysis:** load the dataset into a notebook and chart `likeCount` and `viewCount` by `threadPosition` to see where readers drop off.
- **Webhooks:** trigger your own endpoint when a run finishes and fetch the dataset items through the Apify API.
- **Pair with replies:** use [X Twitter Post Replies Scraper](https://apify.com/automation-lab/x-post-replies-conversation-threads) for what other people answered.

### API usage

Run the Actor and fetch results with cURL:

```bash
curl -X POST "https://api.apify.com/v2/acts/automation-lab~x-author-thread-tweets-from-known-posts/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"postUrls": ["https://x.com/naval/status/1002103360646823936"], "maxTweetsPerThread": 100}'
```

JavaScript (apify-client):

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('automation-lab/x-author-thread-tweets-from-known-posts').call({
    postUrls: ['https://x.com/naval/status/1002103360646823936'],
    maxTweetsPerThread: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
const thread = items.sort((a, b) => a.threadPosition - b.threadPosition).map((t) => t.text).join('\n\n');
console.log(thread);
```

Python (apify-client):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("automation-lab/x-author-thread-tweets-from-known-posts").call(run_input={
    "postUrls": ["https://x.com/naval/status/1002103360646823936"],
    "maxTweetsPerThread": 100,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["threadPosition"], item["text"])
```

### Use with Apify MCP

Connect AI assistants to this Actor through the Apify MCP server. For Claude Code:

```bash
claude mcp add --transport http apify \
  "https://mcp.apify.com?tools=automation-lab/x-author-thread-tweets-from-known-posts"
```

For Claude Desktop, Cursor or VS Code, add this to the MCP configuration:

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com?tools=automation-lab/x-author-thread-tweets-from-known-posts"
        }
    }
}
```

Selecting this Actor also adds the helper tools `get-actor-run`, `get-dataset-items`, `get-key-value-store-record` and `abort-actor-run`, so the assistant sees a small fixed set of tools rather than exactly one. Let the client list the tools (`tools/list`) to see their actual names and arguments. Listing tools is read-only and does not run or abort anything. A reliable assistant workflow:

1. **Start once and keep the run.** Call the Actor once and keep the returned run ID, status and dataset ID (`defaultDatasetId`). The call waits at most 45 seconds (30 by default), so a long batch may still be running when it returns. Set the client's request timeout longer than that wait.
2. **Follow the same run, never restart it.** If the run is not finished, check that same run with `get-actor-run` using short, growing waits (for example 2, 4, 8, then 10 seconds) up to a stated deadline such as 2 minutes. If the client itself times out, look up the known run instead of starting a new one. If the run ID is unknown, say so rather than blindly running again. At the deadline, report the run as pending with its ID. Report a failed run honestly: rows it saved are a partial result, not a complete thread.
3. **Read results in bounded pages.** Once the run has succeeded, call `get-dataset-items` with the dataset ID, an explicit `limit` and `offset`, and only the `fields` you need (for example `threadPosition,text,postUrl`). A sensible budget is pages of 20 rows from offset 0, at most 100 rows **and** at most 64 KiB of serialized result text in the conversation, whichever comes first. Count dataset offsets, not rows after any filtering. Check each page's size before it reaches the model: if a page or a single long tweet would exceed the byte budget, leave it out or summarize it and say so. If your client cannot inspect responses before the model sees them, treat the byte budget as a goal, not a guarantee, and keep pages small. When you stop before the end, report how many rows were read, the next `offset` to continue from, and that the result is partial.
4. **Keep full exports out of the chat.** For a complete archive, download the dataset (JSON, CSV or Excel) from Apify Console or the API, or process it in your own code. These limits are context budgets for the assistant only; they do not change what the Actor collects.

Token or cost savings from MCP depend on the client, model and caching setup, so no specific saving is promised here. The waits and budgets above are example choices, not Apify defaults.

Example prompts:

- "Unroll this X thread and summarize it in five bullet points: https://x.com/naval/status/1002103360646823936"
- "Export these three threads and tell me which tweet in each got the most likes."
- "Turn this thread into a blog post draft, keeping the author's order."

### Coverage and limitations

- Only public posts visible to logged-out visitors can be exported. Protected accounts, age-restricted, withheld or deleted posts are reported as failed inputs.
- Engagement counts are a snapshot at run time.
- If a tweet in the middle of a thread was deleted, the thread is exported up to the gap; X no longer links the remaining posts to it.
- Thread tweets that have replies are usually opened once each, up to 250 X page loads per thread. If that safety limit is reached, the run log says so.
- The Actor does not search X, list a profile's posts, or export the reply section; use our related Actors for those jobs.

### Troubleshooting

**The run failed with "No thread could be exported".** Every input failed to load. Open the post in a private browser window: if X asks you to log in, or shows "This post is unavailable", it cannot be exported anonymously.

**I got fewer tweets than the thread shows.** Check `maxTweetsPerThread`, and check whether the author deleted a tweet in the middle. Tweets that the author posted as replies to other people's comments are not part of the thread by design.

**A row says `null` for views.** X did not count views for older posts, or does not show them for that post.

**I see temporary X errors on big batches.** Raise `requestDelayMs` to 1000-2000 ms and split very large lists into several runs.

### Data handling and dependencies

The Actor requests public X post pages directly and does not use your X account. Failed operations send sanitized diagnostic input, exceptions, and Actor/build/run IDs to our private GlitchTip service for repair. Secret fields and URL queries are removed; reports are retained for 30 days.

### Responsible use and legality

This Actor collects data that X shows publicly to anyone without logging in. Public data can still include personal data, so make sure your use complies with the GDPR, CCPA and other laws that apply to you, and with X's terms. Use the data for legitimate purposes such as research, archiving and analysis, keep only what you need, and do not use it for spam, harassment or profiling of private individuals. If you are unsure, consult a lawyer. See also Apify's guide [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

### Related Automation Lab Actors

- [X Twitter Post Replies Scraper](https://apify.com/automation-lab/x-post-replies-conversation-threads) — replies and nested conversations under known posts.
- [Twitter/X Scraper](https://apify.com/automation-lab/twitter-scraper) — profiles, timelines, tweets by URL and search.
- [X Profile Scraper](https://apify.com/automation-lab/x-profile-scraper) — public profile details.

### FAQ

**Do I need an X account, API key or cookies?** No. The Actor reads the same public pages a logged-out visitor sees.

**Can I paste a link to a tweet in the middle of a thread?** Yes. The Actor walks up to the first post and returns the whole thread in order.

**Can I use numeric IDs instead of URLs?** Yes, for example `1002103360646823936`.

**Are other people's replies included?** No. Only the author's own thread tweets are exported. Use the related replies Actor for responses.

**What happens if I submit two links from the same thread?** The thread is exported and charged once.

**How fast is it?** About one page request per thread tweet that has replies. With the default `requestDelayMs` of 300, a 40-tweet thread takes about a minute.

# Changelog

This Actor's version history is a separate document: https://apify.com/automation-lab/x-author-thread-tweets-from-known-posts/changelog.md

# Actor input Schema

## `postUrls` (type: `array`):

Public x.com or twitter.com post URLs (for example https://x.com/naval/status/1002103360646823936) or numeric post IDs. Any post of a thread works: the first post, a post in the middle, or the last one. The Actor finds the thread start and exports the whole thread once, even if several inputs belong to the same thread.

## `maxTweetsPerThread` (type: `integer`):

Maximum number of thread tweets to export for each thread, counted from the first post of the thread. Longer threads are cut after this many tweets. Each exported tweet is one charged result.

## `requestDelayMs` (type: `integer`):

Pause before each public X page request. Most threads need 1-2 requests. Increase this if you process hundreds of threads and see temporary X rate limits.

## Actor input object example

```json
{
  "postUrls": [
    "https://x.com/naval/status/1002103360646823936"
  ],
  "maxTweetsPerThread": 20,
  "requestDelayMs": 300
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset view with every exported thread tweet: position, text, timestamps, engagement, media and URLs.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "postUrls": [
        "https://x.com/naval/status/1002103360646823936"
    ],
    "maxTweetsPerThread": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/x-author-thread-tweets-from-known-posts").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "postUrls": ["https://x.com/naval/status/1002103360646823936"],
    "maxTweetsPerThread": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/x-author-thread-tweets-from-known-posts").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "postUrls": [
    "https://x.com/naval/status/1002103360646823936"
  ],
  "maxTweetsPerThread": 20
}' |
apify call automation-lab/x-author-thread-tweets-from-known-posts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automation-lab/x-author-thread-tweets-from-known-posts"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/IceX7iYL6WRIfI3NJ/builds/gGd2d1T1FCX9FkWcT/openapi.json
