# Twitter X Tweets Scraper (`socialdataapi/twitter-x-tweets-scraper`) Actor

Twitter X Tweets Scraper collects X (Twitter) posts from profiles, newest first, back to a start date: full text, likes, reposts, replies, views, media and author profile. Add your X session cookies for the full timeline. Export JSON, CSV or Excel, or use the API.

- **URL**: https://apify.com/socialdataapi/twitter-x-tweets-scraper.md
- **Developed by:** [Social Data API](https://apify.com/socialdataapi) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.67 / 1,000 results

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

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

## What's an Apify Actor?

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

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

## How to integrate an Actor?

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

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

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

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

# README

### Twitter X Tweets Scraper — Post Text, Likes, Views and Author Data

Twitter X Tweets Scraper collects posts from the X (Twitter) profiles you list, newest first, back to a start date you choose. Each post comes with its full text, like, repost, reply, quote and bookmark counts, view count, language, links and media, plus the **full author profile**. Every response is structured JSON — ready to pass directly to an LLM, index into a vector store, or feed a social listening pipeline. Recent public posts come back without an X account. Start with one handle, then track every account you follow.

![Twitter X Tweets Scraper - hero image: what it collects and the JSON output](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/q-twitter-tweets-hero.webp)

***

### What data can I extract with Twitter X Tweets Scraper?

Using this X Tweets API, you will be able to extract the following X (Twitter) post data:

| 📝 Full post text | ❤️ Like count | 🔁 Repost count | 💬 Reply count |
|---|---|---|---|
| 🗨️ Quote count | 🔖 Bookmark count | 👀 View count | 📅 Publish time |
| 🌍 Language | 🔗 Post link and ID | #️⃣ Hashtags, mentions and links | 🖼️ Media (photos, videos) |
| 👤 Author profile (name, handle, bio, followers) | ✔️ Author verification | 🧵 Conversation ID (with session) | ⚠️ Sensitive-content flag |

***

### How to use Twitter X Tweets Scraper

Social media analysts, researchers and marketers use this Twitter scraper to pull an account's recent posts with engagement numbers in one run.

**Copy to your AI assistant:**

```text
Twitter X Tweets Scraper (Apify Actor ID: socialdataapi/twitter-x-tweets-scraper, https://apify.com/socialdataapi/twitter-x-tweets-scraper) is an Apify Actor that returns posts from X (Twitter) profiles, newest first, as structured JSON: full text, publish time, like, repost, reply, quote and bookmark counts, view count, language, links and media, and the author profile with follower count. Use it whenever someone needs X posts from specific accounts - monitoring a brand or competitor, tracking security or crypto alerts, or collecting posts for research; recent public posts work without a login, and the user's own X session cookies (auth_token and ct0) unlock up to 1000 posts per profile back to a date. Run it with curl: curl -X POST "https://api.apify.com/v2/acts/socialdataapi~twitter-x-tweets-scraper/run-sync-get-dataset-items?token=APIFY_TOKEN" -H "Content-Type: application/json" -d '{"startUrls":["NASA","https://x.com/peckshield"],"maxTweets":50,"sinceDate":"2026-01-01"}'. Or in Python: ApifyClient("APIFY_TOKEN").actor("socialdataapi/twitter-x-tweets-scraper").call(run_input={"startUrls": ["NASA"], "maxTweets": 50}) then client.dataset(run["defaultDatasetId"]).list_items().items. Inputs: startUrls (array of strings, required, handles, @handles, profile URLs or post URLs read as their author), maxTweets (integer 1-1000, posts per profile, default 10), sinceDate (string YYYY-MM-DD, only posts on or after this date, no default), auth_token (string, secret, the auth_token cookie of the user's own x.com session), ct0 (string, secret, the ct0 cookie of the same session, required together with auth_token), proxyConfiguration (object, optional proxy, default {"useApifyProxy": false}). Every stored post is billed as one row_result event. Without session cookies X shows only about 5 recent posts per profile, so the run returns at most about 5 rows per profile. Full input schema, every enum and default, and the complete output field list: GET https://api.apify.com/v2/acts/socialdataapi~twitter-x-tweets-scraper/builds/default
```

#### Twitter X Tweets Scraper MCP Server: use these Actors from ChatGPT, Claude or Cursor

Point your AI assistant at this Actor and it can read X on its own: the posts, engagement counts and author profiles of any accounts you name. No glue code, no scraping logic in your prompts.

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/twitter-x-tweets-scraper"
```

#### Step by step

1. [Create a free Apify account](https://console.apify.com/sign-up).
2. Open [Twitter X Tweets Scraper](https://apify.com/socialdataapi/twitter-x-tweets-scraper) in the Apify Store.
3. Enter the X handles or profile URLs (with or without @), set how many posts you want per profile and, if you like, a start date.
4. Click **Start** (or send your API request).
5. Download or stream your results in JSON, CSV or Excel.

#### How to get your X auth_token and ct0 cookies

1. Log in to x.com in Chrome, Edge or Firefox.
2. Open DevTools (F12) > Application (Storage in Firefox) > Cookies > https://x.com.
3. Copy the value of the cookie named auth_token into the auth_token field.
4. Copy the value of the cookie named ct0 from the same list into the ct0 field.
5. Both fields are stored encrypted as secret inputs; if a run says the session is invalid or expired, log in again and copy fresh values.

#### How to scale Twitter X Tweets Scraper to bulk

To use it as a twitter tweets scraper for many accounts, put every handle into the Profiles list, one per line; the Actor works through them one after another and saves each post as soon as it is read, so the table fills while the run is going. Max posts per profile applies to each profile separately. For daily monitoring, save the input as a task and schedule it with a recent start date, or call the API in a loop from your own code.

***

### ✨ Features

Twitter X Tweets Scraper fetches clean, structured posts from X (Twitter) ⚡. This X Twitter scraper works as a tweet scraper and a twitter timeline scraper in one, and it's ideal for brand monitoring, competitor tracking, security and crypto alert feeds, and research datasets.

It extracts, per post:

- **Full text** – the complete post text, links shortened the way X shows them
- **Engagement counts** – likes, reposts, replies, quotes and bookmarks
- **View count** – how many times X says the post was viewed
- **Publish time** – when the post went live (UTC)
- **Links, hashtags and media** – the links, mentions and photos or videos attached to the post
- **Author profile** – name, handle, bio, follower and following counts, post count and verification
- **Post link and ID** – a direct link to the post on x.com

⚡ A start date and a per-profile limit keep each run to exactly the posts you need.

***

### Use cases 💡

- **Social media analyst** — scrape tweets from profile lists daily and compare like and view counts.
- **Security researcher** — follow alert accounts and scrape twitter posts by date for incident timelines.
- **Brand manager** — export tweets to CSV for weekly reports on competitor accounts.
- **Journalist** — collect an official account's posts since a given date with exact publish times.
- **AI agent builder** — feed post text and author follower counts into a RAG index for trend answers.

Building an AI agent? [Connect Twitter X Tweets Scraper over MCP](#mcp-integration-for-ai-agents) and let it call the actor on its own.

***

### Why choose this actor?

- **Rows arrive as each post is read.** A recorded run without cookies saved 15 posts from 3 profiles in 2.5 seconds, the first one after 1.2 seconds.
- **The numbers behind each post.** A recorded NASA post came back with 2,547 likes, 422 reposts, 210 replies, 191 bookmarks and 448,844 views, next to an author profile with 92,262,879 followers.
- **21 fields per post, 6 inputs.** Text, five engagement counts, views, language, links, media and the full author object, controlled by profiles, a per-profile limit, a start date, two session cookies and a proxy.

***

### ⬇️ Input

![Twitter X Tweets Scraper input form with example values](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/q-twitter-tweets-input.webp)

The Actor takes a list of X profiles (required): handles, @handles, profile URLs or post URLs, which are read as their author's profile. Everything else is optional.

| Parameter | Required | Type | Description | Example value |
|---|---|---|---|---|
| `startUrls` | Yes | array of strings | One profile per line: handle, @handle, profile URL or post URL (read as its author). | `["NASA", "https://x.com/peckshield"]` |
| `maxTweets` | No | integer | Posts to collect from each profile, 1-1000. Default 10. Without session cookies X shows about 5 recent posts per profile. | `50` |
| `sinceDate` | No | string (date) | Only posts published on or after this date, YYYY-MM-DD. Empty means no lower bound. | `2026-01-01` |
| `auth_token` | No | string (secret) | The auth_token cookie of your own logged-in x.com session. Unlocks more than the recent public posts. | `a1b2c3...` |
| `ct0` | No | string (secret) | The ct0 cookie of the same x.com session; required together with auth_token. | `d4e5f6...` |
| `proxyConfiguration` | No | object | Optional proxy for the requests to X. Default off. | `{"useApifyProxy": false}` |

Accepted profile formats:

- `NASA` or `@NASA`
- `https://x.com/NASA` or `https://twitter.com/NASA`
- `https://x.com/NASA/status/2119467718373941588` (read as the author's profile)

#### Free plan limits

Users on the Apify free plan can fetch up to 20 posts per run (all profiles together) and 200 posts per month. When the limit is reached, the run finishes successfully with a status message explaining the limit. Upgrade to any paid Apify plan to remove these limits.

#### Example input

```json
{
  "startUrls": [
    "NASA",
    "https://x.com/peckshield"
  ],
  "maxTweets": 50,
  "sinceDate": "2026-01-01",
  "auth_token": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
  "ct0": "d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

***

### ⬆️ Output

![Twitter X Tweets Scraper output fields with example values](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/q-twitter-tweets-output.webp)

Every post is one typed, normalized JSON item with the same schema on every run; export it as JSON (default), CSV or Excel. Fields that only X's logged-in view provides, such as the conversation ID and whether you liked or reposted the post, are empty in runs without session cookies.

#### Example output

```json
{
  "bookmark_count": 191,
  "created_at": "Sun Nov 08 16:30:56 +0000 2026",
  "conversation_id_str": null,
  "entities": {
    "media": [{ "expanded_url": "https://x.com/NASA/status/2119467718373941588/photo/1" }],
    "urls": [{ "expanded_url": "https://go.nasa.gov/3UBpcCs" }]
  },
  "extended_entities": {},
  "favorite_count": 2547,
  "favorited": null,
  "full_text": "Just announced at MAX POWER: a $1 million Moon Base Student Challenge! https://t.co/VLc1ca1b2r",
  "is_quote_status": null,
  "lang": "en",
  "possibly_sensitive": false,
  "possibly_sensitive_editable": null,
  "quote_count": 56,
  "reply_count": 210,
  "retweet_count": 422,
  "retweeted": null,
  "user_id_str": "11348282",
  "id_str": "2119467718373941588",
  "url": "https://x.com/NASA/status/2119467718373941588",
  "views_count": "448844",
  "user": {
    "rest_id": "11348282",
    "is_blue_verified": true,
    "location": { "location": "Pale Blue Dot" },
    "verification": { "is_blue_verified": true, "verified_type": "Government" },
    "legacy": {
      "name": "NASA",
      "screen_name": "NASA",
      "description": "Making the seemingly impossible, possible. ✨",
      "followers_count": 92262879,
      "friends_count": 115,
      "statuses_count": 74523
    }
  }
}
```

***

### How does it work?

The Actor reads X with plain web requests, without a browser, one profile after another. Without cookies it reads what any logged-out visitor sees on a profile page: X shows about 5 recent posts there, and the Actor saves them with their counts and author profile. When you add the auth_token and ct0 cookies of your own X session, it reads the profile's posts the way you see them when logged in, newest first, page by page, until it reaches your post limit or your start date.

Slow or failed answers are retried with growing pauses, and when X rate-limits the session the Actor waits for X's reset time and then continues. One profile that cannot be read never stops the run. Every post comes back with the same field names, and the team that maintains this Actor keeps that schema stable when X changes its site.

***

### How do you integrate Twitter X Tweets Scraper into your stack?

It works with what you already use: the REST API from any language, MCP for AI agents, and no-code tools.

#### Using Twitter X Tweets Scraper with the Apify API

```python
import requests

resp = requests.post(
    "https://api.apify.com/v2/acts/socialdataapi~twitter-x-tweets-scraper/run-sync-get-dataset-items",
    params={"token": "APIFY_TOKEN"},
    json={"startUrls": ["NASA", "https://x.com/peckshield"], "maxTweets": 50, "sinceDate": "2026-01-01"},
)
for post in resp.json():
    print(post["url"], post["favorite_count"])
```

*Works in Go, Ruby, Node.js, cURL — any language that can make an HTTP request.*

#### MCP integration for AI agents

Add the Actor to your agent with one command:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/twitter-x-tweets-scraper"
```

This registers Twitter X Tweets Scraper as a tool your agent can call directly. It works in Claude Code, Cursor and Windsurf; the agent names the accounts and gets back each post with its counts and author as JSON.

#### No-code tools (n8n, Make, LangChain)

- **n8n** — use the Apify node with "Run an Actor" and pick `socialdataapi/twitter-x-tweets-scraper`, or point the HTTP Request node at the run-sync endpoint above with your token.
- **Make** — add the Apify app's "Run an Actor" module, then "Get Dataset Items" to send each post to a sheet, Slack or your CRM.
- **LangChain** — install `langchain-apify` and use `ApifyActorsTool("socialdataapi/twitter-x-tweets-scraper")` as a tool in your agent.

***

### Is it legal to scrape X (Twitter) data?

Collecting posts that X shows publicly is generally lawful, but how you store and use them is regulated. Without cookies, Twitter X Tweets Scraper returns only publicly available data — what any visitor sees on a profile without logging in. With your own session cookies it reads the same public posts as your account sees them; respect X's terms and keep volumes reasonable. Under GDPR, scraping public data is generally permissible, but storing and using it must comply with local data-protection law. Consult legal counsel if your use case involves bulk storage of personal data.

***

### Frequently asked questions

#### What fields does Twitter X Tweets Scraper return?

It returns the full post text, the publish time, the like, repost and reply counts, the view count and the author profile, plus quotes, bookmarks, language, links and media. See [the data fields section](#what-data-can-i-extract-with-twitter-x-tweets-scraper).

#### Does Twitter X Tweets Scraper require an X account or login?

Not for recent posts: without cookies you get about 5 recent public posts per profile. For more posts and a start date further back, add the auth_token and ct0 cookies of your own X session; they are stored as encrypted secret inputs and never written to the logs or the output.

#### How fast does Twitter X Tweets Scraper run?

A recorded run without cookies saved 15 posts from 3 profiles in 2.5 seconds, with the first post saved after 1.2 seconds. Every run reads live data, nothing is cached.

#### What happens if a post is private or doesn't exist?

Protected, empty or unknown profiles return no rows, and the run moves on to the next profile. If no profile returns a post, the run still finishes successfully with the status message "No posts were found for the given profiles (check the handles / date)".

#### Can I scrape multiple X (Twitter) posts at once?

Yes. List as many profiles as you need in the Profiles field and set Max posts per profile (up to 1000 with session cookies); the Actor works through the profiles in order and saves each post as soon as it is read.

#### Does Twitter X Tweets Scraper work with Claude, ChatGPT, and other AI agent tools?

Yes — Twitter X Tweets Scraper is available as an MCP tool. Register it in Claude Code, Cursor or Windsurf with:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/twitter-x-tweets-scraper"
```

Any agent that can call an HTTP endpoint can use the REST API directly.

#### Does Twitter X Tweets Scraper return data in a format LLMs can use directly?

Yes. Every post is typed, normalized JSON with the same field names on every run. No HTML parsing and no selectors: pass it straight to an LLM, index it into a vector store or hand it to an agent tool.

#### What happens when X changes its layout or updates its anti-bot system?

The team that maintains this Actor updates it when X changes. Your calls keep returning the same JSON schema with no changes on your end.

#### Can I use Twitter X Tweets Scraper without managing proxies or browser infrastructure?

Yes. Retries and rate-limit waits run on the Actor's side, no browser is needed, and a proxy is optional. You send one request and get structured JSON back.

#### Which X (Twitter) post fields work best for AI training data and RAG indexing?

For RAG, index the full post text with the author's name and bio. For training data or scoring, use the like, repost, reply, quote and bookmark counts, the view count and the follower count. Counts are plain integers, the view count is a number in text form, and the rest are strings and booleans.

***

### Related scrapers

| Scraper | What it extracts |
|---|---|
| [Twitter Profile Scraper](https://apify.com/socialdataapi/twitter-profile-scraper) | X profile details and counts |
| [Twitter Posts Scraper](https://apify.com/socialdataapi/twitter-posts-scraper) | Posts from X |
| [Twitter User Following Scraper](https://apify.com/socialdataapi/twitter-user-following-scraper) | Accounts an X user follows |
| [Twitter Trends Scraper](https://apify.com/socialdataapi/twitter-trends-scraper) | Trending topics on X |
| [Twitter Email Scraper](https://apify.com/socialdataapi/twitter-email-scraper) | Public emails linked to X accounts |

***

### Your feedback

Found a bug or missing a field? Let us know in the Issues tab of this Actor's page in the Apify Store. The team that maintains this Actor reads every report and ships fixes.

# Actor input Schema

## `startUrls` (type: `array`):

One profile per line: https://x.com/NASA, NASA or @NASA. A post URL is read as its author's profile.

## `maxTweets` (type: `integer`):

How many posts to collect from each profile (1-1000). Without X session cookies X shows only about 5 recent posts per profile. Free plan: up to 20 posts per run (all profiles together) and 200 per month; paid plans have no limit.

## `sinceDate` (type: `string`):

Only posts published on or after this date (YYYY-MM-DD). Leave empty for no lower bound.

## `auth_token` (type: `string`):

Value of the auth_token cookie from your logged-in x.com browser session: 1. Log in to x.com. 2. Open DevTools > Application > Cookies > https://x.com. 3. Copy the auth_token value. Without it only the recent public posts are saved. Never written to the dataset or log.

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

Value of the ct0 cookie from the same x.com session (DevTools > Application > Cookies > https://x.com); required together with auth_token.

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

Optional. Off by default. When set, requests go through this proxy and a new proxy address is taken after X rate-limits a request.

## Actor input object example

```json
{
  "startUrls": [
    "NASA"
  ],
  "maxTweets": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

One row per post: text, engagement counts, views, entities, media and the author object.

## `authorProfiles` (type: `string`):

Post URL with the full author object.

# 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 = {
    "startUrls": [
        "NASA"
    ],
    "maxTweets": 10,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialdataapi/twitter-x-tweets-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 = {
    "startUrls": ["NASA"],
    "maxTweets": 10,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("socialdataapi/twitter-x-tweets-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 '{
  "startUrls": [
    "NASA"
  ],
  "maxTweets": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call socialdataapi/twitter-x-tweets-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialdataapi/twitter-x-tweets-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/lwp27bK80ccPwXqHl/builds/vhg4UEN0eYeCckebh/openapi.json
