Skip to main content
The X API uses standard HTTP status codes. Successful requests return 2xx codes; errors return 4xx or 5xx codes with details in the response body.

HTTP status codes

Success codes

Client error codes

Server error codes


Error response format

Error responses include structured details:
Additional fields may be present depending on the error type.

Error types


Partial errors

Some requests can partially succeed. A 200 response may include both data and errors:
This happens when requesting multiple resources and some are unavailable.

Troubleshooting common errors

Check your authentication:
  • Verify you’re using the correct authentication method for the endpoint
  • Ensure credentials haven’t been regenerated
  • Check the Authorization header format
  • For OAuth 1.0a, verify signature calculation
Authentication guide →
Check your access:
  • Verify your app has access to this endpoint
  • Some endpoints require specific enrollment or approval
  • User-context endpoints need appropriate OAuth scopes
  • The resource may be private or protected
Rate limited:
  • Check x-rate-limit-reset header for when to retry
  • Implement exponential backoff
  • Consider caching responses
  • Spread requests across the time window
Rate limits guide →
Fix your request:
  • Validate JSON syntax
  • Check for missing required parameters
  • Verify parameter types (strings vs. numbers)
  • Escape special characters in queries
Check these factors:
  • Protected accounts’ posts are only visible with authorization
  • Deleted posts return 404
  • Some posts are withheld in certain regions
  • Verify search query syntax is correct
Handle reconnection:
  • Implement automatic reconnect with backoff
  • Use recovery features for missed data
  • Check for full-buffer disconnects (client not consuming fast enough)
  • Verify at least one stream rule exists
Streaming guide →

Rate limit headers

Every response includes rate limit information:

Best practices

Check status codes

Always check HTTP status before parsing the response body.

Handle partial errors

Check for errors array even in 200 responses.

Implement retry logic

Use exponential backoff for 429 and 5xx errors.

Log request details

Include request ID and timestamp for debugging.

Getting help

When posting questions about errors, include:
  • The API endpoint URL
  • Request headers (sanitize credentials)
  • Full error response
  • What you expected to happen
  • Steps you’ve tried

Developer Forum

Ask questions and search solutions.

API Status

Check for known issues.