# Twitter / X Profiles + Tweets Scraper (`santamaria-automations/twitter-x-profiles-tweets-scraper`) Actor

Scrape public Twitter/X profiles & tweets. Returns username, bio, follower count, following count, verified status, location, website, and more. No login or API key required. Pay-per-result.

- **URL**: https://apify.com/santamaria-automations/twitter-x-profiles-tweets-scraper.md
- **Developed by:** [Ale](https://apify.com/santamaria-automations) (community)
- **Categories:** Social media, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Twitter / X Profile + Tweets Scraper

Pass in a list of usernames, get back their profile data and recent tweets. No login, no API key, no cookies. Just HTTP.

### What you get

For every username you pass in, the scraper does two API calls behind the scenes:

1. A profile lookup (bio, follower counts, banner, verified status, account creation date, all 24 profile fields)
2. The user's recent tweets timeline (text, engagement metrics, entities like hashtags and mentions, plus reply / retweet / quote / pinned flags)

Each tweet comes back as one item with the full author profile embedded. If you only need profile data you can set `tweetsPerUser: 0`.

### Input

```json
{
  "usernames": ["elonmusk", "nasa", "openai"],
  "tweetsPerUser": 20
}
````

Usernames can be plain (`elonmusk`), at-prefixed (`@elonmusk`), or full profile URLs (`https://x.com/elonmusk` or `https://twitter.com/elonmusk`). All three formats normalize to the same thing.

#### Available input fields

| Field | Type | Default | Description |
|---|---|---|---|
| `usernames` | array | required | Usernames, @handles, or profile URLs |
| `tweetsPerUser` | integer | 20 | Tweets per user, 0 to 1000 |
| `includeReplies` | boolean | false | Include tweets that are replies to other people |
| `includeRetweets` | boolean | true | Include retweets |
| `includeProfileOnlyItems` | boolean | false | Also push one extra `profile` item per user |
| `maxIPRotations` | integer | 5 | How many times to retry with a fresh session if X rate-limits us |
| `proxyConfiguration` | object | RESIDENTIAL | Apify proxy. Residential is recommended, X rate-limits datacenter IPs hard |

### Output

Each item is one tweet with the author embedded. Field count is around 45 across the nested structure.

```json
{
  "item_type": "tweet",
  "tweet": {
    "id": "1962908474892812685",
    "text": "...",
    "lang": "en",
    "created_at": "2025-09-02T16:00:24Z",
    "created_at_unix": 1756828824,
    "url": "https://x.com/NASA/status/1962908474892812685",
    "conversation_id": "1962908474892812685",
    "is_reply": false,
    "is_retweet": false,
    "is_quote": false,
    "is_pinned": false,
    "retweeted_status_id": null,
    "quoted_status_id": null,
    "in_reply_to_user_id": null,
    "in_reply_to_username": null,
    "in_reply_to_tweet_id": null,
    "source": "Sprinklr",
    "engagement": {
      "reply_count": 186,
      "retweet_count": 638,
      "like_count": 2444,
      "quote_count": 12,
      "bookmark_count": 89,
      "view_count": 484164
    },
    "entities": {
      "hashtags": [],
      "mentions": [{"username": "NASAArtemis", "user_id": "632344577"}],
      "urls": [
        {
          "url": "https://t.co/ClHjcD6zgu",
          "expanded_url": "https://science.nasa.gov/skywatching/whats-up/",
          "display_url": "science.nasa.gov/skywatching/wh..."
        }
      ],
      "cashtags": [],
      "media": [{"type": "photo", "url": "https://pbs.twimg.com/media/...", "preview_url": "..."}]
    }
  },
  "author": {
    "id": "11348282",
    "username": "NASA",
    "display_name": "NASA",
    "bio": "Making the seemingly impossible, possible.",
    "location": "Pale Blue Dot",
    "website": "https://t.co/9NkQJKAVks",
    "website_expanded": "https://nasa.gov",
    "verified": false,
    "blue_verified": true,
    "is_protected": false,
    "followers_count": 92093477,
    "following_count": 188,
    "tweet_count": 74067,
    "listed_count": 92146,
    "favourites_count": 5183,
    "media_count": 21456,
    "profile_image_url": "https://pbs.twimg.com/profile_images/...",
    "profile_banner_url": "https://pbs.twimg.com/profile_banners/...",
    "created_at": "Wed Dec 19 20:20:32 +0000 2007",
    "created_at_unix": 1198095632,
    "profile_url": "https://x.com/NASA",
    "pinned_tweet_ids": ["2059393717111308634"]
  },
  "scraped_at": "2026-06-10T10:14:33Z"
}
```

If you turn on `includeProfileOnlyItems`, you also get one row per user where `item_type` is `profile`, `tweet` is omitted, and `author` carries the same profile block.

#### A few notes about the fields

- `text` is the full tweet text (X internally calls this `full_text`). It will not be truncated even on long-form premium tweets.
- `entities.urls[].expanded_url` resolves the t.co shortener to the real destination. Handy for lead-gen.
- `entities.mentions[].user_id` gives you the mentioned account's stable ID, not just the username. Usernames can be changed; IDs cannot.
- `engagement.view_count` is 0 on very recent tweets. X populates the count with a small delay.
- `is_pinned` is set when the tweet shows up as the author's pinned tweet on their profile.

### Examples

**Three accounts, ten tweets each**

```json
{"usernames": ["elonmusk", "nasa", "openai"], "tweetsPerUser": 10}
```

**Mixed input formats**

```json
{
  "usernames": ["elonmusk", "@nasa", "https://x.com/openai"],
  "tweetsPerUser": 5
}
```

**Profile data only, no tweets**

```json
{
  "usernames": ["elonmusk", "nasa"],
  "tweetsPerUser": 0,
  "includeProfileOnlyItems": true
}
```

**Clean originals only, no retweets, no replies**

```json
{
  "usernames": ["openai"],
  "tweetsPerUser": 50,
  "includeReplies": false,
  "includeRetweets": false
}
```

### Pricing

Pay per result.

| Event | Price |
|---|---|
| Actor start | $0.010 |
| Each item delivered (tweet or profile) | $0.0003 |

Some quick math:

- 1 user, 20 tweets = $0.016
- 50 users, 20 tweets = $0.310
- 1000 items = $0.310

The actor-start fee covers the one-time session bootstrap with X. After that it's a flat $0.30 per 1000 items, which beats the leading competitors for runs of 100 items or more.

### How to use it from an AI agent

The actor is exposed on Apify's MCP endpoint:

```
https://mcp.apify.com?tools=santamaria-automations/twitter-x-profiles-tweets-scraper
```

This works with Claude Desktop, Claude.ai, Cursor, VS Code, LangChain, and any other MCP client.

Example prompt:

> Use twitter-x-profiles-tweets-scraper to fetch the 30 most recent tweets from @elonmusk and @sama. Skip retweets and replies. Tell me what topics they're posting about this week.

### Caveats

- Only public accounts return tweets. Protected accounts return profile metadata only.
- Suspended and deleted accounts are silently skipped.
- The scraper uses the same public GraphQL endpoint that x.com's web client hits for logged-out browsing. If X rate-limits a proxy IP, the actor retries with a fresh session up to `maxIPRotations` times (default 5).
- View counts may be 0 on very recent tweets.

### Issues, feature requests

- [Issues tab on the actor page](https://apify.com/santamaria-automations/twitter-x-profiles-tweets-scraper/issues)
- [Other actors by santamaria-automations](https://apify.com/santamaria-automations)

# Actor input Schema

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

Twitter/X usernames to scrape. Accepts bare usernames (`elonmusk`), @-prefixed (`@elonmusk`), or full profile URLs (`https://x.com/elonmusk`). One actor run can scrape multiple users.

## `tweetsPerUser` (type: `integer`):

How many recent tweets to return per user. Each tweet item embeds the full author profile (24 fields). Set to 0 to skip tweets entirely — in that case turn on `includeProfileOnlyItems` so you still get a profile row per user.

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

Include tweets that are direct replies to other users.

## `includeRetweets` (type: `boolean`):

Include retweets in the result set.

## `includeProfileOnlyItems` (type: `boolean`):

If enabled, emit one extra `item_type: "profile"` item per user with the full author block — useful when you want the profile metadata as its own dataset row in addition to each tweet.

## `maxIPRotations` (type: `integer`):

On rate-limit, recreate the session (new outbound IP) and retry. Default 5.

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

Apify proxy settings. Residential strongly recommended; X enforces tight per-IP rate limits.

## Actor input object example

```json
{
  "usernames": [
    "elonmusk",
    "nasa",
    "openai"
  ],
  "tweetsPerUser": 20,
  "includeReplies": false,
  "includeRetweets": true,
  "includeProfileOnlyItems": false,
  "maxIPRotations": 5,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `defaultDataset` (type: `string`):

Tweets (with embedded author) and optional profile-only items. 45+ fields per tweet item.

# 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 = {
    "usernames": [
        "elonmusk",
        "nasa",
        "openai"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("santamaria-automations/twitter-x-profiles-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 = { "usernames": [
        "elonmusk",
        "nasa",
        "openai",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("santamaria-automations/twitter-x-profiles-tweets-scraper").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 '{
  "usernames": [
    "elonmusk",
    "nasa",
    "openai"
  ]
}' |
apify call santamaria-automations/twitter-x-profiles-tweets-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=santamaria-automations/twitter-x-profiles-tweets-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Twitter / X Profiles + Tweets Scraper",
        "description": "Scrape public Twitter/X profiles & tweets. Returns username, bio, follower count, following count, verified status, location, website, and more. No login or API key required. Pay-per-result.",
        "version": "2.0",
        "x-build-id": "oRkyePmCu9cdAgGJV"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/santamaria-automations~twitter-x-profiles-tweets-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-santamaria-automations-twitter-x-profiles-tweets-scraper",
                "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/santamaria-automations~twitter-x-profiles-tweets-scraper/runs": {
            "post": {
                "operationId": "runs-sync-santamaria-automations-twitter-x-profiles-tweets-scraper",
                "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/santamaria-automations~twitter-x-profiles-tweets-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-santamaria-automations-twitter-x-profiles-tweets-scraper",
                "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",
                "required": [
                    "usernames"
                ],
                "properties": {
                    "usernames": {
                        "title": "Usernames or Profile URLs",
                        "type": "array",
                        "description": "Twitter/X usernames to scrape. Accepts bare usernames (`elonmusk`), @-prefixed (`@elonmusk`), or full profile URLs (`https://x.com/elonmusk`). One actor run can scrape multiple users.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "tweetsPerUser": {
                        "title": "Tweets per User",
                        "minimum": 0,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "How many recent tweets to return per user. Each tweet item embeds the full author profile (24 fields). Set to 0 to skip tweets entirely — in that case turn on `includeProfileOnlyItems` so you still get a profile row per user.",
                        "default": 20
                    },
                    "includeReplies": {
                        "title": "Include Replies",
                        "type": "boolean",
                        "description": "Include tweets that are direct replies to other users.",
                        "default": false
                    },
                    "includeRetweets": {
                        "title": "Include Retweets",
                        "type": "boolean",
                        "description": "Include retweets in the result set.",
                        "default": true
                    },
                    "includeProfileOnlyItems": {
                        "title": "Emit profile-only items",
                        "type": "boolean",
                        "description": "If enabled, emit one extra `item_type: \"profile\"` item per user with the full author block — useful when you want the profile metadata as its own dataset row in addition to each tweet.",
                        "default": false
                    },
                    "maxIPRotations": {
                        "title": "Warm-IP Rotations on Rate Limit",
                        "minimum": 0,
                        "maximum": 50,
                        "type": "integer",
                        "description": "On rate-limit, recreate the session (new outbound IP) and retry. Default 5.",
                        "default": 5
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Apify proxy settings. Residential strongly recommended; X enforces tight per-IP rate limits.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
