X (Twitter) data API: the official API or an Apify Actor?
X (Twitter) has a public official API. 12 Apify Actors in this catalogue return X (Twitter) data over HTTP too: send the input to Apify's run-sync endpoint with your token and get the records back as JSON, from $0.40 a run plus $0.99 per 1,000 results at Store prices (plus platform usage).
Side by side
| X API v2 | Apify Actors (12) | |
|---|---|---|
| Access | Public, self-serve | Apify API token (any account) |
| What you get | X API v2 uses prepaid pay-per-usage credits. Published standard read rates include $0.005 per Post resource and $0.010 per User resource. Pay-per-use launched on February 6, 2026; legacy Basic and Pro plans migrated to… | Rows defined by each Actor's published schema; up to 59 fields per record |
| Price | Charged per resource returned: $0.005 per Post, $0.010 per User. Owned Reads on qualifying own-account endpoints are $0.001 per resource. A 3 million Post-read monthly cap applies to self-serve pay-per-use. | From $0.40 a run plus $0.99 per 1,000 results (Store price, Free plan), plus platform usage |
| Limits | Spending limits are configurable. Enterprise access is required above the monthly cap. | Synchronous calls wait up to 300 s; longer runs go asynchronous |
| Docs | X API v2 | Apify API: run-sync |
Official API facts checked 2026-11-09. X content and API use are governed by the X Developer Agreement. Do not bypass logins or access controls; not legal advice.
Which Actor for which job
All of them list $0.99 per 1,000 results on the Store, plus a start fee per run.
| Actor | Returns | Fields include | Call it |
|---|---|---|---|
| Twitter (X) Media Downloader | Download videos, photos, GIFs, audio and poster images from public Twitter/X posts - no login, no cookies. Works with post links… | tweetId, tweetUrl, mediaType | run-sync · Apify |
| X Broadcast Viewer History & Replay Link Scraper | One row per X broadcast, viewer-timeline point, public chat message, or status row, with metadata, viewer statistics, HLS… | title, state, viewersNow | run-sync · Apify |
| Twitter (X) Screenshot Generator | Screenshot capture records for public X posts and profiles, with image dimensions, format, and download link, plus the saved… | targetUrl, profileUrl, captureMode | run-sync · Apify |
| X Article Announcement Post Metadata Collector | Turn an X (Twitter) Article's announcement post or article link into structured metadata: title, preview text, cover image… | title, articleId, bodyAvailable | run-sync · Apify |
| X Community Activity & Member Finder | Community profile, rules, top/media posts with engagement metrics, and optional creator, moderator, facepile and active-member… | communityName, name, text | run-sync · Apify |
| X Keyword Search with Mention & Reply Operators | X posts with full text, author profile, engagement counters, media, quoted post and reply context. Empty runs write a… | text, createdAt, language | run-sync · Apify |
| X Post, Reply & Profile Lookup by Link or ID | X posts, replies, and profile rows resolved from the links, IDs, or handles you supplied. | text, createdAt, likeCount | run-sync · Apify |
| X Trends Lookup by Country, City & WOEID | Ranked X trends per location, with trend type, search links, cross-location overlap and catalog metadata, plus location-list… | location, trend, trendType | run-sync · Apify |
| X Video Subtitle & Caption Transcript Converter | Per-video transcript records with timestamped segments, full transcript text, timestamped text, RAG chunks, SRT/VTT subtitle… | tweetUrl, tweetId, videoIndex | run-sync · Apify |
| X/Twitter Keyword & Hashtag Tweet Search | Tweets found for your keywords — text, author, engagement metrics, media and the search term that found each row. | text, createdAt, language | run-sync · Apify |
| Twitter (X) Space Scraper | Space metadata, participant rows, transcripts and downloadable replay audio collected from public X Spaces. | title, state, listenersLive | run-sync · Apify |
| X (Twitter) Profile & Post Engagement Extractor | One profile row per account, one post row per collected post (cursor-paged up to maxPostsPerProfile), and status rows for… | message, username, name | run-sync · Apify |
Call X Article Announcement Post Metadata Collector
The call waits for the run and returns the records as JSON. Swap the Actor ID for any Actor in the table. Set APIFY_TOKEN first; runs bill to that account.
curl
curl -X POST "https://api.apify.com/v2/actors/dataspryva~x-article-announcement-post-metadata-collector/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tweetUrls":["https://x.com/vxunderground/status/1979885711579865307"],"includeArticleBody":true,"includeAnnouncementPost":true,"includeAuthorProfile":true,"includeCoverImage":true,"includePreviewText":true,"maxItems":3}' Install: pip install "apify-client>=3"
Python
import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run_input = {
"tweetUrls": [
"https://x.com/vxunderground/status/1979885711579865307",
],
"includeArticleBody": True,
"includeAnnouncementPost": True,
"includeAuthorProfile": True,
"includeCoverImage": True,
"includePreviewText": True,
"maxItems": 3,
}
run = client.actor("dataspryva/x-article-announcement-post-metadata-collector").call(run_input=run_input)
if run is None:
raise RuntimeError("The Actor run could not be started")
print(run.status, "dataset", run.default_dataset_id)
for item in client.dataset(run.default_dataset_id).iterate_items():
print(item) Install: npm install apify-client
JavaScript
import { ApifyClient } from "apify-client";
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const input = {
"tweetUrls": [
"https://x.com/vxunderground/status/1979885711579865307"
],
"includeArticleBody": true,
"includeAnnouncementPost": true,
"includeAuthorProfile": true,
"includeCoverImage": true,
"includePreviewText": true,
"maxItems": 3
};
const run = await client.actor("dataspryva/x-article-announcement-post-metadata-collector").call(input);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length, items[0]); Generated from the Actor's published schema and checked, not executed.
Same data, other routes
- X (Twitter) MCP server: these Actors as tools in Claude, Cursor, ChatGPT, VS Code and Codex.
- X (Twitter) keyword posts to Google Sheets: an n8n workflow you can import.
- Every Actor with a one-request API
When a call fails
Why does the workflow or script stop with HTTP 408?
The synchronous endpoint waits at most 300 seconds. After that it answers 408 while the run keeps going in Apify. Lower the result limit, or start the run asynchronously, wait for it to finish and then read its dataset.
Source: Apify API: run Actor synchronously and get dataset items
What do 400, 401, 402 and 403 from the Apify API mean?
Read error.type in the response body. 400 is invalid Actor input. 401 (user-or-token-not-found) means a token reached Apify but it is wrong or revoked. 402 with x402-payment-required means no token reached Apify at all: the n8n credential or the Authorization: Bearer header is missing, and Apify is offering its pay-per-run x402 route for agents instead; any other 402 is an exhausted usage limit on the account that pays for the run. 403 is a token without permission for that Actor or storage.
Source: Apify API: authentication; Apify documentation: agentic payments with x402; Apify API: run Actor synchronously and get dataset items
Why does starting an Actor through the API return run information instead of scraped results?
The Run Actor endpoint starts the Actor and immediately returns a Run object without waiting for completion. For results stored in the default dataset, pass the response's defaultDatasetId to Get dataset items; to wait and receive output directly, use the synchronous endpoint for dataset items or a key-value store record.
Source: Apify Run Actor API
Why are rows and hidden fields missing from my Apify dataset export?
The clean parameter enables both skipEmpty and skipHidden, removing empty items and fields whose names begin with #. This can produce fewer items than the requested limit; to retain those rows and fields, disable clean and ensure skipEmpty and skipHidden are also disabled.
Source: Apify Get dataset items API
Questions
Is there an official X (Twitter) API?
X API v2 uses prepaid pay-per-usage credits. Published standard read rates include $0.005 per Post resource and $0.010 per User resource. Pay-per-use launched on February 6, 2026; legacy Basic and Pro plans migrated to pay-per-use. Charged per resource returned: $0.005 per Post, $0.010 per User. Owned Reads on qualifying own-account endpoints are $0.001 per resource. A 3 million Post-read monthly cap applies to self-serve pay-per-use.
How much does X (Twitter) data cost through an Apify Actor?
The Actors listed here charge from $0.40 a run plus $0.99 per 1,000 results on the Apify Store (Free plan), checked 2026-11-12, billed to the Apify account whose token makes the call. Actor start events and platform usage can add to that.
Can I get X (Twitter) data as JSON in one HTTP request?
Yes, through Apify's run-sync-get-dataset-items endpoint: POST the Actor input with your token and the response is the dataset as JSON. It waits up to 300 seconds; longer runs need the asynchronous run endpoint.
Can an AI agent use the same X (Twitter) data?
Yes. The X (Twitter) MCP page bundles these Actors into one Apify MCP URL for Claude, Cursor, ChatGPT, VS Code and Codex.
Is it allowed to collect X (Twitter) data?
X content and API use are governed by the X Developer Agreement. Do not bypass logins or access controls; not legal advice. Read X (Twitter)'s terms before you build on the data.
Sources
- X API v2 documentation, checked 2026-11-09
- X API v2 pricing
- Apify API: run Actor synchronously, checked 2026-11-11
- docs.x.com/changelog, checked 2026-11-09
- X (Twitter) terms