API key format
Account and guest keys follow this format:- Prefix.
xq_ - Body. 64 hexadecimal characters
- Storage. Keep each REST API key in a secret manager. Never log or commit it.
Using your API key
Send account API requests with thex-api-key request header:
xq_ value remains an Xquik API
key. OAuth 2.1 access tokens omit the xq_ prefix.
Auth methods by endpoint
This access control matrix maps each API endpoint to its accepted method. Most routes accept an API key or dashboard session cookie.API key only
GET /account accepts x-api-key. Use it to check plan, credit balance, and monitor billing from server-side integrations.Session cookie only
POST /api-keys, GET /api-keys, and DELETE /api-keys/{id} require a dashboard session cookie. The session identifies the authenticated user.Account and billing
PATCH /account, PUT /account/x-identity, and POST /subscribe accept either x-api-key or a dashboard session cookie.Events and webhooks
* /monitors/*, GET /events/*, * /webhooks/*, and GET /webhooks/{id}/deliveries accept either auth method.Tweets, exports, and X actions
* /draws/*, * /extractions/*, * /x/*, POST /x/media/download, * /x-accounts/*, and * /x-write/* accept either auth method.Content tools and support
GET /trends, GET /radar, * /styles/*, * /drafts/*, POST /compose, and * /support/* accept either auth method.Guest paid reads
A guest key has scope
paid_reads. It authenticates only the 33 prepaid GET routes plus guest status and top-up. It never grants account, write, automation, account credential, or OAuth access.API key creation, listing, and revocation require a same-origin dashboard
session. API keys and OAuth bearer tokens cannot manage API keys.
The MCP server also supports OAuth 2.1 with PKCE for browser-based clients.
See OAuth 2.1 for current client compatibility and setup.
Accountless guest keys
After the user confirms 250 USD,POST /api/v1/guest-wallets returns
a one-use hosted checkout, a guest key, and a status URL without charging.
The guest key remains inactive for paid reads until payment is verified. It can authenticate GET /api/v1/guest-wallets/status while pending. Once active, it can call exactly the 33 eligible paid-read routes.
Guest credential routes are direct REST only. The API MCP server never exposes wallet creation, status, or top-up as executable operations. See Accountless guest wallets for the complete flow.
Machine Payments Protocol
Seven fixed-price reads also accept direct MPP payments. This replaces API key authentication for those reads. Without credentials, the API server returns a 402 payment challenge.Challenge header
Credential header
After completing the payment, retry the request with a payment credential:Receipt header
Settled responses include a receipt:Eligible endpoints
See the MPP overview for all 7 direct MPP operations and fixed prices.The 26 non-MPP paid reads return
401 with WWW-Authenticate: Bearer and the optional guest wallet action. The 7 direct MPP operations return 402 with WWW-Authenticate: Payment and the same guest action. A failed read never creates checkout.Key management
Create a key
Generate keys from the API Keys page in your dashboard or via the API (session auth only):Create API Key
fullKey) is returned once in the creation response. Store it securely.
Revoke a key
Revoke API Key
Error response
Invalid or missing API key returns:401 Unauthorized
The API blocks unauthorized access. Replace the credential before retrying API
access.
Security best practices
Apply these API security controls to every environment.Store keys in environment variables
Store keys in environment variables
Never hardcode API keys in your source code. Use environment variables to keep keys separate from your codebase:Access the key in your application:
.env
Never commit keys to version control
Never commit keys to version control
Add If a key is accidentally committed, revoke it immediately from your dashboard and generate a new one. Consider the exposed key compromised even if you force-push to remove it from history.
.env to your .gitignore to prevent accidental commits:.gitignore
Rotate keys regularly
Rotate keys regularly
Rotate API keys periodically to limit the impact of a potential leak:
- Create a new key from the dashboard
- Update the key in all your environments
- Verify all services work with the new key
- Revoke the old key
Use separate keys for development & production
Use separate keys for development & production
Create distinct API keys for each environment. This limits blast radius if a development key is compromised and records usage per environment:Name your keys descriptively (e.g., “Production - Backend”, “Staging”, “Local Dev”) so you can identify them in the dashboard.
.env.local
.env.production
Next steps. Quickstart for a complete setup walkthrough, or OAuth Overview for OAuth 2.1 integration.