Docs
Read a conversation

Read a conversation

Messages of one conversation, decrypted, newest first, with a cursor for older messages.

POST/client/dm/conversation

Your account, your proxy, your risk.

Account actions run with the session cookie of your own X account and go out through your own proxy. Use only accounts you control and follow X's rules. Automated posting, following or liking can get the account limited or suspended; that is between you and X. Treat the cookie like a password: it gives full access to the account. Trial keys cannot call these endpoints.

Parameters

  • cookiebody · string · required

    Cookie header of your own logged-in X session. Must contain auth_token, ct0 and twid (your account ID, set by x.com at login); guest_id is used when present.

  • proxybody · string · required

    Your proxy, format http://user:pass@host:port. The requests to X go out through it. Used only for this request.

  • passcodebody · string · required

    Your X Chat passcode, the one you set up for encrypted messages on X. Send it as a string (a number works too, but loses leading zeros), up to 64 characters. It unlocks your chat keys for this request and is not saved. The unlocked keys stay in the server's memory for up to 30 minutes, so follow-up calls need no new unlock.

  • conversation_idbody · string · optional

    ID of the conversation, as returned by /client/dm/inbox. A one-to-one chat has the ID <smaller user ID>:<larger user ID>. Letters, digits, colon, hyphen and underscore, up to 128 characters. Either conversation_id or user_id is required.

  • user_idbody · string · optional

    Numeric ID of the other person (up to 20 digits) for a one-to-one chat. Used when conversation_id is not set.

  • cursorbody · string · optional

    cursor from the previous page (digits only, up to 20) to get older messages. Leave it out for the newest page.

Body parameters are sent as a JSON object with Content-Type: application/json.

Paginated: pass the bottom cursor of one page as cursor to get the next. Each page is one billed call. See Pagination.

Example request

curl -X POST 'https://api.twittrapi.com/client/dm/conversation' \
  --header 'X-API-KEY: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"cookie":"auth_token=...; ct0=...; twid=u%3D...","proxy":"http://user:pass@host:port","passcode":"1234","user_id":"12"}'

Base URL https://api.twittrapi.com, key in the X-API-KEY header. The SDKs do not wrap account actions, so the examples are plain HTTP calls.

Response

{conversation_id, messages, has_more, cursor, message_request_state, undecrypted, events}. messages are newest first; cursor is set when has_more is true. undecrypted lists events the API could not read ({id, sender_id, error}; for example data x.com keeps in your own conversation), events the other decrypted events (read receipts, settings and key changes). Each message: id (sequence ID, also the cursor unit), message_id, conversation_id, sender_id, created_at and expires_at (Unix milliseconds; expires_at only in chats with disappearing messages), type (text, reaction, reaction_removed, edit, deleted, ...), text, verified (the sender's signature was checked) and content (the decrypted message as X's chat library returns it: reactions, replies, attachments). Expired disappearing messages are left out.

Simple format (?format=simple or X-Response-Format: simple): Collection of Message objects {id, senderId, createdAt, expiresAt, type, text, emoji, targetId, replyTo {id, senderId, text}, attachments [{kind, type, filename, filesizeBytes, durationMs, width, height, url, mediaHashKey}], verified}; times are RFC 3339, unknown values null. nextCursor is the cursor for older messages, null on the last page. Schema.

Simple format (format=simple)

{
  "data": [
    {
      "id": "1850000000000005000",
      "senderId": "1850000000000000001",
      "createdAt": "2026-10-13T05:51:56Z",
      "expiresAt": null,
      "type": "text",
      "text": null,
      "emoji": null,
      "targetId": null,
      "replyTo": null,
      "attachments": [
        {
          "kind": "media",
          "type": "gif",
          "filename": "animation.gif",
          "filesizeBytes": 4621823,
          "durationMs": null,
          "width": 450,
          "height": 450,
          "url": null,
          "mediaHashKey": "AbCdEf1234"
        }
      ],
      "verified": true
    },
    {
      "id": "1850000000000004000",
      "senderId": "1850000000000000001",
      "createdAt": "2026-10-13T05:51:49Z",
      "expiresAt": null,
      "type": "text",
      "text": null,
      "emoji": null,
      "targetId": null,
      "replyTo": null,
      "attachments": [
        {
          "kind": "media",
          "type": "image",
          "filename": "photo.jpg",
          "filesizeBytes": 13028,
          "durationMs": null,
          "width": 300,
          "height": 300,
          "url": null,
          "mediaHashKey": "GhIjKl5678"
        }
      ],
      "verified": true
    },
    {
      "id": "1850000000000003000",
      "senderId": "1850000000000000001",
      "createdAt": "2026-10-13T05:51:31Z",
      "expiresAt": null,
      "type": "text",
      "text": "Sounds good, see you later!",
      "emoji": null,
      "targetId": null,
      "replyTo": null,
      "attachments": [],
      "verified": true
    },
    {
      "id": "1850000000000002000",
      "senderId": "1850000000000000001",
      "createdAt": "2026-10-13T05:51:18Z",
      "expiresAt": null,
      "type": "unknown",
      "text": null,
      "emoji": null,
      "targetId": null,
      "replyTo": null,
      "attachments": [],
      "verified": true
    },
    {
      "id": "1850000000000001000",
      "senderId": "1850000000000000002",
      "createdAt": "2026-10-13T05:49:47Z",
      "expiresAt": null,
      "type": "text",
      "text": "Hello!",
      "emoji": null,
      "targetId": null,
      "replyTo": null,
      "attachments": [],
      "verified": false
    }
  ],
  "nextCursor": "1850000000000001000",
  "previousCursor": null,
  "hasNextPage": true
}

In the raw format, field names and nesting come from X and can change without notice. See Response format; the simple format keeps a fixed schema.

Errors

  • 400The body is not valid JSON.
  • 422cookie or proxy is missing, the cookie has no twid or ct0, or the passcode is neither a string nor a whole number or longer than 64 characters. The passcode is missing, neither conversation_id nor user_id is set, user_id is not numeric, conversation_id or cursor has the wrong format. Also: the account is suspended, or X rejected the session ("Twitter temporarily rejected this session; refresh the login and try again").
  • 407The proxy is unreachable or timed out.
  • 422Wrong passcode: "Wrong passcode (N attempts left before X deletes the chat keys)". X deletes the chat keys after too many wrong passcodes, so the API never sends the same wrong passcode to X twice (for 24 hours it answers 422 at once), and once only 3 attempts are left it does not try at all: "Only a few passcode attempts are left for this account; unlock Chat in the X app with the correct passcode first".
  • 422The account has no chat passcode yet: open Chat on x.com once and set one up.
  • 501Encrypted messages are not available on this server (the passcode cannot be used). Refunded.
  • 502The chat keys could not be unlocked ("Could not unlock the chat keys, try again") or the messages could not be decrypted. Refunded.
  • 429X's rate limit for this account: "X rate limit reached for this account, try again later".
  • X'sX refused the request: answered with X's status and {"error": "X refused the request: <X's reason>"}. When X answers 200 with an error, the status is 422.

Errors every endpoint can return (401, 402, 403, 404, 408, 409, 429, 5xx), and which of them are charged, are on the Errors page. Calls that fail with 400, 408, 409 or a 5xx error are refunded.