X

X Posts API

Endpoints related to retrieving, searching, and modifying Posts — 14 operation(s) in the X-published contract.

Operations 19

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /2/tweets Look up several posts by ID · Get Posts by IDs #
Ask an LLM
“Can I fetch a batch of posts in a single request?”
“What author and media details can I include when looking up multiple post IDs?”
Tell an agent
Get the posts with IDs {ids}.
Look up posts {ids} and expand {expansions}.
POST /2/tweets Publish a post · Create Posts #
Ask an LLM
“What's the v2 call to publish a post?”
“Can I post a poll, a quote post, or restrict who can reply?”
Tell an agent
Post {text}.
Quote post {quote_tweet_id} with the comment {text}.
GET /2/tweets/analytics Get engagement analytics for posts · Get Posts Analytics #
Ask an LLM
“How did my posts perform over a given time window?”
“Can I break post analytics down by day or hour?”
Tell an agent
Show analytics for posts {ids} from {start_time} to {end_time}.
Get {granularity} engagement metrics for {ids} between {start_time} and {end_time}.
GET /2/tweets/counts/all Count matching posts across the full archive · Get Posts Counts All #
Ask an LLM
“How many posts mentioned a keyword across all of X's history?”
“Can I get a full-archive post volume over time grouped by day?”
Tell an agent
Count all-time posts matching {query}.
Get {granularity} full-archive post counts for {query} from {start_time} to {end_time}.
GET /2/tweets/counts/recent Count matching posts from the last 7 days · Get Posts Counts Recent #
Ask an LLM
“How many posts matched my query recently?”
“Can I chart recent post volume for a hashtag by hour?”
Tell an agent
Count recent posts matching {query}.
Get {granularity} counts of last-week posts for {query}.
GET /2/tweets/search/all Search the full post archive (v2) · Search Posts All #
Ask an LLM
“Where can I search posts going back to the beginning of X on the v2 API?”
“Can a full-archive search be limited to a date range and sorted a chosen way?”
Tell an agent
Search the full v2 archive for posts matching {query}.
Search all-time posts for {query} between {start_time} and {end_time} sorted by {sort_order}.
GET /2/tweets/search/recent Search posts from the last 7 days · Search Posts Recent #
Ask an LLM
“What have people posted about a topic recently?”
“Can I get only recent posts newer than a certain post ID?”
Tell an agent
Search the past week's posts for {query}.
Find recent posts matching {query} newer than {since_id}.
DELETE /2/tweets/{id} Delete a post · Delete Posts #
Ask an LLM
“How can I delete one of my posts?”
“Is deleting a post through the API permanent?”
Tell an agent destructive · confirm first
Delete post {id}.
Remove my post {id}.
GET /2/tweets/{id} Get a single post · Get Posts by ID #
Ask an LLM
“Can I retrieve one post and its metrics from its ID?”
“Can I include the author's profile when fetching a single post?”
Tell an agent
Get post {id}.
Show post {id} with fields {fields}.
GET /2/tweets/{id}/liking_users See who liked a post · Get Posts Liking Users #
Ask an LLM
“Who liked a particular post?”
“Can I page through every user who liked a post?”
Tell an agent
List the users who liked post {id}.
Show {max_results} accounts that liked {id}.
GET /2/tweets/{id}/quote_tweets Get quote posts of a post · Get Posts Quoted Posts #
Ask an LLM
“What are people saying when they quote a specific post?”
“Can I exclude certain kinds of posts when listing quote posts?”
Tell an agent
Show the quote posts of {id}.
List quotes of post {id} excluding {exclude}.
GET /2/tweets/{id}/retweeted_by See who reposted a post · Get Posts Reposted by #
Ask an LLM
“Which users reposted a given post?”
“Can I get the accounts that shared a post with a repost?”
Tell an agent
List the users who reposted post {id}.
Show {max_results} accounts that reposted {id}.
GET /2/tweets/{id}/retweets Get the repost objects of a post · Get Posts Reposts #
Ask an LLM
“Can I retrieve the actual repost posts of a post rather than just the users?”
“What media and poll details come with a post's reposts?”
Tell an agent
Get the repost posts of {id}.
Fetch {max_results} repost entries for post {id} with their media.
PUT /2/tweets/{tweet_id}/hidden Hide or unhide a reply · Hide reply #
Ask an LLM
“How do I hide an abusive reply to one of my conversations?”
“Can I unhide a reply I hid earlier?”
Tell an agent
Hide reply {tweet_id}.
Set hidden to {hidden} on reply {tweet_id}.
POST /tweets Create a post (unversioned endpoint) · Create a new post #
Ask an LLM
“Is there an older unversioned /tweets route for creating a post?”
“What does the legacy non-/2 create-post endpoint do?”
Tell an agent
Create a new post using the unversioned /tweets endpoint.
Publish a post through the legacy create-post route.
GET /tweets/search/all Full-archive search (unversioned endpoint) · Full-archive search of posts #
Ask an LLM
“Is there a legacy non-/2 route for full-archive post search?”
“Which unversioned endpoint runs a full-archive search?”
Tell an agent
Run a full-archive search for {query} on the unversioned endpoint.
Use the legacy /tweets/search/all route to search {query}.
GET /tweets/search/stream Connect to the filtered stream (unversioned) · Near real-time filtered stream of posts #
Ask an LLM
“Is there an unversioned route for the near real-time filtered stream?”
“Where does the legacy non-/2 filtered stream connect?”
Tell an agent
Connect to the filtered stream on the unversioned endpoint.
Open the legacy /tweets/search/stream connection.
POST /tweets/search/stream/rules Add or delete stream rules (unversioned) · Add or delete rules for the filtered stream #
Ask an LLM
“Is there an unversioned route to add or remove filtered stream rules?”
“What does the legacy non-/2 stream rules POST change?”
Tell an agent
Update my filtered stream rules through the unversioned endpoint.
Add or delete rules via the legacy /tweets/search/stream/rules POST.
GET /tweets/search/stream/rules List filtered stream rules (unversioned) · List the active rules for the filtered stream #
Ask an LLM
“Which legacy unversioned route lists my active filtered stream rules?”
“Can I read my stream rules without the /2 prefix?”
Tell an agent
List my active filtered stream rules from the unversioned endpoint.
Show stream rules using the legacy /tweets/search/stream/rules route.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/x:x-posts-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

x-posts-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: X Posts API
  version: '1.0'
  description: 'Operations tagged Posts across 2 of this provider''s published API definitions: x-api-v2-openapi.json, x-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- description: X API
  url: https://api.x.com
- url: https://api.x.com/2
  description: X API v2 production server
tags:


# --- truncated at 32 KB (106 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/x/refs/heads/main/openapi/x-posts-api-openapi.yml