# Twitter (X) User Search & Profile Discovery Scraper (`smart_albatross/x-user-search-scraper`) Actor

Search X/Twitter profiles by keywords or names. Collect unique matching accounts with bios, follower counts, verification and source query attribution. Set total and per-query limits; export JSON, CSV or Excel.

- **URL**: https://apify.com/smart_albatross/x-user-search-scraper.md
- **Developed by:** [Dev](https://apify.com/smart_albatross) (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.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/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) User Search & Profile Discovery Scraper

Search X/Twitter profiles by keywords or names. Collect unique matching accounts with bios, follower counts, verification and source query attribution. Set total and per-query limits; export JSON, CSV or Excel.

### What this Actor collects

Search the X People index for matching profiles. This is profile discovery, not tweet keyword search. Matching order and visibility are controlled by X; not every profile mentioning a keyword can necessarily be retrieved.

### Quick start

Enter inputs, start with a small maxItems, and run. No customer X cookies are required. Export the default dataset as JSON, CSV, Excel or JSONL, or use the Apify API.

```json
{
  "searchTerms": [
    "NASA",
    "space"
  ],
  "maxItems": 100,
  "maxItemsPerTerm": 50
}
```

### Limits and deduplication

maxItems is the total unique output ceiling, not a per-source allowance. maxItemsPerSource caps each input and defaults to maxItems. maxItemsPerTerm is an alias; maxItemsPerSource takes precedence. maxDurationSeconds defaults to 300 and cannot exceed 600. Account rate limits, spending limits and X visibility may yield fewer results. Startup has bounded retries; very short deadlines may elapse during initialization.

IDs are strings. No duplicate IDs are emitted within a run; migration recovery reconciles existing writes. If several inputs discover the same record, the **first source** gets attribution. This is a unique-profile/result export, not an exhaustive relationship-edge export.

### Output schema

Rows are flat user profiles with id, userName, name, url, description, followers, following, verification, images, createdAt, canDm and additional normalized fields. Every row includes sourceInput, sourceType and searchTerm. searchTerm is the query for user search, otherwise an empty string.

canDm reads dm_permissions.can_dm or legacy.can_dm: true/false when reported, null when unknown. Permission can depend on the authenticated X account; it is not a global guarantee that anyone may DM that profile.

The Output tab links to results and COVERAGE. COVERAGE lists source/strategy pages, limits, failures, repeated cursors and the exact stop reason. Dataset and output schemas are included for Store publishing.

### Coverage and responsible use

X may withhold protected, deleted, blocked, suspended or unindexed content, or shorten lists despite larger public counters. An empty result is **not a completeness guarantee**. This Actor does not bypass access controls. Follow applicable terms and privacy obligations.

### API

After deployment, POST JSON input to https://api.apify.com/v2/acts/<owner>~x-user-search-scraper/runs using an Authorization bearer token. Read items from the run's default dataset. Never put tokens in public URLs.

### Operator setup

Not yet published; no price or Store publication is configured. Each new Actor requires secret X_ACCOUNTS and proxy environment configuration. Credentials never belong in input forms, source, datasets or logs. Arbitrary JavaScript mapping is not supported.

Prepare a clean build directory:

```sh
node scripts/prepare-actor.mjs user-search
```

Build from .artifacts/actors/user-search. Staging never deploys or publishes. Memory is fixed at 1024 MB. Pure HTTP with compressed responses and account-aware rate limits; no browser or third-party data API.

# Actor input Schema

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

Keywords, names or handles for X People search. This searches profiles, not tweet text.

## `maxItemsPerTerm` (type: `integer`):

Alias for maxItemsPerSource. If both are supplied, maxItemsPerSource takes precedence. maxItems remains a run-wide ceiling.

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

Run-wide ceiling shared across all inputs. Unique IDs only; spending limits or the runtime deadline may stop the run earlier.

## `maxItemsPerSource` (type: `integer`):

Optional per-handle, per-tweet or per-query cap shared by all strategies for that input. Defaults to maxItems. Duplicates attributed to earlier sources do not count again.

## `maxDurationSeconds` (type: `integer`):

Includes initialization and collection. Defaults to five minutes; very short deadlines may elapse during bounded startup. See COVERAGE for incomplete sources.

## Actor input object example

```json
{
  "searchTerms": [
    "NASA"
  ],
  "maxItems": 1000,
  "maxDurationSeconds": 300
}
```

# Actor output Schema

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

Stable normalized records with source attribution. Export through the dataset UI or API.

## `coverage` (type: `string`):

Stop reason, per-strategy page counts and failures. Output is not a completeness guarantee.

# 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 = {
    "searchTerms": [
        "NASA"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("smart_albatross/x-user-search-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 = { "searchTerms": ["NASA"] }

# Run the Actor and wait for it to finish
run = client.actor("smart_albatross/x-user-search-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 '{
  "searchTerms": [
    "NASA"
  ]
}' |
apify call smart_albatross/x-user-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,smart_albatross/x-user-search-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/BCVWkObvnET7EgyuZ/builds/cpCKbTjOFqT8VKeYg/openapi.json
