X Profile Scraper avatar

X Profile Scraper

Pricing

from $1.50 / 1,000 results

Go to Apify Store
X Profile Scraper

X Profile Scraper

Fetch public X/Twitter profile details by username or profile URL using Guest GraphQL API. No login cookies required.

Pricing

from $1.50 / 1,000 results

Rating

0.0

(0)

Developer

Ghost Rider

Ghost Rider

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Categories

Share

X Profile Scraper (Apify Actor)

Fetch public X/Twitter profile data by username or profile URL — no login cookies required.

Uses X's internal Guest Token + GraphQL API (UserByScreenName).

Features

  • Input: usernames (@handle or handle) and/or profileUrls (x.com/..., twitter.com/...)
  • Auto-discovers rotating GraphQL queryId from X's JS bundle
  • Guest token refresh on expiry, 401/403, and 429
  • Apify Proxy support (recommended)

Input example

{
"usernames": ["elonmusk", "NASA"],
"profileUrls": ["https://x.com/OpenAI"],
"delayMs": 1500,
"maxRetries": 2,
"tokenRefreshAfter": 50,
"proxyConfiguration": { "useApifyProxy": true }
}

Output example

{
"id": "44196397",
"screen_name": "elonmusk",
"name": "Elon Musk",
"bio": "...",
"followers_count": 237726440,
"following_count": 1305,
"tweet_count": 100356,
"is_blue_verified": true,
"profile_image_url": "https://pbs.twimg.com/profile_images/.../photo_400x400.jpg",
"profile_url": "https://x.com/elonmusk",
"scrape_method": "guest_graphql",
"scraped_at": "2026-06-08T12:00:00.000Z"
}

Local development

npm install
apify run

Or with a local input file at storage/key_value_stores/default/INPUT.json.

Limitations

  • Profiles only — no tweets, followers, or search
  • Public data — protected accounts return limited info
  • X rotates GraphQL query IDs every few weeks; this actor discovers them at runtime
  • Datacenter IPs are often blocked — use Apify Proxy

Project structure

.actor/ Actor metadata and input schema
src/main.js Entry point and orchestration
src/guestToken.js Guest token acquisition
src/graphql.js GraphQL profile fetch
src/queryIds.js Dynamic queryId discovery
src/parseProfile.js Response parsing
src/normalizeInput.js Username / URL normalization