auth_token account.
X’s encrypted chats (XChat) are end-to-end encrypted, so reading or signing
those messages needs one extra credential beyond your auth_token.
The two credentials
auth_token
The X account the action runs as (same as every other endpoint).
encryption_code
Your XChat PIN — the code you set when enabling encrypted chats on X. Used to
recover your key so messages can be decrypted and outgoing events signed.
When is
encryption_code required? For anything that touches encrypted content:
reading a conversation, reacting, editing, deleting, and sending media. It’s
optional on the inbox (provide it to also get a preview of each conversation’s
most recent message) and optional on send (provide it to send an encrypted message
instead of a standard one).Every DM endpoint also accepts an optional
proxy to route the call through your
own proxy. See Authentication.Key concepts
Encrypted vs legacy send
POST /dm/send has two modes:
- Encrypted — supply
encryption_code(with aconversation_id). The message is end-to-end encrypted and can later be deleted for everyone (delete_for_all). - Legacy — omit
encryption_code. Uses X’s reliable delivery path, but such messages can only be removed from your own view (delete_for_all: false).
Typical flow
1
List conversations
GET /dm/list (with encryption_code for last-message previews) → pick a conversation_id.2
Read the history
POST /dm/conversation → the conversation’s messages, each with a seq_id. Edited messages show their latest text and reactions are attached to the message they apply to.3
Act on it
POST /dm/send to reply, POST /dm/send_media to attach a file, or POST /dm/react / POST /dm/edit / POST /dm/delete targeting a seq_id.