The Piloterr X (Twitter) Scraper API lets you extract public data from X (Twitter) as clean, structured JSON — no proxies, headless browsers or HTML parsing to maintain. Endpoints available in production:
- X Post Info API — X Post Info API: fetch public tweet data (text, likes, retweets, views, media) from a status URL or tweet ID via browser rendering.
- X Profile Info API — X Profile Info API: fetch public X/Twitter profile data (bio, followers, verification, avatars) from a username or URL via browser rendering.
Use it for brand monitoring, social listening, influencer research, ad intelligence or content analytics on public data.
| Endpoint | Path | Credits | What you get |
|---|---|---|---|
| X Post Info API | /v2/x/post/info |
2 | X Post Info API |
| X Profile Info API | /v2/x/profile/info |
2 | X Profile Info API |
- How it works
- X Post Info API
- X Profile Info API
- Code examples in other languages
- Practical use cases
- Why Piloterr?
- FAQ
- Related scrapers
- Support
- Create a free Piloterr account and copy your API key from the dashboard.
- Send a
GET(orPOST) request tohttps://api.piloterr.com/v2/...with the headerx-api-key: YOUR_API_KEY. - Receive structured JSON — Piloterr handles rendering, proxies, retries and parsing.
export PILOTERR_API_KEY="your-api-key"
pip install requests # Python
# TypeScript: Node.js 18+ (native fetch), run with `npx tsx file.ts`Every endpoint accepts both
GET(query string) andPOST(JSON body with the same fields).
X Post Info API: fetch public tweet data (text, likes, retweets, views, media) from a status URL or tweet ID via browser rendering.
GET | POST https://api.piloterr.com/v2/x/post/info · 2 credits per request · Full reference
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | ✅ | X tweet to retrieve. Accepts a full status URL or numeric tweet ID. |
return_page_source |
boolean | — | When true, return the raw HTML page source as {"result": "..."} instead of structured JSON. Defaults to false. |
import json
import os
import requests
response = requests.get(
"https://api.piloterr.com/v2/x/post/info",
headers={"x-api-key": os.environ["PILOTERR_API_KEY"]},
params={
"query": "https://x.com/example-user/status/0000000000000000001",
},
timeout=120,
)
response.raise_for_status()
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False)[:2000])type XPostInfo = {
url?: string;
name?: unknown;
text?: string;
media?: string[];
tweet_id?: string;
username?: string;
verified?: boolean;
created_at?: unknown;
like_count?: number;
view_count?: number;
reply_count?: number;
retweet_count?: number;
};
const params = new URLSearchParams({
"query": "https://x.com/example-user/status/0000000000000000001",
});
const response = await fetch(`https://api.piloterr.com/v2/x/post/info?${params}`, {
headers: { "x-api-key": process.env.PILOTERR_API_KEY! },
});
if (!response.ok) throw new Error(`Piloterr error ${response.status}: ${await response.text()}`);
const data = (await response.json()) as XPostInfo;
console.log(JSON.stringify(data, null, 2).slice(0, 2000));POST variant
POST https://api.piloterr.com/v2/x/post/info
x-api-key: YOUR_API_KEY
Content-Type: application/json
{"query": "https://x.com/example-user/status/0000000000000000001"}Response shape with placeholder values — field names follow the API reference.
{
"url": "example",
"name": "example",
"text": "example",
"media": [
"example"
],
"tweet_id": "example",
"username": "example",
"verified": false,
"created_at": "example",
"like_count": 0,
"view_count": 0,
"reply_count": 0,
"retweet_count": 0
}| Field | Type | Description |
|---|---|---|
url |
string | |
name |
object | |
text |
string | |
media |
string[] | |
tweet_id |
string | |
username |
string | |
verified |
boolean | |
created_at |
object | |
like_count |
integer | |
view_count |
integer | |
reply_count |
integer | |
retweet_count |
integer |
X Profile Info API: fetch public X/Twitter profile data (bio, followers, verification, avatars) from a username or URL via browser rendering.
GET | POST https://api.piloterr.com/v2/x/profile/info · 2 credits per request · Full reference
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | ✅ | X profile to look up. Accepts a username, @handle, or profile URL. |
return_page_source |
boolean | — | When true, return the raw HTML page source as {"result": "..."} instead of structured JSON. Defaults to false. |
import json
import os
import requests
response = requests.get(
"https://api.piloterr.com/v2/x/profile/info",
headers={"x-api-key": os.environ["PILOTERR_API_KEY"]},
params={
"query": "elonmusk",
},
timeout=120,
)
response.raise_for_status()
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False)[:2000])type XProfileInfo = {
url?: string;
name?: string;
user_id?: string;
location?: unknown;
username?: string;
verified?: boolean;
created_at?: string;
description?: string;
tweet_count?: number;
followers_count?: number;
following_count?: number;
profile_image_url?: string;
profile_banner_url?: string;
profile_image_url_normal?: string;
};
const params = new URLSearchParams({
"query": "elonmusk",
});
const response = await fetch(`https://api.piloterr.com/v2/x/profile/info?${params}`, {
headers: { "x-api-key": process.env.PILOTERR_API_KEY! },
});
if (!response.ok) throw new Error(`Piloterr error ${response.status}: ${await response.text()}`);
const data = (await response.json()) as XProfileInfo;
console.log(JSON.stringify(data, null, 2).slice(0, 2000));POST variant
POST https://api.piloterr.com/v2/x/profile/info
x-api-key: YOUR_API_KEY
Content-Type: application/json
{"query": "elonmusk"}Response shape with placeholder values — field names follow the API reference.
{
"url": "example",
"name": "example",
"user_id": "example",
"location": "example",
"username": "example",
"verified": false,
"created_at": "example",
"description": "example",
"tweet_count": 0,
"followers_count": 0,
"following_count": 0,
"profile_image_url": "example",
"profile_banner_url": "example",
"profile_image_url_normal": "example"
}| Field | Type | Description |
|---|---|---|
url |
string | |
name |
string | |
user_id |
string | |
location |
object | |
username |
string | |
verified |
boolean | |
created_at |
string | |
description |
string | |
tweet_count |
integer | |
followers_count |
integer | |
following_count |
integer | |
profile_image_url |
string | |
profile_banner_url |
string | |
profile_image_url_normal |
string |
Ready-to-run examples live in the examples/ folder. Each one reads your key from the PILOTERR_API_KEY environment variable.
| Language | X Post Info | X Profile Info |
|---|---|---|
| cURL (Bash) | post-info |
profile-info |
| PHP | post-info |
profile-info |
| C# | post-info |
profile-info |
| Go | post-info |
profile-info |
| Java | post-info |
profile-info |
| Ruby | post-info |
profile-info |
| Node.js | post-info |
profile-info |
- Brand monitoring — Follow public mentions and engagement around your brand.
- Social listening — Analyse public conversations and trends.
- Influencer research — Qualify public creator profiles and audience metrics.
- Ad intelligence — Study competitors' public ads and creatives.
- Content analytics — Benchmark formats and engagement over time.
- No infrastructure — no proxies, headless browsers or CAPTCHA solving to run yourself.
- Structured JSON — stable, documented fields instead of brittle HTML selectors.
- Pay per request — transparent credit cost per endpoint, failed requests are retried for you.
- One API key, hundreds of sources — X (Twitter) plus many other e-commerce, search and company data endpoints in the Piloterr library.
- Any language — plain HTTPS + JSON, with examples for Python, TypeScript, cURL, PHP, C#, Go, Java, Ruby and Node.js.
Collecting publicly available data is generally allowed in many jurisdictions, but rules depend on your country, the data you collect and how you use it. Avoid personal data unless you have a lawful basis, respect the website's terms where they apply, and get legal advice for your specific use case. This is not legal advice.
No. Piloterr handles rendering, proxy rotation and retries on its side. You only send an HTTPS request with your x-api-key header and receive JSON.
Credits per call: /v2/x/post/info 2, /v2/x/profile/info 2. See the Piloterr website for plans.
Each endpoint returns structured JSON: X Post Info — url, name, text, media, tweet_id, username; X Profile Info — url, name, user_id, location, username, verified.
Yes. Set return_page_source=true and the response becomes {"result": "..."} with the page source.
Any language that can make an HTTP request. This README shows Python and TypeScript; the examples/ folder contains cURL, PHP, C#, Go, Java, Ruby and Node.js.
- Instagram Scraper API
- Kick Scraper API
- Patreon Scraper API
- Pinterest Scraper API
- TikTok Top Ads Scraper API
- Weibo Scraper API
- All Piloterr scrapers on GitHub
- 💬 Join the Piloterr Discord to ask questions and share what you build.
- 📚 Browse the API reference (OpenAPI) and the Piloterr library.
- 🔑 Get your API key.
Built by Piloterr — web scraping APIs for e-commerce, search, real estate and more, one API key.
X (Twitter) is a trademark of its respective owner. This repository is not affiliated with or endorsed by X (Twitter). Examples are released under the MIT license.
