Skip to content

OpenAPI Specification Fresh

The machine-readable API specification for all X API v2 endpoints. This is the same spec that XMCP uses to generate its tools.

ResourceURL
OpenAPI Spec (JSON)https://api.x.com/2/openapi.json
bash
curl https://api.x.com/2/openapi.json -o openapi.json

One spec, two consumers

XMCP fetches this spec at startup and turns each operation into an MCP tool. You can use the very same file directly for code generation, validation, or your own tooling.

What you can do with it

  • Auto-generate API clients in your language of choice
  • Import into Postman to explore and test endpoints visually
  • Feed into custom AI agents as structured API knowledge
  • Validate request/response schemas against the contract

Relationship to XMCP

flowchart LR
    Spec[OpenAPI spec
api.x.com/2/openapi.json] --> XMCP[XMCP loads at startup] Spec --> Gen[Client generators] Spec --> PM[Postman import] Spec --> Agent[Custom agents] XMCP --> Tools[200+ MCP tools]

Because the tools are generated from this spec, the operation names in the Tool Catalog correspond directly to operations defined here. When the spec changes, restart XMCP to regenerate its tools.

Spec source note

The hosted XMCP documentation references the spec at api.x.com. The XMCP server itself fetches the spec from the equivalent api.twitter.com host at startup. Either way, it is the same X API v2 contract.

See also