X APIx.com ↗
Fetch posts, engagement metrics, and profile data from any public X (Twitter) account. Two endpoints cover user timelines and profile metadata.
What is the X API?
This API provides 2 endpoints for retrieving public data from X.com (formerly Twitter): get_user_posts returns a paginated timeline of recent posts with engagement metrics, media, and quoted tweets, while get_user_profile returns account metadata including follower counts, bio, and verification status. Both endpoints accept a username as the primary input and return structured JSON with over a dozen fields covering identity, content, and engagement signals.
curl -X GET 'https://api.parse.bot/scraper/a5441c3e-48bc-4f1b-8b42-8fccc7e99d45/get_user_posts?limit=5&username=elonmusk&include_retweets=true' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace x-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
from parse_apis.x_twitter_posts_api import Twitter, User, Post, IncludeRetweets
client = Twitter(api_key="YOUR_API_KEY")
# Fetch a user's profile
user = client.user("OpenAI")
# List their recent original posts (excluding retweets)
for post in user.posts.list(include_retweets=IncludeRetweets.FALSE, limit=5):
print(post.text, post.favorite_count, post.retweet_count, post.created_at)
Get recent posts from a specific X/Twitter user timeline. Returns post text, engagement metrics, media, quoted tweets, and pagination cursor. Supports filtering retweets. Paginates via an opaque cursor. The pinned tweet if any appears first with is_pinned=true.
| Param | Type | Description |
|---|---|---|
| limit | integer | Maximum number of posts to return per page |
| cursor | string | Pagination cursor from a previous response next_cursor field |
| usernamerequired | string | X/Twitter username without the at sign |
| include_retweets | string | Whether to include retweets |
{
"type": "object",
"fields": {
"count": "integer - number of posts returned",
"posts": "array of post objects with id, text, created_at, engagement metrics, user, media, urls, quoted_tweet",
"username": "string - the requested username",
"next_cursor": "string or null - pagination cursor for the next page"
},
"sample": {
"data": {
"count": 1,
"posts": [
{
"id": "2064187087184650253",
"url": "https://x.com/elonmusk/status/2064187087184650253",
"text": "SpaceX AI Satellites",
"urls": null,
"user": {
"id": "44196397",
"name": "Elon Musk",
"verified": false,
"screen_name": "elonmusk",
"followers_count": 240169234,
"is_blue_verified": true,
"profile_image_url": "https://pbs.twimg.com/profile_images/img.jpg"
},
"media": [
{
"url": "https://pbs.twimg.com/img.jpg",
"type": "video",
"video_url": "https://video.twimg.com/vid.mp4",
"expanded_url": "https://x.com/SpaceX/status/123/video/1"
}
],
"language": "en",
"is_pinned": true,
"created_at": "Tue Jun 09 03:25:26 +0000 2026",
"is_retweet": false,
"view_count": 13082930,
"quote_count": 481,
"reply_count": 6138,
"quoted_tweet": null,
"retweet_count": 9194,
"bookmark_count": 6709,
"favorite_count": 42625,
"conversation_id": "2064187087184650253",
"in_reply_to_status_id": null
}
],
"username": "elonmusk",
"next_cursor": null
},
"status": "success"
}
}About the X API
User Timeline Posts
The get_user_posts endpoint retrieves recent posts from a specified public account. Pass the username parameter (without the @ symbol) along with an optional limit to control page size. Each post object in the posts array includes id, text, created_at, engagement metrics, associated media, resolved urls, and a nested quoted_tweet object when applicable. If the account has a pinned post, it appears first in the array with is_pinned: true. Set include_retweets to control whether retweets appear in results. Paginate through a timeline by passing the next_cursor value from one response as the cursor parameter in the next request; a null next_cursor indicates the end of available results.
User Profile Metadata
The get_user_profile endpoint returns a single object with all publicly visible account metadata for a given username. Fields include id (the numeric user ID), name (display name), screen_name (handle), description (bio), location, url (the website link set on the profile), created_at (account creation date), verified (legacy blue checkmark status), media_count, and profile_url (the full X.com profile link). This endpoint takes only the username parameter and has no pagination since it returns a single record.
Data Scope and Limitations
Both endpoints cover publicly accessible accounts. Private or protected accounts are not accessible. The get_user_posts response includes the count of returned posts alongside the array and the echoed username. Engagement metrics are included at the post level, but the specific metric fields (such as likes, reposts, and replies) are part of each post object in the posts array. There is no search or keyword filtering within a user's timeline; results are ordered as they appear on the public timeline.
The X API is a managed, monitored endpoint for x.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when x.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official x.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Monitor a brand's X.com posting activity and engagement trends over time using
get_user_posts - Aggregate follower counts and bio metadata for a list of accounts via
get_user_profile - Build a cross-platform social dashboard that surfaces recent tweets alongside engagement metrics
- Detect pinned posts on target accounts by checking
is_pinnedon the first post in the timeline - Track account creation dates and verification status for influencer vetting workflows
- Collect quoted tweet chains by expanding the nested
quoted_tweetfield in post responses - Archive public timelines by paginating through
next_cursoruntil it returns null
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does X.com have an official developer API?+
What does get_user_posts return for accounts with pinned posts?+
posts array with is_pinned set to true. All subsequent posts reflect the standard chronological timeline order. This lets you distinguish pinned content from regular posts without any additional filtering.Can I retrieve posts from protected or private X accounts?+
Does the API support searching tweets by keyword or hashtag?+
get_user_posts and individual account metadata via get_user_profile. Keyword search, hashtag search, and trending topics are not included. You can fork this API on Parse and revise it to add a search endpoint covering those use cases.How does pagination work for the user timeline?+
get_user_posts response includes a next_cursor string when more posts are available. Pass that value as the cursor parameter in your next request to retrieve the following page. When next_cursor is null, you have reached the end of the available timeline data.