Skip to content
Twexapi
English
Esc
navigateopen⌘Jpreview

Get DM History (XChat v3)

Get DM history via XChat encrypted chat API. Use count for page size (10–200). Set all=true to follow has_more and return every page. Or paginate manually: when has_more is true, pass the oldest message’s sequence_id as before.

POST/v3/twitter/dm-history
Authorization
AuthorizationBearer token · headerrequired
Global API Bearer Token for TwexAPI. Included as: Authorization: Bearer <YOUR_TWEXAPI_KEY>.
Request Body
requiredapplication/json
recipientstringrequired
User id, @handle, conversationId a:b, or group g....
pinstring | any
Identity PIN (default 1234).
default: "1234"
Show properties
Any of:
string
string
any
any
countinteger | any
Max events per page (10–200, default 50).
default: 50
Show properties
Any of:
integer
integer
any
any
allboolean | any
Follow has_more and return every page.
default: false
Show properties
Any of:
boolean
boolean
any
any
beforestring | any
Oldest sequenceId for paging. Pass the previous page's oldest message sequence_id.
Show properties
Any of:
string
string
any
any
cookiestringrequired
The user's own authorized Twitter session credentials or auth_token (BYOC — Bring Your Own Cookie). Stateless proxy execution with zero credential retention. See [Authentication Security](/authentication#write-operations--byoc-bring-your-own-cookie) and [How to get Cookie](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie).
proxystring | any
Optional HTTP proxy. Example: http://username:password@ip:port
Show properties
Any of:
string
string
any
any
Responses
200Conversation messages with pagination info.
codeintegerrequired
Response code
msgstringrequired
Response message
dataDmHistoryV3Data | any
DM history data
Show properties
Any of:
DmHistoryV3Data
conversation_idstringrequired
Conversation id
has_morebooleanrequired
Whether older messages are available
messagesMessageModel[]required
List of message objects
Show properties
Array of MessageModel
idstringrequired
Message ID
textstringrequired
Message text
timestringrequired
Message time
attachmentobject | any
Message attachment
Show properties
Any of:
object
object
any
any
attachmentsobject[] | any
XChat media attachments (v3).
Show properties
Any of:
object[]
Array of object
object
any
any
sequence_idstring | any
XChat sequence id. Use the oldest message's sequence_id as before for pagination.
Show properties
Any of:
string
string
any
any
sender_idstring | any
Sender ID
Show properties
Any of:
string
string
any
any
recipient_idstring | any
Recipient ID
Show properties
Any of:
string
string
any
any
any
any
422Validation Error
detailValidationError[]
Show properties
Array of ValidationError
locstring | integer[]required
Show properties
Array of string | integer
Any of:
string
string
integer
integer
msgstringrequired
typestringrequired
inputany
ctxobject
Interactive ConsolePOST
Interactive Console / Try APIPOST
Live Console
🌐Target Server:https://api.twexapi.io
● Production Ready
✍️
Write Operation Credentials Guide (TwexAPI Key + Twitter Cookie)

1. TwexAPI Platform Key (Bearer Token): Enter under "API Authorization" below for request billing & authentication.

2. Twitter Account Cookie: For write operations (tweet, like, follow, etc.), provide the target Twitter account's Cookie (e.g. auth_token=...; ct0=...) in the cookie field of Request Body below.

🔑API Authorization
📝Request Bodyapplication/json
📡
No Response Yet

Configure parameters in the Request tab and click Send Request below.

Request
curl -X POST "https://api.twexapi.io/v3/twitter/dm-history" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "recipient": "1928096185664843776:1989842918455291904",
  "pin": "1234",
  "count": 50,
  "all": false,
  "before": "2076684837654876160",
  "cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
  "proxy": "http://username:password@ip:port"
}'
Response
{
  "code": 200,
  "msg": "success",
  "data": {
    "conversation_id": "1928096185664843776:1989842918455291904",
    "has_more": true,
    "messages": [
      {
        "id": "1234567890123456789",
        "text": "Hello, how are you?",
        "time": "2024-01-01T12:00:00Z",
        "attachment": {
          "type": "image",
          "url": "https://example.com/image.jpg"
        },
        "attachments": [
          {
            "attachment_id": "cda5ccdd-af53-48a3-bdd1-5039a73aea25",
            "conversation_id": "1928096185664843776:1989842918455291904",
            "filename": "image.jpg",
            "filesize_bytes": 421299,
            "height": 1448,
            "key_version": "3",
            "media_hash_key": "blRIlZCVIO",
            "type": "image",
            "type_name": "IMAGE",
            "width": 1086
          }
        ],
        "sequence_id": "2076661179334979585",
        "sender_id": "1234567890123456789",
        "recipient_id": "1234567890123456789"
      }
    ]
  }
}