Skip to main content
The API Playground is a local mock server that simulates the full X API v2. Test endpoints, build prototypes, and explore the API without consuming real API credits.

GitHub repository

Source code, releases, and full documentation.

Features

Full API v2 compatibility

All endpoints supported with request validation via OpenAPI specs and realistic error responses.

Interactive web UI

Visual endpoint explorer at http://localhost:8080/playground for testing in the browser.

No credits needed

Everything runs locally with mock data — no API keys or billing required.

Stateful operations

In-memory state with optional file persistence. Create posts, then look them up.

Installation

Requires Go 1.21+. Install from source or download a pre-built binary from releases.
go install github.com/xdevplatform/playground/cmd/playground@latest
playground start
The server starts at http://localhost:8080 by default.

Quick start

Make requests just like you would to the real API — use test_token as your bearer token:
# Look up a user
curl -H "Authorization: Bearer test_token" \
  http://localhost:8080/2/users/me

# Create a post
curl -X POST -H "Authorization: Bearer test_token" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello from the playground!"}' \
  http://localhost:8080/2/tweets

# Search posts
curl -H "Authorization: Bearer test_token" \
  "http://localhost:8080/2/tweets/search/recent?query=hello"
Open http://localhost:8080/playground in your browser for the interactive UI.

What’s included

FeatureDescription
Request validationValidates requests against the OpenAPI spec
Realistic errorsReturns proper error codes and messages
Streaming supportSimulated streaming endpoints
Rate limitingConfigurable rate limit simulation
CORS supportWorks with browser-based applications
Usage trackingSimulated billing and credit tracking endpoints
State persistenceOptional file persistence in ~/.playground/

xurl

CLI tool for the real X API with built-in authentication.

Make your first request

Ready for the real API? Make your first request.