# X Replies Scraper (`mendi_ai_reply_pilot/x-replies-scraper`) Actor

Every reply on an X (Twitter) post, most visible first, with its author, likes, views and place in the reply tree, plus the post and its stats. No login or cookies. $0.05 per 1,000 replies on every plan; pay only for replies delivered. Also an MCP server for AI agents.

- **URL**: https://apify.com/mendi_ai_reply_pilot/x-replies-scraper.md
- **Developed by:** [Comment Verdict](https://apify.com/mendi_ai_reply_pilot) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.05 / 1,000 reply delivereds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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) Tweet Replies & Posts Scraper

Every reply on an X (Twitter) post, most visible first, with its author, likes,
views and place in the reply tree, plus the post itself and its stats. **No
login or cookies needed. $0.05 per 1,000 replies**, the same on every Apify
plan, and you pay only for the replies delivered.

### What you get

- **The replies, in order of visibility.** The thread is read page by page in
  X's own ranking, so if you cap a run you get the most-seen replies first, not
  one deep reply chain.
- **No account needed.** You give post URLs; no X login, cookies or API key.
- **Clean data by default.** Deleted and unavailable replies, emoji-only and
  link-only replies, and accounts named as bots are dropped, and you are not
  charged for them. Turn **Clean replies** off for the raw thread.
- **No silent truncation.** Each post has a row saying how many replies it has,
  how many you got, and why any are missing.
- **Continue where you stopped.** A post with more replies than your cap gets a
  `nextCursor`. Pass it back and you get the next batch only, never paying for
  the first one twice.

### Examples

Ready-to-run examples, each with its input already filled in. Open one and
press **Try for free**, then swap in your own post:

- [Scrape all replies to a tweet (X post)](https://apify.com/mendi_ai_reply_pilot/x-replies-scraper/examples/scrape-tweet-replies)
- [Get a tweet's details and stats without its replies](https://apify.com/mendi_ai_reply_pilot/x-replies-scraper/examples/get-tweet-details)
- [Tweet replies for AI and sentiment analysis](https://apify.com/mendi_ai_reply_pilot/x-replies-scraper/examples/tweet-replies-for-ai-sentiment-analysis)
- [Export a raw reply thread, bots and emoji replies included](https://apify.com/mendi_ai_reply_pilot/x-replies-scraper/examples/export-raw-tweet-reply-thread)

### Input

| Field | What it does |
|---|---|
| **X posts** | Post URLs (`https://x.com/<user>/status/<id>`), `twitter.com` links or numeric post IDs. Up to 200 per run. |
| **Max replies per post** | Default 100, up to 10,000. A ceiling, not a minimum charge. **0 = the post only**, with a cursor to fetch its replies later. |
| **Reply order** | Best (relevance), Top (most liked) or New (most recent). |
| **Clean replies** | On by default (see above). |
| **Only replies newer than** | Optional. Re-run a post and get only what is new. |
| **Continue from an earlier run** | Paste the `NEXT_CURSORS` record from an earlier run. Cursors last 7 days. |

Example input: the 100 most relevant replies of one post, cleaned.

```json
{
  "posts": ["https://x.com/InternetH0F/status/2112758565593129390"],
  "maxComments": 100,
  "sort": "best",
  "cleanComments": true
}
```

### Output

Each run has two tables, linked from the run's **Output** tab:

- **Replies** (the run's main dataset, and what **Export** downloads): one row
  per reply.
- **Posts**: one row per post, with the post itself (author, text, stats,
  link) and how its delivery went.

Every row has `type` and `schemaVersion`.

**Reply**

```json
{
  "type": "comment",
  "schemaVersion": 1,
  "id": "2112759000000000000",
  "postId": "2112758565593129390",
  "parentId": "2112758565593129390",
  "depth": 0,
  "author": "example_user",
  "body": "The reply text.",
  "likeCount": 42,
  "replyCount": 3,
  "retweetCount": 1,
  "quoteCount": 0,
  "views": 10400,
  "lang": "en",
  "createdUtc": 1792555973,
  "permalink": "https://x.com/i/status/2112759000000000000"
}
```

Replies keep the service's comment shape — `body`, `parentId`, `depth` — so the
same downstream tools read Reddit comments and X replies the same way.

**Post**

```json
{
  "type": "post",
  "schemaVersion": 1,
  "id": "2112758565593129390",
  "author": "InternetH0F",
  "text": "The post text.",
  "createdUtc": 1792555869,
  "commentCount": 820,
  "likeCount": 54000,
  "retweetCount": 6100,
  "quoteCount": 240,
  "bookmarkCount": 1800,
  "views": 4100000,
  "lang": "en",
  "permalink": "https://x.com/i/status/2112758565593129390",
  "status": "ok",
  "errorCode": null,
  "commentsAvailable": 820,
  "commentsReturned": 100,
  "commentsDropped": 7,
  "commentsNotShown": null,
  "hasMore": true,
  "nextCursor": "…"
}
```

`status` is `ok` (the thread was read to your cap or its end), `partial` (it
stopped at the cap, the run budget or a read limit — `nextCursor` continues it),
`failed`, `not_found` or `cancelled`. `errorCode` names why a post is not `ok`
(for example `READ_BUDGET`, `QUOTA_EXCEEDED`, `CANCELLED`).

### Use it from AI agents (MCP)

This Actor is also an [MCP](https://modelcontextprotocol.io) server, so
Claude, Cursor, VS Code, ChatGPT or any other MCP client can call it
directly. Add it to your client with your
[Apify API token](https://console.apify.com/account/integrations):

```json
{
  "mcpServers": {
    "x": {
      "url": "https://mendi-ai-reply-pilot--x-replies-scraper.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_APIFY_API_TOKEN>"
      }
    }
  }
}
```

The transport is Streamable HTTP. There is nothing to install and nothing to
start: the server wakes up on the first call.

| Tool | What it returns | Usual time |
|---|---|---|
| `get_x_post` | One post: text, author, time, language, reply, like, repost, quote and bookmark counts, views, link. | about 10 s |
| `get_x_replies` | The post and a batch of its replies, most visible first. | 10 to 40 s |

`get_x_replies` takes:

| Argument | What it does |
|---|---|
| `post` | The post's URL (`x.com` or `twitter.com`), or the numeric post ID. |
| `max_comments` | Replies to return in this call: default 25, up to 100. |
| `sort` | `best` (default), `top` or `new`. |
| `clean` | On by default, as in a run: cleaned-out replies are not charged. |
| `since` | Only replies newer than this: a date, an ISO time, Unix seconds, or a relative time such as `2 days`. |
| `cursor` | The `nextCursor` of an earlier call, to get the next batch. |

```json
{
  "post": "https://x.com/InternetH0F/status/2112758565593129390",
  "max_comments": 25
}
```

The answer holds `post`, `comments` (the same rows as the tables above,
without `type` and `schemaVersion`), `commentsReturned`, `hasMore` and
`nextCursor`.

**Reading a long thread.** A call returns up to `max_comments`, or fewer when
reading takes longer than about 40 seconds, so an agent is never left waiting.
When `hasMore` is true, call again with the same `post` and the `nextCursor`:
you get the next batch only, and nothing is returned or charged twice.

**Same prices as a run.** A call is charged one post event plus one event per
reply returned; a call that fails is free. For whole threads of thousands
of replies, or many posts at once, start a run instead: your agent can do
that through Apify's own MCP server,
`https://mcp.apify.com?tools=mendi_ai_reply_pilot/x-replies-scraper`.

### Pricing

Pay per event, only for what is delivered. The prices are the same on every
Apify plan, the free plan included:

| Event | Price | Charged when |
|---|---|---|
| Reply | $0.00005 ($0.05 per 1,000) | a reply is delivered. Cleaned-out, too-old and unavailable replies are free. |
| Post | $0.00004 | a post is read for you (once per post per run, or per MCP tool call). A post that fails or no longer exists is free. |

A post with 500 replies costs 500 × $0.00005 + $0.00004 = $0.02504. Set a
**maximum cost per run** in the run options: the run stops cleanly when it is
reached, and you keep everything delivered so far.

### How it works

The Actor submits one job to our scraping service, pages the results into the
run's dataset, and charges per delivered item. Threads are read at a steady,
human pace, so a run is reliable rather than fast, and very long threads take
a while. A run waits out a short service restart (about two minutes of
retries) instead of failing.

# Changelog

This Actor's version history is a separate document: https://apify.com/mendi_ai_reply_pilot/x-replies-scraper/changelog.md

# Actor input Schema

## `posts` (type: `array`):

Post URLs (https://x.com/<user>/status/<id>), twitter.com links, or numeric post IDs. Up to 200 per run.

## `maxComments` (type: `integer`):

Stop each post after this many replies (after cleaning); most visible first. Set 0 for the post only and a cursor to fetch its replies later. You pay only for replies delivered. Up to 10,000. The form starts at 20 so a first run finishes quickly; raise it for whole threads (the API default is 100).

## `sort` (type: `string`):

X's ranking for the reply thread: Best (relevance), Top (most liked) or New (most recent).

## `cleanComments` (type: `boolean`):

Drop deleted and unavailable replies, known bots, and emoji-only or link-only replies. Dropped replies are not charged. Turn off to get the raw thread.

## `sinceUtc` (type: `string`):

Optional. A date (UTC), an ISO time, Unix seconds, or a relative time such as 7 days. Use it to re-run a post and get only what is new.

## `cursors` (type: `array`):

Paste the NEXT_CURSORS record from an earlier run (or post rows' postId and nextCursor) to get the next batch of replies without paying for the first ones again. Cursors last 7 days.

## Actor input object example

```json
{
  "posts": [
    "https://x.com/InternetH0F/status/2112758565593129390"
  ],
  "maxComments": 20,
  "sort": "best",
  "cleanComments": true,
  "cursors": []
}
```

# Actor output Schema

## `replies` (type: `string`):

Every delivered reply.

## `posts` (type: `string`):

Each post's text, author and stats, with delivery status and the cursor to continue.

## `nextCursors` (type: `string`):

Posts with more replies. Paste this record into the next run's "Continue from an earlier run" input.

# 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 = {
    "posts": [
        "https://x.com/InternetH0F/status/2112758565593129390"
    ],
    "maxComments": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("mendi_ai_reply_pilot/x-replies-scraper").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 = {
    "posts": ["https://x.com/InternetH0F/status/2112758565593129390"],
    "maxComments": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("mendi_ai_reply_pilot/x-replies-scraper").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 '{
  "posts": [
    "https://x.com/InternetH0F/status/2112758565593129390"
  ],
  "maxComments": 20
}' |
apify call mendi_ai_reply_pilot/x-replies-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mendi_ai_reply_pilot/x-replies-scraper"
        }
    }
}
```

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/IsIpNmc7NzaUhQXkC/builds/yb3kVlFTJg0bREpVf/openapi.json
