# X Twitter Profiles, Posts, Replies & Monitoring (`trakk/x-twitter-public-data-scraper`) Actor

Unofficial scraper for public X/Twitter profiles and recent posts with filters, engagement analytics, visible replies, and monitoring - no login required.

- **URL**: https://apify.com/trakk/x-twitter-public-data-scraper.md
- **Developed by:** [Kelopr](https://apify.com/trakk) (community)
- **Categories:** Social media, Lead generation, Automation
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.05 / 1,000 post or monitoring changes

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

> **Collect public X profiles, posts, replies, search results, engagement metrics, and monitoring deltas in structured datasets.**

All examples below use fictional `DEMO-*` identifiers, reserved `.test` domains, and masked contact details. They do not represent real people, listings, products, or companies.

### 🚀 What this Actor does

- **Flexible collection:** `PROFILES`, `USER_POSTS`, `PROFILE_SEARCH`, `POST_DETAILS`, `MONITOR`.
- **Structured output:** clean JSON records organized into `results`, `profiles`, `posts`, `replies`, `changes` views.
- **Production-ready:** concurrency, retries, proxy support, limits, and source-aware diagnostics are exposed through the Actor input.
- **Easy automation:** run from the Apify Console, API, schedules, webhooks, Make, Zapier, or any HTTP client.

### 🎛️ Modes and workflows

| Mode or workflow | What it does |
|---|---|
| `PROFILES` | Collect public profile identity and audience metrics. |
| `USER_POSTS` | Collect recent public posts from selected profiles. |
| `PROFILE_SEARCH` | Search public posts and profiles by query and filters. |
| `POST_DETAILS` | Resolve exact post URLs and optional public replies. |
| `MONITOR` | Track new posts and engagement deltas with a named monitor. |

### 💡 Common use cases

- Public profile and content research
- Topic and engagement monitoring
- Post, reply, and media datasets

### 📥 Input schema

Configure the Actor in the **Input** tab or send the same JSON through the API. Fields not needed for your workflow can be omitted.

| Field | Type | Description | Default |
|---|---|---|---|
| `scrapeType` **required** | `string` | Choose the public X data you want in the dataset. Allowed: `PROFILES`, `USER_POSTS`, `PROFILE_SEARCH`, `POST_DETAILS`, `MONITOR`. | `PROFILES` |
| `usernames` | `array<string>` | Used by Profiles, Recent posts, Search, and Monitor. Enter NASA, @NASA, or https://x.com/NASA. | — |
| `maxPostsPerProfile` | `integer` | Used by Recent posts, Search, and Monitor. Increase this to inspect a deeper part of each public timeline. | `20` |
| `includeReposts` | `boolean` | Keep reposts shown in profile timelines. Original posts are always included. | `false` |
| `postUrls` | `array<string>` | Used only by Posts by URL. Both x.com and twitter.com links are accepted. | — |
| `includeReplies` | `boolean` | Save replies that X exposes publicly for each requested post. | `true` |
| `maxReplies` | `integer` | Maximum public replies to save for one post. Availability depends on what X exposes publicly. | `20` |
| `queries` | `array<string>` | Used only by Search inside profiles. Supports phrases, excluded words, from:, lang:, min\_faves:, min\_retweets:, min\_replies:, and filter: operators. | — |
| `startDate` | `string` | Optional inclusive date in YYYY-MM-DD format, for example 2026-08-01. | ``|
| `endDate` | `string` | Optional inclusive date in YYYY-MM-DD format. |`` |
| `includeKeywords` | `array<string>` | Keep a post when its text contains at least one value. Matching is case-insensitive. | — |
| `excludeKeywords` | `array<string>` | Remove a post when its text contains any value. Matching is case-insensitive. | — |
| `language` | `string` | Optional 2–3 letter language code such as en, ru, es, de, or ja. | ``|
| `mediaFilter` | `string` | Keep every post or select a specific kind of media. Allowed: `ANY`, `WITH_MEDIA`, `IMAGES`, `VIDEOS`, `WITHOUT_MEDIA`. | `ANY` |
| `verifiedOnly` | `boolean` | Keep posts only when X marks the author as verified. | `false` |
| `minLikes` | `integer` | Keep posts with at least this many likes. | `0` |
| `minReposts` | `integer` | Keep posts with at least this many reposts. | `0` |
| `minReplies` | `integer` | Keep posts with at least this many replies. | `0` |
| `minViews` | `integer` | Keep posts with at least this many public views. | `0` |
| `monitorKey` | `string` | Optional stable name such as nasa-launch-watch. Reuse it on every scheduled run. |`` |
| `emitInitialPosts` | `boolean` | First run: save current posts as BASELINE. Later runs save only NEW or UPDATED posts. | `true` |
| `maxResults` | `integer` | Hard cap for dataset rows. Combine it with Apify's Maximum charge per run for strict cost control. | `100` |
| `maxConcurrency` | `integer` | Targets processed in parallel. The default is fast and stable for most runs. | `10` |
| `maxRetries` | `integer` | Attempts allowed after a temporary network or X response problem. | `3` |
| `timeoutSecs` | `integer` | Maximum time allowed for one public X request. | `20` |
| `proxyConfiguration` | `object` | Optional proxy configuration. Direct requests are used by default. | `{"useApifyProxy": false, "proxyUrls": []}` |

### ▶️ Example input

```json
{
  "scrapeType": "PROFILE_SEARCH",
  "queries": [
    "product launch"
  ],
  "language": "en",
  "mediaFilter": "WITH_MEDIA",
  "maxResults": 50
}
```

### 📦 Output schema

Each successful item is written to the default dataset. Select a dataset view in the Apify Console or export the full dataset as JSON, CSV, Excel, XML, or RSS.

#### `results` — All results

Unified primary results across the selected workflow.

**Fields:** `imageUrl`, `profileImageUrl`, `recordType`, `sourceUsername`, `searchQuery`, `username`, `displayName`, `changeType`, `text`, `followersCount`, `likeCount`, `repostCount`, `replyCount`, `viewCount`, `engagementRate`, `language`, `mediaType`, `publishedAt`, `url`, `scrapedAt`

#### `profiles` — Profiles

Profile-level identity and audience records.

**Fields:** `profileImageUrl`, `sourceUsername`, `username`, `displayName`, `bio`, `bioEmails`, `location`, `website`, `followersCount`, `followingCount`, `followerFollowingRatio`, `postsCount`, `postsPerDay`, `accountAgeDays`, `averagePostLikes`, `averagePostViews`, `isVerified`, `isBlueVerified`, `verifiedType`, `createdAt`, `url`, `scrapedAt`

#### `posts` — Posts

Post-level content and engagement records.

**Fields:** `imageUrl`, `sourceUsername`, `searchQuery`, `username`, `displayName`, `postType`, `isRepost`, `repostedByUsername`, `text`, `publishedAt`, `likeCount`, `repostCount`, `replyCount`, `quoteCount`, `bookmarkCount`, `viewCount`, `totalEngagement`, `engagementRate`, `language`, `mediaType`, `hashtags`, `mentions`, `links`, `mediaUrls`, `videoUrls`, `quotedUsername`, `quotedText`, `url`, `scrapedAt`

#### `replies` — Replies

Reply-level public conversation records.

**Fields:** `profileImageUrl`, `sourceUsername`, `username`, `displayName`, `text`, `publishedAt`, `likeCount`, `repostCount`, `replyCount`, `quoteCount`, `viewCount`, `totalEngagement`, `engagementRate`, `language`, `mediaType`, `conversationId`, `sourcePostId`, `url`, `scrapedAt`

#### `changes` — Monitoring changes

Monitoring events and field-level deltas.

**Fields:** `imageUrl`, `sourceUsername`, `username`, `changeType`, `changedFields`, `text`, `publishedAt`, `likeCount`, `likeDelta`, `repostCount`, `repostDelta`, `replyCount`, `replyDelta`, `viewCount`, `viewDelta`, `monitorKey`, `detectedAt`, `url`

### 📤 Example output

```json
{
  "sourceUsername": "demo_account",
  "searchQuery": "product launch",
  "username": "demo_account",
  "displayName": "Demo Account",
  "postType": "post",
  "text": "Example public post used only for documentation.",
  "publishedAt": "2026-08-15T12:00:00Z",
  "likeCount": 420,
  "repostCount": 38,
  "replyCount": 19,
  "viewCount": 18400,
  "language": "en",
  "mediaType": "image",
  "url": "https://x.com/demo_account/status/DEMO-POST-01"
}
```

Missing source values are returned as `null`, empty arrays, or documented availability/status fields; the Actor does not invent unavailable source data.

### 🔌 API example

Replace the placeholder with an Apify token and send the same input used in the Console:

```bash
curl -X POST "https://api.apify.com/v2/acts/trakk~x-twitter-public-data-scraper/runs?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"scrapeType": "PROFILE_SEARCH", "queries": ["product launch"], "language": "en", "mediaFilter": "WITH_MEDIA", "maxResults": 50}'
```

For synchronous integrations, use the `run-sync-get-dataset-items` API endpoint. For larger jobs, start an asynchronous run and consume its default dataset when the run succeeds.

### 🧩 Automation and exports

- Schedule recurring runs from the Apify Console.
- Trigger downstream systems with webhooks when a run succeeds or fails.
- Reuse named monitoring keys or stores where the selected workflow supports change tracking.
- Export dataset views to JSON, CSV, Excel, XML, or RSS, or access items through the Apify API.

### ❓ FAQ

#### Do I need a login or browser session?

Use only the inputs shown in the Actor schema. If authentication or cookies are supported, the relevant encrypted field is explicitly available in the Input tab; otherwise no account is required.

#### Why can some fields be empty?

Source pages vary by region, content type, privacy settings, and availability. Optional enrichment also depends on the selected mode. Empty values are preserved honestly instead of being guessed.

#### How should I run this at scale?

Start with a small representative input, inspect the dataset and cost, then raise item limits and concurrency gradually. Use Apify Proxy when the schema exposes it, and use schedules plus monitoring keys for recurring collection.

#### Is the example data real?

No. Every example in this README is intentionally fictional and uses demo identifiers, reserved domains, or masked contact values.

# Actor input Schema

## `scrapeType` (type: `string`):

Choose the public X data you want in the dataset.

## `usernames` (type: `array`):

Used by Profiles, Recent posts, Search, and Monitor. Enter NASA, @NASA, or https://x.com/NASA.

## `maxPostsPerProfile` (type: `integer`):

Used by Recent posts, Search, and Monitor. Increase this to inspect a deeper part of each public timeline.

## `includeReposts` (type: `boolean`):

Keep reposts shown in profile timelines. Original posts are always included.

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

Used only by Posts by URL. Both x.com and twitter.com links are accepted.

## `includeReplies` (type: `boolean`):

Save replies that X exposes publicly for each requested post.

## `maxReplies` (type: `integer`):

Maximum public replies to save for one post. Availability depends on what X exposes publicly.

## `queries` (type: `array`):

Used only by Search inside profiles. Supports phrases, excluded words, from:, lang:, min\_faves:, min\_retweets:, min\_replies:, and filter: operators.

## `startDate` (type: `string`):

Optional inclusive date in YYYY-MM-DD format, for example 2026-08-01.

## `endDate` (type: `string`):

Optional inclusive date in YYYY-MM-DD format.

## `includeKeywords` (type: `array`):

Keep a post when its text contains at least one value. Matching is case-insensitive.

## `excludeKeywords` (type: `array`):

Remove a post when its text contains any value. Matching is case-insensitive.

## `language` (type: `string`):

Optional 2–3 letter language code such as en, ru, es, de, or ja.

## `mediaFilter` (type: `string`):

Keep every post or select a specific kind of media.

## `verifiedOnly` (type: `boolean`):

Keep posts only when X marks the author as verified.

## `minLikes` (type: `integer`):

Keep posts with at least this many likes.

## `minReposts` (type: `integer`):

Keep posts with at least this many reposts.

## `minReplies` (type: `integer`):

Keep posts with at least this many replies.

## `minViews` (type: `integer`):

Keep posts with at least this many public views.

## `monitorKey` (type: `string`):

Optional stable name such as nasa-launch-watch. Reuse it on every scheduled run.

## `emitInitialPosts` (type: `boolean`):

First run: save current posts as BASELINE. Later runs save only NEW or UPDATED posts.

## `maxResults` (type: `integer`):

Hard cap for dataset rows. Combine it with Apify's Maximum charge per run for strict cost control.

## `maxConcurrency` (type: `integer`):

Targets processed in parallel. The default is fast and stable for most runs.

## `maxRetries` (type: `integer`):

Attempts allowed after a temporary network or X response problem.

## `timeoutSecs` (type: `integer`):

Maximum time allowed for one public X request.

## `proxyConfiguration` (type: `object`):

Optional proxy configuration. Direct requests are used by default.

## Actor input object example

```json
{
  "scrapeType": "PROFILES",
  "usernames": [
    "NASA",
    "OpenAI"
  ],
  "maxPostsPerProfile": 20,
  "includeReposts": false,
  "postUrls": [
    "https://x.com/NASA/status/2086853708533440600"
  ],
  "includeReplies": true,
  "maxReplies": 20,
  "queries": [
    "space lang:en min_faves:100 filter:images",
    "AI -crypto lang:en"
  ],
  "startDate": "2026-08-01",
  "endDate": "2026-08-11",
  "language": "en",
  "mediaFilter": "ANY",
  "verifiedOnly": false,
  "minLikes": 0,
  "minReposts": 0,
  "minReplies": 0,
  "minViews": 0,
  "monitorKey": "nasa-launch-watch",
  "emitInitialPosts": true,
  "maxResults": 10,
  "maxConcurrency": 10,
  "maxRetries": 3,
  "timeoutSecs": 20,
  "proxyConfiguration": {
    "useApifyProxy": false,
    "proxyUrls": []
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `profiles` (type: `string`):

No description

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

No description

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

No description

## `changes` (type: `string`):

No description

# 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 = {
    "scrapeType": "PROFILES",
    "usernames": [
        "NASA",
        "OpenAI"
    ],
    "postUrls": [
        "https://x.com/NASA/status/2086853708533440600"
    ],
    "queries": [
        "space lang:en min_faves:100 filter:images",
        "AI -crypto lang:en"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("trakk/x-twitter-public-data-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 = {
    "scrapeType": "PROFILES",
    "usernames": [
        "NASA",
        "OpenAI",
    ],
    "postUrls": ["https://x.com/NASA/status/2086853708533440600"],
    "queries": [
        "space lang:en min_faves:100 filter:images",
        "AI -crypto lang:en",
    ],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("trakk/x-twitter-public-data-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 '{
  "scrapeType": "PROFILES",
  "usernames": [
    "NASA",
    "OpenAI"
  ],
  "postUrls": [
    "https://x.com/NASA/status/2086853708533440600"
  ],
  "queries": [
    "space lang:en min_faves:100 filter:images",
    "AI -crypto lang:en"
  ],
  "maxResults": 10
}' |
apify call trakk/x-twitter-public-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,trakk/x-twitter-public-data-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/NmyLoyRK1EdNPahV6/builds/0eNbEKAItzYJG6fex/openapi.json
