Authentication
DM endpoints require user authentication to access private conversations:Required scopes (OAuth 2.0)
Conversation types
One-to-one
Always has exactly two participants. Conversation ID format:
{smaller_user_id}-{larger_user_id}Group
Two or more participants. Membership can change over time.
Event types
Example events
MessageCreate
MessageCreate
ParticipantsJoin
ParticipantsJoin
ParticipantsLeave
ParticipantsLeave
Fields and expansions
Default fields
Available fields
Available expansions
Example with expansions
cURL
Pagination
DM events are returned in reverse chronological order (newest first):cURL
Events from up to 30 days ago are available.
ID compatibility with v1.1
Conversation and event IDs are shared between v1.1 and v2 endpoints. This means you can:- Use v2 to retrieve events, then use v1.1 to delete specific messages
- Reference conversation IDs from x.com URLs in API requests
Next steps
Quickstart
Make your first DM lookup request
Send DMs
Send Direct Messages
API Reference
Full endpoint documentation
Sample code
Working code examples