Skip to main content
The X API supports real-time data via endpoints like the Filtered Stream Endpoint, delivering matching Posts as they occur. This requires making a persistent http connection.

Setup and Basic Streaming

Synchronous

Async

Rule Management

Rules define filters on what specific data you are looking for(e.g. keywords, users etc). You can learn more about how to build rules using this guide Adding Rules:
Deleting Rules:
Listing Rules:
For full rule syntax, see X Streaming Rules Docs.

Troubleshooting

  • 403 Forbidden: Invalid auth or insufficient permissions.
  • 420 Enhance Your Calm: Rate limited; wait and retry.
  • No Data: Check rules with get_rules(); ensure matching Posts exist. For detailed code examples using the Python XDK, check out our code samples GitHub repo. For more examples and API reference, see the inline docstrings (e.g., help(client.tweets.search_recent)) or the generated stubs in the source. Contribute feedback via the GitHub repo.