Welcome to XDK Python
XDK Python is an official Python SDK for the X API (v2) that provides a simple, intuitive interface for building applications on X. Built with type safety and modern Python practices, XDK makes it easy to create posts, manage users, search content, and more.Installation
Get started by installing XDK with pip or uv
Quick Start
Post your first tweet in minutes with our guide
API Reference
Explore the complete API documentation
Authentication
Learn about OAuth1, OAuth2 PKCE, and bearer tokens
Key Features
Multiple Authentication Methods
Multiple Authentication Methods
XDK supports three authentication methods to fit your use case:
- OAuth 1.0a: Traditional OAuth flow with consumer keys and access tokens
- OAuth 2.0 PKCE: Modern authorization code flow with automatic token refresh
- Bearer Token: Simple app-only authentication for read operations
Full X API v2 Coverage
Full X API v2 Coverage
Access all X API v2 endpoints organized by resource:
- Posts (tweets) - create, read, search, and manage
- Users - profiles, followers, and relationships
- Direct Messages - send and receive DMs
- Lists, Spaces, Communities, and more
- Streaming - real-time filtered stream
- Media - upload images and videos
Type Safety with Pydantic
Type Safety with Pydantic
All request and response models use Pydantic for:
- Automatic validation of API requests
- Type hints for better IDE support
- Clear error messages for invalid data
- Serialization and deserialization
Automatic Pagination
Automatic Pagination
Many endpoints return iterators that automatically handle pagination:
Quick Example
Here’s a simple example to get you started:The SDK version is 0.9.0. This is a beta release - some features may change before the 1.0 stable release.
Next Steps
Install the SDK
Follow the installation guide to add XDK to your project.
Build your first integration
Follow the quickstart guide to post your first tweet.
Explore the API
Check out the API reference for all available endpoints.