Step 1: Create a developer account
1
Go to the Developer Console
Visit console.x.com and sign in with your X account.
2
Accept the Developer Agreement
Review and accept the Developer Agreement and Policy.
3
Complete your profile
Provide basic information about how you’ll use the API.
Step 2: Create an app
After signing up, create an app to get your API credentials:1
Click 'New App'
From the Developer Console dashboard, create a new app.
2
Enter app details
Provide a name, description, and use case for your app.
3
Generate credentials
The console will generate your API keys and tokens.
Step 3: Save your credentials
You’ll receive several credentials depending on your authentication needs:Which credentials do you need?
- Reading public data
- Acting as a user
- Acting as yourself
Use the Bearer Token for simple, read-only access to public data.Best for: Searching posts, looking up users, reading trends.
Credential security best practices
Use environment variables
Never hardcode credentials in your source code.
Don't commit to git
Add credential files to
.gitignore.Rotate regularly
Regenerate credentials periodically as a security measure.
Use minimal scopes
Only request the OAuth permissions your app needs.
Next steps
Make your first request
Call the API with your new credentials.
Learn about authentication
Understand OAuth 1.0a and OAuth 2.0.