Prerequisites
Before installing XDK, ensure you have:- Python 3.8 or higher installed on your system
- pip or uv package manager
- An X developer account with API credentials (see X Developer Portal)
Install XDK
Choose your preferred package manager:The current version is 0.9.0. This SDK is auto-generated from the X API OpenAPI specification.
Verify Installation
Confirm XDK is installed correctly:Get API Credentials
To use XDK, you’ll need credentials from the X Developer Portal. The type of credentials depends on your authentication method:- OAuth 2.0 PKCE (Recommended)
- OAuth 1.0a
- Bearer Token
Best for apps that act on behalf of users with automatic token refresh.Required credentials:
- Client ID
- Client Secret (for confidential clients)
- Redirect URI (configured in your app settings)
- Go to the X Developer Portal
- Create or select your app
- Navigate to “Keys and tokens”
- Find your Client ID under “OAuth 2.0 Client ID”
- For confidential clients, generate a Client Secret
- Configure your Redirect URI in app settings
Environment Setup
Store your credentials securely using environment variables:Initialize the Client
Once installed, you can initialize the XDK client with your preferred authentication method:Next Steps
Quick Start
Follow our guide to post your first tweet
Authentication Guide
Learn more about authentication methods