# X (Twitter) Scraper – Tweets, Profiles, Followers & Search API (`b2b_leads/x-real-time-data`) Actor

Scrape X (Twitter) in real time — search tweets, profiles, timelines, followers, retweeters, quotes, lists, communities & Spaces. No API keys or login needed. Clean, LLM/MCP-ready JSON. Export to CSV, Excel, JSON or API. 15 tools in one Actor, pay only for what you use.

- **URL**: https://apify.com/b2b\_leads/x-real-time-data.md
- **Developed by:** [Chidubem Aneke](https://apify.com/b2b_leads) (community)
- **Categories:** Social media, Lead generation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## X (Twitter) Real-Time Data Scraper — Tweets, Profiles, Followers, Engagement & More

**Turn X (Twitter) into a clean, structured data feed.** Search tweets, pull profiles and timelines, map followers, find who retweeted or quoted a post, export lists, communities, and Spaces — and optionally your own notifications, analytics, and DMs. One Actor, 15 data sources, one predictable JSON schema.

No X API keys. No developer account. No browser automation to babysit. Just check the boxes for the data you want and press **Start**.

> ⚡ **Real-time** results • 🧩 **15 features** in one Actor • 🤖 **LLM & MCP-ready** JSON • 💸 Pay only for what you enable

---

### Why this Actor

- **Skip the official X API.** No $100–$5,000/mo API tiers, no OAuth apps, no rate-limit math. Enable a feature and get data.
- **15 data sources, one schema.** Every row carries a `featureType` tag and flat `camelCase` fields — so search results, profiles, and followers all slot into the same table, spreadsheet, or database.
- **Built for scale.** Streams results straight to the dataset as they arrive. Runs comfortably on **256 MB** and scrapes up to **100,000 items** per run out of the box (raise it if you need more).
- **Never loses a run to one bad input.** A private account or deleted tweet becomes a tidy `unavailable` row — the rest of your run keeps going.
- **Automation-native.** Pipe results to Google Sheets, Airtable, a webhook, your database, or an AI agent via the Apify API and MCP.

---

### What you can collect

| # | Feature | Turn on with | You get |
|---|---------|--------------|---------|
| 1 | **Keyword & advanced search** *(on by default)* | `enableSearch` | Tweets or people matching keywords, hashtags, cashtags, or full X operators |
| 2 | **User profiles** | `enableUserProfiles` | Follower/following counts, bio, verification, location, join date |
| 3 | **User tweets / timelines** | `enableUserTweets` | Everything an account posts (with or without replies) |
| 4 | **Tweet details + replies** | `enableTweetDetails` | Full metrics for one or many tweets, plus entire reply threads |
| 5 | **Engagers** | `enableEngagers` | Who **retweeted** and who **quoted** a tweet |
| 6 | **Followers & following** | `enableNetwork` | Followers, following, verified followers, subscriptions |
| 7 | **Friendship check** | `enableFriendship` | Does user A follow user B? Mutual? |
| 8 | **Lists** | `enableLists` | List metadata, tweets, members, followers |
| 9 | **Communities** | `enableCommunities` | Community details, tweets, members, and discovery search |
| 10 | **Spaces** | `enableSpaces` | Space metadata, host, speakers, and optional audio stream URL |
| 11 | **Translation** | `enableTranslate` | Any tweet translated into your target language |
| 12 | **Scrape by URL** | `enableScrapeByUrl` | Paste any X link — auto-detects tweet, profile, list, community, Space, or search |
| 13 | **Your notifications** 🔐 | `enableNotifications` | Your account's notification timeline |
| 14 | **Your analytics** 🔐 | `enableAnalytics` | Impressions, engagements, follower growth over time |
| 15 | **Your DM inbox** 🔐 | `enableDmInbox` | Your conversations and messages |

🔐 = uses **your own** X session — see [Account data](#account-data-your-own-session).

---

### Use cases & outcomes

**📈 Social listening & brand monitoring**
Track every mention of your brand, product, or campaign in real time. Search by keyword + language, filter by minimum likes, exclude retweets, and route hits to Slack or a dashboard.

**🔍 Competitor & market intelligence**
Pull competitors' full timelines, watch their follower growth, and see who's amplifying them via retweets and quotes.

**🎯 Lead generation & audience building**
Export the followers of an account (or a curated list), enrich each profile with follower counts and bios, and filter for accounts above a follower threshold — a ready-made prospect list.

**🧠 Influencer & creator discovery**
Find people (not tweets) with People search, rank by followers and verification, and check verified-follower overlap between accounts.

**📰 Research, journalism & OSINT**
Reconstruct full conversation threads, map quote/retweet networks, and archive lists, communities, and Spaces with canonical `x.com` URLs and ISO timestamps on every record.

**🤖 AI agents & RAG pipelines**
Feed clean, flat JSON straight into an LLM. Stable `featureType` tags and predictable fields mean no brittle parsing — perfect for Apify MCP and agent tooling.

**📊 Your own performance analytics**
Export your notifications, engagement time series, and DM history for personal analytics, backups, or CRM sync.

---

### Quick start

1. Open the Actor in Apify Console and press **Start**. **Search is on by default** — you'll get tweets for the sample keyword immediately.
2. Type your own keywords, or check any of the other 14 features and fill in usernames, tweet IDs, or URLs.
3. Press **Start** and watch rows stream into the dataset.
4. Export as **JSON / CSV / Excel**, or pull via the **Apify API**, **integrations**, or **MCP**.

#### Try it — search only

```json
{
  "searchTerms": ["AI agents", "LLM"],
  "searchType": "Latest",
  "searchMaxResultsPerQuery": 100
}
````

#### Followers → lead list

```json
{
  "enableSearch": false,
  "enableNetwork": true,
  "networkUsernames": ["openai"],
  "networkType": "followers",
  "networkMinFollowers": 500,
  "maxItems": 5000
}
```

#### Profiles + full timelines

```json
{
  "enableSearch": false,
  "enableUserProfiles": true,
  "profileUsernames": ["nasa", "spacex"],
  "enableUserTweets": true,
  "timelineUsernames": ["nasa", "spacex"],
  "includeReplies": false
}
```

#### Who engaged with a tweet

```json
{
  "enableSearch": false,
  "enableEngagers": true,
  "engagerTweetUrls": ["https://x.com/nasa/status/1000000000000000001"],
  "engagerType": "both"
}
```

#### Paste any link

```json
{
  "enableSearch": false,
  "enableScrapeByUrl": true,
  "scrapeUrls": [
    "https://x.com/nasa",
    "https://x.com/i/status/1000000000000000001",
    "https://x.com/i/lists/1234567890123456"
  ]
}
```

> 💡 **API tip:** Search is on by default. For a single-purpose API run, set `"enableSearch": false` and turn on only the feature you need.

***

### Output you can trust

Every row is a **flat JSON object** with a consistent envelope, so mixed results stay easy to filter and join:

| Field | Meaning |
|-------|---------|
| `featureType` | Which feature produced this row — filter on it |
| `scrapedAt` | ISO 8601 UTC timestamp of collection |
| `sourceUrl` | Canonical `https://x.com/...` link when applicable |
| `inputRef` | The query, ID, or URL that produced the row |

**Tweet rows** include: `id`, `url`, `text`, `lang`, `createdAt`, `likeCount`, `replyCount`, `retweetCount`, `quoteCount`, `bookmarkCount`, `viewCount`, `hashtags`, `mentions`, `urls`, `media`, `isReply`, `isRetweet`, `isQuote`, `author`, and more.

**User rows** include: `id`, `username`, `displayName`, `bio`, `followersCount`, `followingCount`, `tweetCount`, `verified`, `isBlueVerified`, `location`, `website`, `profileImageUrl`, and more.

**Example — a search result:**

```json
{
  "featureType": "search",
  "scrapedAt": "2026-07-05T12:00:00.000Z",
  "sourceUrl": "https://x.com/nasa/status/1000000000000000001",
  "inputRef": "AI agents",
  "id": "1000000000000000001",
  "text": "Exploring the universe with AI agents…",
  "lang": "en",
  "likeCount": 1240,
  "retweetCount": 320,
  "viewCount": 98000,
  "authorUsername": "nasa",
  "createdAt": "2026-07-05T09:14:00.000Z"
}
```

Couldn't be fetched? You get an explicit marker instead of a silent gap:

```json
{
  "featureType": "unavailable",
  "reason": "private",
  "message": "User @example is protected.",
  "inputRef": "example",
  "scrapedAt": "2026-07-05T12:00:00.000Z"
}
```

After every run, the **OUTPUT** tab shows a summary: `enabledFeatures`, `recordCounts` per feature, `upstreamRequestCount`, and any non-fatal `errors`.

***

### Built for LLMs, agents & MCP

This Actor is designed to drop straight into AI workflows:

- **Flat, predictable records** — `camelCase` keys, `null` for missing values, no deep nesting to unravel.
- **Stable `featureType` enum** — agents filter by row type without guessing shapes.
- **Self-describing rows** — `inputRef`, `sourceUrl`, and `scrapedAt` on every record.
- **Canonical URLs** — full `https://x.com/...` links for every tweet and profile.

Use it through **Apify MCP** and ask your agent to filter on `featureType == "search"`, or export JSON/CSV from the dataset API and pipe into your RAG store.

***

### Dataset views

The dataset ships with ready-made tabbed views in the Console — **Overview, Search, Profiles, User tweets, Tweet details, Engagers, Network, Notifications, Analytics, Direct messages,** and **Unavailable** — so you can read results without building a single filter.

***

### Account data (your own session)

Three optional features — **notifications, analytics, and DM inbox** — read **your own** X account. They require credentials you provide at run time (all secret, never logged):

| Field | Needed for | Format |
|-------|-----------|--------|
| **X auth token** (`authToken`) | Notifications, Analytics, DM Inbox | Your `auth_token` cookie value |
| **Proxy host / port / username / password** | All account-data features | Filled in four simple fields (assembled for you) |
| **X ct0 token** (`ct0`) | DM Inbox | Your `ct0` CSRF cookie |

**How to get your auth token (and ct0):**

1. Log in to [x.com](https://x.com) in Chrome.
2. Press **F12** → open the **Application** tab → **Cookies** → `https://x.com`.
3. Copy the value of the cookie named **`auth_token`** (and **`ct0`** for DM Inbox).

Easier option: install the free **Cookie-Editor** or **EditThisCookie** Chrome extension, click it on x.com, and copy the `auth_token` / `ct0` values.

**Proxy:** enter your **host, port, username, and password** in the four dedicated fields — the Actor assembles them for you. (Advanced users can paste a full `host:port@user:pass` string instead.) Use a **stable, sticky** residential/ISP proxy you control — rotating IPs (including Apify's rotating proxy) can trigger X security challenges and are never used for logged-in features.

These features are **read-only** (no posting, liking, following, or sending messages). You're responsible for complying with X's Terms of Service and applicable privacy laws when exporting your own data.

***

### Controlling scope & cost

| Field | Default | What it does |
|-------|---------|--------------|
| `maxItems` | `100000` | Global ceiling for the whole run — the main cost lever |
| Per-feature max (e.g. `searchMaxResultsPerQuery`, `networkMaxUsers`) | varies | Cap a single feature; **`0` = unlimited** within `maxItems` |
| `maxRetries` | `5` | Automatic retries on rate limits / server errors |
| `includeRaw` | `false` | Attach the untouched upstream payload to each row |

Heavy jobs (full follower lists, complete reply threads) use more compute and time — lower `maxItems` or per-feature caps to keep runs lean. The full field list with defaults lives in the Console input form.

***

### FAQ

**Do I need an X/Twitter API key?** No. Public features work out of the box.

**Is this real-time?** Yes — each run fetches live data at request time.

**What formats can I export?** JSON, CSV, Excel, HTML, or RSS — plus the Apify API, webhooks, and integrations.

**Will one bad URL break my run?** No. Failed items become `unavailable` rows and the run continues.

**Can I schedule it?** Yes — use Apify Schedules to run hourly, daily, or on any cron you like.

***

### Support

Open an issue on the Actor page or contact the publisher with your run ID, the features you enabled, and your (redacted) input JSON.

***

### Contact me

Need something built beyond this Actor? I take on **custom projects** — from Apify scrapers and data pipelines to full-stack web apps.

| | |
|---|---|
| **Email** | <dubem115@gmail.com> |
| **GitHub** | [github.com/DrunkCodes](https://github.com/DrunkCodes) |

**What I can help with:**

- Custom scraping actors (X, Amazon, LinkedIn, e-commerce, lead gen, and more)
- Data extraction, enrichment, and automation workflows
- Web applications of any kind — dashboards, SaaS tools, internal tools, and APIs

Reach out with a short description of your project and timeline — happy to discuss scope and pricing.

# Actor input Schema

## `enableSearch` (type: `boolean`):

Search X by keyword, hashtag, cashtag, or advanced query. Returns tweets (or people for People search type). Enabled by default.

## `searchQueries` (type: `array`):

Full X search query strings (supports operators like min\_faves:, lang:, -is:retweet). Use searchTerms for plain keywords.

## `searchTerms` (type: `array`):

Plain keywords auto-combined into OR queries. Required when Search is enabled unless searchQueries is set.

## `searchType` (type: `string`):

Result type returned by search.

## `searchMaxResultsPerQuery` (type: `integer`):

Maximum items to collect per search query. Set 0 for unlimited (bounded by maxItems).

## `searchMaxPages` (type: `integer`):

Maximum cursor pages per query.

## `searchLanguage` (type: `string`):

Optional ISO language code (e.g. en, es). Applied in query and re-validated post-fetch.

## `searchMinLikes` (type: `integer`):

Filter tweets with at least this many likes. 0 = no filter.

## `searchExcludeRetweets` (type: `boolean`):

Exclude retweets from search results.

## `searchStartDate` (type: `string`):

ISO 8601 date — only include tweets on or after this date (filtered after fetch, not via since: operator).

## `searchEndDate` (type: `string`):

ISO 8601 date — only include tweets on or before this date.

## `enableUserProfiles` (type: `boolean`):

Fetch profile data for usernames or user IDs (batched up to 50 per request).

## `profileUsernames` (type: `array`):

X usernames without @.

## `profileUserIds` (type: `array`):

Numeric X user IDs.

## `includeAboutAccount` (type: `boolean`):

Fetch extended account info (username history, affiliates, account source). One extra request per username.

## `enableUserTweets` (type: `boolean`):

Fetch tweets posted by specific users.

## `timelineUsernames` (type: `array`):

Usernames whose timelines to scrape.

## `timelineUserIds` (type: `array`):

User IDs whose timelines to scrape (skips username resolution).

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

Include reply tweets in the timeline (tweets-and-replies vs tweets only).

## `timelineMaxTweets` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `timelineMaxPages` (type: `integer`):

Maximum cursor pages per user timeline.

## `enableTweetDetails` (type: `boolean`):

Fetch full tweet data and optional conversation replies.

## `tweetIds` (type: `array`):

Numeric tweet IDs.

## `tweetUrls` (type: `array`):

Full X tweet URLs (IDs extracted automatically).

## `includeConversationReplies` (type: `boolean`):

Paginate replies for each tweet.

## `repliesSort` (type: `string`):

Order in which conversation replies are returned.

## `repliesMaxPerTweet` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `bulkMetricsOnly` (type: `boolean`):

Use batch details-by-ids for cheap engagement snapshots (no reply threads).

## `enableEngagers` (type: `boolean`):

Fetch retweeters and/or quote tweets for given tweet IDs.

## `engagerTweetIds` (type: `array`):

Numeric tweet IDs to fetch engagers for.

## `engagerTweetUrls` (type: `array`):

Full X tweet URLs to fetch engagers for (IDs extracted automatically).

## `engagerType` (type: `string`):

Which engagers to fetch: retweeters, quote tweets, or both.

## `engagersMaxPerTweet` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `engagersMaxPages` (type: `integer`):

Maximum cursor pages per tweet when fetching engagers.

## `enableNetwork` (type: `boolean`):

Fetch followers, following, verified followers, or subscriptions for users.

## `networkUsernames` (type: `array`):

Usernames whose network (followers/following) to scrape.

## `networkUserIds` (type: `array`):

User IDs whose network to scrape (skips username resolution).

## `networkType` (type: `string`):

Which relationship to fetch for each user.

## `networkMaxUsers` (type: `integer`):

0 = unlimited (bounded by maxItems). Use for scraping all followers of an account.

## `networkMaxPages` (type: `integer`):

Maximum cursor pages per user when fetching network data.

## `networkPageSize` (type: `integer`):

Items per page when the list endpoint supports count (max 100).

## `networkMinFollowers` (type: `integer`):

Post-fetch filter: only include users with at least this many followers.

## `enableFriendship` (type: `boolean`):

Check if one user follows another.

## `friendshipPairs` (type: `array`):

Array of {subject, target} usernames or IDs.

## `enableLists` (type: `boolean`):

Scrape X list metadata, tweets, members, or followers.

## `listIds` (type: `array`):

Numeric X list IDs.

## `listUrls` (type: `array`):

Full X list URLs (IDs extracted automatically).

## `listScrapeType` (type: `array`):

What to fetch for each list.

## `listMaxTweets` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `listMaxMembers` (type: `integer`):

0 = unlimited (bounded by maxItems). Also applies to list followers.

## `listMaxPages` (type: `integer`):

Maximum cursor pages per list.

## `enableCommunities` (type: `boolean`):

Scrape community details, tweets, members, or search for communities.

## `communityIds` (type: `array`):

Numeric X community IDs.

## `communityUrls` (type: `array`):

Full X community URLs (IDs extracted automatically).

## `communitySearchQueries` (type: `array`):

Keywords to discover communities (requires 'search' in community scrape types).

## `communityScrapeType` (type: `array`):

What to fetch for each community.

## `communitySortBy` (type: `string`):

Order in which community tweets are returned.

## `communityMaxTweets` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `communityMaxMembers` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `communityMaxPages` (type: `integer`):

Maximum cursor pages per community.

## `enableSpaces` (type: `boolean`):

Fetch X Space metadata and optional HLS stream URL.

## `spaceIds` (type: `array`):

X Space IDs.

## `spaceUrls` (type: `array`):

Full X Space URLs (IDs extracted automatically).

## `includeStreamUrl` (type: `boolean`):

Resolve HLS audio stream URL from space mediaKey.

## `enableTranslate` (type: `boolean`):

Translate tweet text to a target language.

## `translateTweetIds` (type: `array`):

Numeric tweet IDs to translate.

## `translateTweetUrls` (type: `array`):

Full X tweet URLs to translate (IDs extracted automatically).

## `translateTargetLang` (type: `string`):

ISO language code (en, es, fr, de, ja, zh-CN, …).

## `enableScrapeByUrl` (type: `boolean`):

Paste any X URL — auto-detect page type and return structured data.

## `scrapeUrls` (type: `array`):

Any X URLs — tweets, profiles, lists, communities, Spaces, or search pages.

## `scrapeExtractType` (type: `string`):

Force a specific extraction type, or auto-detect from each URL.

## `scrapeIncludeReplies` (type: `boolean`):

For tweet URLs, also paginate and return conversation replies.

## `scrapeMaxItems` (type: `integer`):

0 = unlimited per URL (bounded by maxItems).

## `scrapeMaxPages` (type: `integer`):

Maximum cursor pages per URL.

## `enableNotifications` (type: `boolean`):

Read notifications for your own X account (requires authToken + sticky proxy).

## `enableAnalytics` (type: `boolean`):

Fetch engagement analytics for your own account.

## `enableDmInbox` (type: `boolean`):

Read DM conversations for your own account (requires authToken + ct0 + sticky proxy).

## `authToken` (type: `string`):

Your X account login token (the 'auth\_token' cookie). Required for any account-data feature (Notifications, Analytics, DM Inbox). HOW TO GET IT: 1) Log in to x.com in Chrome. 2) Press F12 → open the 'Application' tab → Cookies → https://x.com. 3) Copy the value of the cookie named 'auth\_token'. Easier option: install the free 'Cookie-Editor' or 'EditThisCookie' Chrome extension, click it on x.com, and copy the 'auth\_token' value. Treated as a secret and never logged.

## `ct0` (type: `string`):

Your X 'ct0' cookie value. Required for DM Inbox (and encrypted X Chat). Get it the same way as the auth token: F12 → Application tab → Cookies → https://x.com → copy the 'ct0' value (or use the Cookie-Editor extension). Treated as a secret and never logged.

## `proxyHost` (type: `string`):

Your proxy server address, e.g. proxy.example.com or 123.45.67.89. From your proxy provider's dashboard. Use a sticky (non-rotating) residential/ISP proxy — do NOT use Apify's rotating proxy for a logged-in account.

## `proxyPort` (type: `string`):

Your proxy port number, e.g. 8080. From your proxy provider's dashboard.

## `proxyUsername` (type: `string`):

The username/login for your proxy. From your proxy provider's dashboard.

## `proxyPassword` (type: `string`):

The password for your proxy. From your proxy provider's dashboard. Treated as a secret and never logged.

## `userProxy` (type: `string`):

Advanced: instead of the four proxy fields above, paste a full sticky proxy string in host:port@user:pass format (e.g. proxy.example.com:8080@myuser:mypass). If set, this overrides the separate fields. Required (via this field or the four above) for account-data features.

## `notificationsType` (type: `string`):

Which notifications timeline to read.

## `notificationsMax` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `notificationsMaxPages` (type: `integer`):

Maximum cursor pages when reading notifications.

## `analyticsFromTime` (type: `string`):

ISO 8601 start time. Empty = 30 days ago.

## `analyticsToTime` (type: `string`):

ISO 8601 end time. Empty = now.

## `analyticsGranularity` (type: `string`):

Time bucket size for the analytics series.

## `analyticsShowVerifiedFollowers` (type: `boolean`):

Include verified follower counts in the analytics output.

## `dmScope` (type: `string`):

Which DM inbox timelines to read.

## `dmIncludeEncrypted` (type: `boolean`):

Also read encrypted X Chat history (requires xchatUserId and xchatPin).

## `xchatUserId` (type: `string`):

Your numeric user ID for encrypted DM setup.

## `xchatPin` (type: `string`):

Your X Chat PIN (4–6 digits) if reading encrypted history.

## `dmConversationIds` (type: `array`):

Specific conversation IDs. Empty = list inbox.

## `dmMaxMessages` (type: `integer`):

0 = unlimited (bounded by maxItems).

## `maxItems` (type: `integer`):

Global ceiling for this run. Default 100,000 — high enough to scrape all followers/replies/engagers. Lower to cap cost.

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

Reactive retries on 429/5xx/transport errors before marking an item unavailable.

## `retryBaseDelayMs` (type: `integer`):

Initial backoff delay before the first retry (grows exponentially).

## `retryMaxDelayMs` (type: `integer`):

Maximum backoff delay between retries.

## `includeRaw` (type: `boolean`):

Attach untouched upstream JSON under the raw field on each record.

## `cacheTtlSeconds` (type: `integer`):

Cache stable entities across runs in KV store. 0 = off (real-time).

## Actor input object example

```json
{
  "enableSearch": true,
  "searchQueries": [],
  "searchTerms": [
    "AI agents"
  ],
  "searchType": "Latest",
  "searchMaxResultsPerQuery": 100,
  "searchMaxPages": 100,
  "searchLanguage": "",
  "searchMinLikes": 0,
  "searchExcludeRetweets": false,
  "searchStartDate": "",
  "searchEndDate": "",
  "enableUserProfiles": false,
  "profileUsernames": [],
  "profileUserIds": [],
  "includeAboutAccount": false,
  "enableUserTweets": false,
  "timelineUsernames": [],
  "timelineUserIds": [],
  "includeReplies": false,
  "timelineMaxTweets": 0,
  "timelineMaxPages": 100,
  "enableTweetDetails": false,
  "tweetIds": [],
  "tweetUrls": [],
  "includeConversationReplies": false,
  "repliesSort": "Relevance",
  "repliesMaxPerTweet": 0,
  "bulkMetricsOnly": false,
  "enableEngagers": false,
  "engagerTweetIds": [],
  "engagerTweetUrls": [],
  "engagerType": "both",
  "engagersMaxPerTweet": 0,
  "engagersMaxPages": 100,
  "enableNetwork": false,
  "networkUsernames": [],
  "networkUserIds": [],
  "networkType": "followers",
  "networkMaxUsers": 0,
  "networkMaxPages": 100,
  "networkPageSize": 100,
  "networkMinFollowers": 0,
  "enableFriendship": false,
  "friendshipPairs": [],
  "enableLists": false,
  "listIds": [],
  "listUrls": [],
  "listScrapeType": [
    "details",
    "tweets"
  ],
  "listMaxTweets": 0,
  "listMaxMembers": 0,
  "listMaxPages": 100,
  "enableCommunities": false,
  "communityIds": [],
  "communityUrls": [],
  "communitySearchQueries": [],
  "communityScrapeType": [
    "details",
    "tweets"
  ],
  "communitySortBy": "Recency",
  "communityMaxTweets": 0,
  "communityMaxMembers": 0,
  "communityMaxPages": 100,
  "enableSpaces": false,
  "spaceIds": [],
  "spaceUrls": [],
  "includeStreamUrl": false,
  "enableTranslate": false,
  "translateTweetIds": [],
  "translateTweetUrls": [],
  "translateTargetLang": "en",
  "enableScrapeByUrl": false,
  "scrapeUrls": [],
  "scrapeExtractType": "auto",
  "scrapeIncludeReplies": false,
  "scrapeMaxItems": 0,
  "scrapeMaxPages": 100,
  "enableNotifications": false,
  "enableAnalytics": false,
  "enableDmInbox": false,
  "proxyHost": "",
  "proxyPort": "",
  "notificationsType": "All",
  "notificationsMax": 0,
  "notificationsMaxPages": 100,
  "analyticsFromTime": "",
  "analyticsToTime": "",
  "analyticsGranularity": "Daily",
  "analyticsShowVerifiedFollowers": true,
  "dmScope": "trusted",
  "dmIncludeEncrypted": false,
  "dmConversationIds": [],
  "dmMaxMessages": 0,
  "maxItems": 100000,
  "maxRetries": 5,
  "retryBaseDelayMs": 2000,
  "retryMaxDelayMs": 30000,
  "includeRaw": false,
  "cacheTtlSeconds": 0
}
```

# Actor output Schema

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

All scraped records (tweets, profiles, followers, engagers, and more), tagged by featureType.

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

Key fields across every record type in a single table.

## `runSummary` (type: `string`):

Per-run metadata: enabled features, record counts, upstream request count, and non-fatal errors.

# 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 = {
    "searchQueries": [],
    "searchTerms": [
        "AI agents"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("b2b_leads/x-real-time-data").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 = {
    "searchQueries": [],
    "searchTerms": ["AI agents"],
}

# Run the Actor and wait for it to finish
run = client.actor("b2b_leads/x-real-time-data").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "searchQueries": [],
  "searchTerms": [
    "AI agents"
  ]
}' |
apify call b2b_leads/x-real-time-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=b2b_leads/x-real-time-data",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "X (Twitter) Scraper – Tweets, Profiles, Followers & Search API",
        "description": "Scrape X (Twitter) in real time — search tweets, profiles, timelines, followers, retweeters, quotes, lists, communities & Spaces. No API keys or login needed. Clean, LLM/MCP-ready JSON. Export to CSV, Excel, JSON or API. 15 tools in one Actor, pay only for what you use.",
        "version": "0.0",
        "x-build-id": "dLtlVpvsOXwAhA06E"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/b2b_leads~x-real-time-data/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-b2b_leads-x-real-time-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/b2b_leads~x-real-time-data/runs": {
            "post": {
                "operationId": "runs-sync-b2b_leads-x-real-time-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/b2b_leads~x-real-time-data/run-sync": {
            "post": {
                "operationId": "run-sync-b2b_leads-x-real-time-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "enableSearch": {
                        "title": "Search",
                        "type": "boolean",
                        "description": "Search X by keyword, hashtag, cashtag, or advanced query. Returns tweets (or people for People search type). Enabled by default.",
                        "default": true
                    },
                    "searchQueries": {
                        "title": "Search queries",
                        "type": "array",
                        "description": "Full X search query strings (supports operators like min_faves:, lang:, -is:retweet). Use searchTerms for plain keywords.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchTerms": {
                        "title": "Search keywords",
                        "type": "array",
                        "description": "Plain keywords auto-combined into OR queries. Required when Search is enabled unless searchQueries is set.",
                        "default": [
                            "AI agents"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchType": {
                        "title": "Search type",
                        "enum": [
                            "Latest",
                            "Top",
                            "People",
                            "Photos",
                            "Videos"
                        ],
                        "type": "string",
                        "description": "Result type returned by search.",
                        "default": "Latest"
                    },
                    "searchMaxResultsPerQuery": {
                        "title": "Max results per query",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum items to collect per search query. Set 0 for unlimited (bounded by maxItems).",
                        "default": 100
                    },
                    "searchMaxPages": {
                        "title": "Max pages per query",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages per query.",
                        "default": 100
                    },
                    "searchLanguage": {
                        "title": "Language filter",
                        "type": "string",
                        "description": "Optional ISO language code (e.g. en, es). Applied in query and re-validated post-fetch.",
                        "default": ""
                    },
                    "searchMinLikes": {
                        "title": "Minimum likes",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Filter tweets with at least this many likes. 0 = no filter.",
                        "default": 0
                    },
                    "searchExcludeRetweets": {
                        "title": "Exclude retweets",
                        "type": "boolean",
                        "description": "Exclude retweets from search results.",
                        "default": false
                    },
                    "searchStartDate": {
                        "title": "Start date (post-fetch filter)",
                        "type": "string",
                        "description": "ISO 8601 date — only include tweets on or after this date (filtered after fetch, not via since: operator).",
                        "default": ""
                    },
                    "searchEndDate": {
                        "title": "End date (post-fetch filter)",
                        "type": "string",
                        "description": "ISO 8601 date — only include tweets on or before this date.",
                        "default": ""
                    },
                    "enableUserProfiles": {
                        "title": "User Profiles",
                        "type": "boolean",
                        "description": "Fetch profile data for usernames or user IDs (batched up to 50 per request).",
                        "default": false
                    },
                    "profileUsernames": {
                        "title": "Usernames",
                        "type": "array",
                        "description": "X usernames without @.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "profileUserIds": {
                        "title": "User IDs",
                        "type": "array",
                        "description": "Numeric X user IDs.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeAboutAccount": {
                        "title": "Include about-account metadata",
                        "type": "boolean",
                        "description": "Fetch extended account info (username history, affiliates, account source). One extra request per username.",
                        "default": false
                    },
                    "enableUserTweets": {
                        "title": "User Tweets / Timeline",
                        "type": "boolean",
                        "description": "Fetch tweets posted by specific users.",
                        "default": false
                    },
                    "timelineUsernames": {
                        "title": "Timeline usernames",
                        "type": "array",
                        "description": "Usernames whose timelines to scrape.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "timelineUserIds": {
                        "title": "Timeline user IDs",
                        "type": "array",
                        "description": "User IDs whose timelines to scrape (skips username resolution).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeReplies": {
                        "title": "Include replies",
                        "type": "boolean",
                        "description": "Include reply tweets in the timeline (tweets-and-replies vs tweets only).",
                        "default": false
                    },
                    "timelineMaxTweets": {
                        "title": "Max tweets per user",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "timelineMaxPages": {
                        "title": "Max pages per user",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages per user timeline.",
                        "default": 100
                    },
                    "enableTweetDetails": {
                        "title": "Tweet Details + Replies",
                        "type": "boolean",
                        "description": "Fetch full tweet data and optional conversation replies.",
                        "default": false
                    },
                    "tweetIds": {
                        "title": "Tweet IDs",
                        "type": "array",
                        "description": "Numeric tweet IDs.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "tweetUrls": {
                        "title": "Tweet URLs",
                        "type": "array",
                        "description": "Full X tweet URLs (IDs extracted automatically).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeConversationReplies": {
                        "title": "Include conversation replies",
                        "type": "boolean",
                        "description": "Paginate replies for each tweet.",
                        "default": false
                    },
                    "repliesSort": {
                        "title": "Replies sort",
                        "enum": [
                            "Relevance",
                            "Recency",
                            "Likes"
                        ],
                        "type": "string",
                        "description": "Order in which conversation replies are returned.",
                        "default": "Relevance"
                    },
                    "repliesMaxPerTweet": {
                        "title": "Max replies per tweet",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "bulkMetricsOnly": {
                        "title": "Bulk metrics only",
                        "type": "boolean",
                        "description": "Use batch details-by-ids for cheap engagement snapshots (no reply threads).",
                        "default": false
                    },
                    "enableEngagers": {
                        "title": "Tweet Engagers",
                        "type": "boolean",
                        "description": "Fetch retweeters and/or quote tweets for given tweet IDs.",
                        "default": false
                    },
                    "engagerTweetIds": {
                        "title": "Tweet IDs",
                        "type": "array",
                        "description": "Numeric tweet IDs to fetch engagers for.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "engagerTweetUrls": {
                        "title": "Tweet URLs",
                        "type": "array",
                        "description": "Full X tweet URLs to fetch engagers for (IDs extracted automatically).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "engagerType": {
                        "title": "Engager type",
                        "enum": [
                            "retweeters",
                            "quotes",
                            "both"
                        ],
                        "type": "string",
                        "description": "Which engagers to fetch: retweeters, quote tweets, or both.",
                        "default": "both"
                    },
                    "engagersMaxPerTweet": {
                        "title": "Max engagers per tweet",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "engagersMaxPages": {
                        "title": "Max pages per tweet",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages per tweet when fetching engagers.",
                        "default": 100
                    },
                    "enableNetwork": {
                        "title": "Followers & Following",
                        "type": "boolean",
                        "description": "Fetch followers, following, verified followers, or subscriptions for users.",
                        "default": false
                    },
                    "networkUsernames": {
                        "title": "Usernames",
                        "type": "array",
                        "description": "Usernames whose network (followers/following) to scrape.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "networkUserIds": {
                        "title": "User IDs",
                        "type": "array",
                        "description": "User IDs whose network to scrape (skips username resolution).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "networkType": {
                        "title": "Network type",
                        "enum": [
                            "followers",
                            "following",
                            "verified_followers",
                            "subscriptions"
                        ],
                        "type": "string",
                        "description": "Which relationship to fetch for each user.",
                        "default": "followers"
                    },
                    "networkMaxUsers": {
                        "title": "Max users per source",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems). Use for scraping all followers of an account.",
                        "default": 0
                    },
                    "networkMaxPages": {
                        "title": "Max pages per source",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages per user when fetching network data.",
                        "default": 100
                    },
                    "networkPageSize": {
                        "title": "Page size",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Items per page when the list endpoint supports count (max 100).",
                        "default": 100
                    },
                    "networkMinFollowers": {
                        "title": "Minimum followers filter",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Post-fetch filter: only include users with at least this many followers.",
                        "default": 0
                    },
                    "enableFriendship": {
                        "title": "Friendship Check",
                        "type": "boolean",
                        "description": "Check if one user follows another.",
                        "default": false
                    },
                    "friendshipPairs": {
                        "title": "Friendship pairs",
                        "type": "array",
                        "description": "Array of {subject, target} usernames or IDs.",
                        "default": []
                    },
                    "enableLists": {
                        "title": "Lists",
                        "type": "boolean",
                        "description": "Scrape X list metadata, tweets, members, or followers.",
                        "default": false
                    },
                    "listIds": {
                        "title": "List IDs",
                        "type": "array",
                        "description": "Numeric X list IDs.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "listUrls": {
                        "title": "List URLs",
                        "type": "array",
                        "description": "Full X list URLs (IDs extracted automatically).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "listScrapeType": {
                        "title": "List scrape types",
                        "type": "array",
                        "description": "What to fetch for each list.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "details",
                                "tweets",
                                "members",
                                "followers"
                            ]
                        },
                        "default": [
                            "details",
                            "tweets"
                        ]
                    },
                    "listMaxTweets": {
                        "title": "Max tweets per list",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "listMaxMembers": {
                        "title": "Max members per list",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems). Also applies to list followers.",
                        "default": 0
                    },
                    "listMaxPages": {
                        "title": "Max pages per list",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages per list.",
                        "default": 100
                    },
                    "enableCommunities": {
                        "title": "Communities",
                        "type": "boolean",
                        "description": "Scrape community details, tweets, members, or search for communities.",
                        "default": false
                    },
                    "communityIds": {
                        "title": "Community IDs",
                        "type": "array",
                        "description": "Numeric X community IDs.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "communityUrls": {
                        "title": "Community URLs",
                        "type": "array",
                        "description": "Full X community URLs (IDs extracted automatically).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "communitySearchQueries": {
                        "title": "Community search queries",
                        "type": "array",
                        "description": "Keywords to discover communities (requires 'search' in community scrape types).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "communityScrapeType": {
                        "title": "Community scrape types",
                        "type": "array",
                        "description": "What to fetch for each community.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "details",
                                "tweets",
                                "members",
                                "search"
                            ]
                        },
                        "default": [
                            "details",
                            "tweets"
                        ]
                    },
                    "communitySortBy": {
                        "title": "Community tweets sort",
                        "enum": [
                            "Relevance",
                            "Recency"
                        ],
                        "type": "string",
                        "description": "Order in which community tweets are returned.",
                        "default": "Recency"
                    },
                    "communityMaxTweets": {
                        "title": "Max tweets per community",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "communityMaxMembers": {
                        "title": "Max members per community",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "communityMaxPages": {
                        "title": "Max pages per community",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages per community.",
                        "default": 100
                    },
                    "enableSpaces": {
                        "title": "Spaces",
                        "type": "boolean",
                        "description": "Fetch X Space metadata and optional HLS stream URL.",
                        "default": false
                    },
                    "spaceIds": {
                        "title": "Space IDs",
                        "type": "array",
                        "description": "X Space IDs.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "spaceUrls": {
                        "title": "Space URLs",
                        "type": "array",
                        "description": "Full X Space URLs (IDs extracted automatically).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeStreamUrl": {
                        "title": "Include stream URL",
                        "type": "boolean",
                        "description": "Resolve HLS audio stream URL from space mediaKey.",
                        "default": false
                    },
                    "enableTranslate": {
                        "title": "Tweet Translation",
                        "type": "boolean",
                        "description": "Translate tweet text to a target language.",
                        "default": false
                    },
                    "translateTweetIds": {
                        "title": "Tweet IDs to translate",
                        "type": "array",
                        "description": "Numeric tweet IDs to translate.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "translateTweetUrls": {
                        "title": "Tweet URLs to translate",
                        "type": "array",
                        "description": "Full X tweet URLs to translate (IDs extracted automatically).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "translateTargetLang": {
                        "title": "Target language",
                        "type": "string",
                        "description": "ISO language code (en, es, fr, de, ja, zh-CN, …).",
                        "default": "en"
                    },
                    "enableScrapeByUrl": {
                        "title": "Scrape By URL",
                        "type": "boolean",
                        "description": "Paste any X URL — auto-detect page type and return structured data.",
                        "default": false
                    },
                    "scrapeUrls": {
                        "title": "URLs",
                        "type": "array",
                        "description": "Any X URLs — tweets, profiles, lists, communities, Spaces, or search pages.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "scrapeExtractType": {
                        "title": "Extract type",
                        "enum": [
                            "auto",
                            "tweet",
                            "profile",
                            "user_tweets",
                            "list",
                            "community",
                            "space",
                            "search"
                        ],
                        "type": "string",
                        "description": "Force a specific extraction type, or auto-detect from each URL.",
                        "default": "auto"
                    },
                    "scrapeIncludeReplies": {
                        "title": "Include replies (tweet URLs)",
                        "type": "boolean",
                        "description": "For tweet URLs, also paginate and return conversation replies.",
                        "default": false
                    },
                    "scrapeMaxItems": {
                        "title": "Max items",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited per URL (bounded by maxItems).",
                        "default": 0
                    },
                    "scrapeMaxPages": {
                        "title": "Max pages",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages per URL.",
                        "default": 100
                    },
                    "enableNotifications": {
                        "title": "My Notifications",
                        "type": "boolean",
                        "description": "Read notifications for your own X account (requires authToken + sticky proxy).",
                        "default": false
                    },
                    "enableAnalytics": {
                        "title": "My Analytics",
                        "type": "boolean",
                        "description": "Fetch engagement analytics for your own account.",
                        "default": false
                    },
                    "enableDmInbox": {
                        "title": "My DM Inbox",
                        "type": "boolean",
                        "description": "Read DM conversations for your own account (requires authToken + ct0 + sticky proxy).",
                        "default": false
                    },
                    "authToken": {
                        "title": "X auth token",
                        "type": "string",
                        "description": "Your X account login token (the 'auth_token' cookie). Required for any account-data feature (Notifications, Analytics, DM Inbox). HOW TO GET IT: 1) Log in to x.com in Chrome. 2) Press F12 → open the 'Application' tab → Cookies → https://x.com. 3) Copy the value of the cookie named 'auth_token'. Easier option: install the free 'Cookie-Editor' or 'EditThisCookie' Chrome extension, click it on x.com, and copy the 'auth_token' value. Treated as a secret and never logged."
                    },
                    "ct0": {
                        "title": "X ct0 token (CSRF cookie)",
                        "type": "string",
                        "description": "Your X 'ct0' cookie value. Required for DM Inbox (and encrypted X Chat). Get it the same way as the auth token: F12 → Application tab → Cookies → https://x.com → copy the 'ct0' value (or use the Cookie-Editor extension). Treated as a secret and never logged."
                    },
                    "proxyHost": {
                        "title": "Proxy host",
                        "type": "string",
                        "description": "Your proxy server address, e.g. proxy.example.com or 123.45.67.89. From your proxy provider's dashboard. Use a sticky (non-rotating) residential/ISP proxy — do NOT use Apify's rotating proxy for a logged-in account.",
                        "default": ""
                    },
                    "proxyPort": {
                        "title": "Proxy port",
                        "type": "string",
                        "description": "Your proxy port number, e.g. 8080. From your proxy provider's dashboard.",
                        "default": ""
                    },
                    "proxyUsername": {
                        "title": "Proxy username",
                        "type": "string",
                        "description": "The username/login for your proxy. From your proxy provider's dashboard."
                    },
                    "proxyPassword": {
                        "title": "Proxy password",
                        "type": "string",
                        "description": "The password for your proxy. From your proxy provider's dashboard. Treated as a secret and never logged."
                    },
                    "userProxy": {
                        "title": "Full proxy string (advanced — optional)",
                        "type": "string",
                        "description": "Advanced: instead of the four proxy fields above, paste a full sticky proxy string in host:port@user:pass format (e.g. proxy.example.com:8080@myuser:mypass). If set, this overrides the separate fields. Required (via this field or the four above) for account-data features."
                    },
                    "notificationsType": {
                        "title": "Notifications type",
                        "enum": [
                            "All",
                            "Verified",
                            "Mentions"
                        ],
                        "type": "string",
                        "description": "Which notifications timeline to read.",
                        "default": "All"
                    },
                    "notificationsMax": {
                        "title": "Max notifications",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "notificationsMaxPages": {
                        "title": "Max notification pages",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum cursor pages when reading notifications.",
                        "default": 100
                    },
                    "analyticsFromTime": {
                        "title": "Analytics from",
                        "type": "string",
                        "description": "ISO 8601 start time. Empty = 30 days ago.",
                        "default": ""
                    },
                    "analyticsToTime": {
                        "title": "Analytics to",
                        "type": "string",
                        "description": "ISO 8601 end time. Empty = now.",
                        "default": ""
                    },
                    "analyticsGranularity": {
                        "title": "Analytics granularity",
                        "enum": [
                            "Daily",
                            "Weekly",
                            "Monthly"
                        ],
                        "type": "string",
                        "description": "Time bucket size for the analytics series.",
                        "default": "Daily"
                    },
                    "analyticsShowVerifiedFollowers": {
                        "title": "Include verified follower metrics",
                        "type": "boolean",
                        "description": "Include verified follower counts in the analytics output.",
                        "default": true
                    },
                    "dmScope": {
                        "title": "DM inbox scope",
                        "enum": [
                            "trusted",
                            "untrusted",
                            "both"
                        ],
                        "type": "string",
                        "description": "Which DM inbox timelines to read.",
                        "default": "trusted"
                    },
                    "dmIncludeEncrypted": {
                        "title": "Include encrypted X Chat history",
                        "type": "boolean",
                        "description": "Also read encrypted X Chat history (requires xchatUserId and xchatPin).",
                        "default": false
                    },
                    "xchatUserId": {
                        "title": "X Chat user ID",
                        "type": "string",
                        "description": "Your numeric user ID for encrypted DM setup."
                    },
                    "xchatPin": {
                        "title": "X Chat PIN",
                        "type": "string",
                        "description": "Your X Chat PIN (4–6 digits) if reading encrypted history."
                    },
                    "dmConversationIds": {
                        "title": "Conversation IDs",
                        "type": "array",
                        "description": "Specific conversation IDs. Empty = list inbox.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "dmMaxMessages": {
                        "title": "Max messages per conversation",
                        "minimum": 0,
                        "type": "integer",
                        "description": "0 = unlimited (bounded by maxItems).",
                        "default": 0
                    },
                    "maxItems": {
                        "title": "Max items (global)",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Global ceiling for this run. Default 100,000 — high enough to scrape all followers/replies/engagers. Lower to cap cost.",
                        "default": 100000
                    },
                    "maxRetries": {
                        "title": "Max retries",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Reactive retries on 429/5xx/transport errors before marking an item unavailable.",
                        "default": 5
                    },
                    "retryBaseDelayMs": {
                        "title": "Retry base delay (ms)",
                        "minimum": 100,
                        "type": "integer",
                        "description": "Initial backoff delay before the first retry (grows exponentially).",
                        "default": 2000
                    },
                    "retryMaxDelayMs": {
                        "title": "Retry max delay (ms)",
                        "minimum": 1000,
                        "type": "integer",
                        "description": "Maximum backoff delay between retries.",
                        "default": 30000
                    },
                    "includeRaw": {
                        "title": "Include raw upstream payload",
                        "type": "boolean",
                        "description": "Attach untouched upstream JSON under the raw field on each record.",
                        "default": false
                    },
                    "cacheTtlSeconds": {
                        "title": "Cross-run cache TTL (seconds)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Cache stable entities across runs in KV store. 0 = off (real-time).",
                        "default": 0
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
