Manage Direct Messages standard to Twitter API v2

Comparing v1.1 and v2 Manage Direct Message endpoints

Both v1.1 and v2 versions of the Direct Messages endpoints provide methods for creating Direct Message messages. This guide is intended to help understand the differences and provide information for migrating to v2. 

A major difference between the two versions is that v1.1 supports only one-to-one conversations, while v2 introduces support for group conversations. One artifact of this is that v1.1 supports only "message created" events, while v2 also supports events associated with participants joining and leaving conversations. In fact, a fundamental v2 update is establishing dm_conversations as a core API object.   

With v1.1. there are two endpoints for managing Direct Messages:

With this v2 release, there are three POST methods for creating Direct Messages: 

  • POST /2/dm_conversations/with/:participant_id/messages - Creates a one-to-one Direct Message. This method either adds the message to an existing one-to-one conversation or creates a new one. The :participant_id path parameter is the User ID of the account receiving the message. 

  • POST /2/dm_conversations - Creates a new group conversation and adds a Direct Message to it. These requests require a list of conversation participants. Note that you can create multiple conversations with the same participant list. These requests will always return a new conversation ID. 

  • POST /2/dm_conversations/:dm_conversation_id/messages - Creates a Direct Message and adds it to an existing conversation. The :dm_conversation_id path parameter is the ID of the conversation that the message will be added to. 

An important detail is that conversation and event IDs are shared across v1.1 and v2 versions of the X Platform. This means both versions can be used together. For example, the Direct Messages v1.1 endpoints provide methods for returning a single event and for deleting events, methods not yet available with v2. Since IDs are common across v1.1 and v2, you can make v1.1 requests based on IDs provided by v2, or by referencing conversation IDs displayed in conversation URLs on the X application.

The following table compares fundamental aspects of the v1.1 and v2 manage Direct Messages endpoints. The X API v2 characteristics shared here are common to all of the Direct Message lookup endpoints.

 

Description Standard v1.1 X API v2
Host domain https://api.x.com https://api.x.com
Endpoint root path /1.1/direct_messages

/2/dm_conversations

Direct Messages conversations are introduced as a fundamental API object. 

These endpoints retrieve MessageCreate, ParticipantsJoin, and ParticipantLeave events.

HTTP methods supported POST POST
Supports Group Direct Messages  
Event types supported message_create MessageCreate, ParticipantsJoin, ParticipantsLeave
Authentication OAuth 1.0a User Context

OAuth 1.0a User Context

OAuth 2 User Context (scopes: dm.read, dm.write)

Requires the use of credentials from a developer App associated with a X API v2 Project  
Default request rate limits*
*All requests require user tokens
1000 requests per user per 24 hours
15000 requests per app per 24 hours

200 requests per 15 minutes per user

1000 requests per user per 24 hours

15000 requests per app per 24 hours

These rate limits are shared across all dm_conversations POST endpoints.

The following tables compare the v2 POST methods with version v1.1. Note that these v2 offerings expand the available capabilities by supporting group conversations. 

Create a new one-to-one Direct Message

Path: POST /2/dm_conversations/with/:participant_id/messages

Description Standard v1.1 X API v2
Endpoint path

POST direct_messages/events/new (message_create)

POST /2/dm_conversations/with/:participant_id/messages
Default request rate limits 1000 requests per user per 24 hours
15000 requests per app per 24 hours

200 requests per 15 minutes per user

1000 requests per user per 24 hours

15000 requests per app per 24 hours

These rate limits are shared across all dm_conversations POST endpoints. 

Supports group Direct Messages

 

Create a new Direct Message group conversation and add a message to it

Path: POST /2/dm_conversations

Description Standard v1.1 X API v2
Endpoint path

Not supported

POST /2/dm_conversations
Default request rate limits  

200 requests per 15 minutes per user

1000 requests per user per 24 hours

15000 requests per app per 24 hours

These rate limits are shared across all dm_conversations POST endpoints. 

Supports group Direct Messages

 

Add a Direct Message to an existing conversation by ID

Path: POST /2/dm_conversations/:dm_conversation_id/messages

Description Standard v1.1 X API v2
Endpoint path

Not supported

POST /2/dm_conversations/:dm_conversation_id/messages
Default request rate limits  

200 requests per 15 minutes per user

1000 requests per user per 24 hours

15000 requests per app per 24 hours

These rate limits are shared across all dm_conversations POST endpoints. 

Supports group Direct Messages

 

Next steps