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.
Back to API Reference
/DM Endpoints
POST
/v3/twitter/dm-historyAuthorization
AuthorizationBearer token · headerrequiredGlobal API Bearer Token for TwexAPI. Included as: Authorization: Bearer <YOUR_TWEXAPI_KEY>.
Request Body
requiredapplication/jsonrecipientstringrequiredUser id, @handle, conversationId a:b, or group g....
pinstring | anyIdentity PIN (default 1234).
default: "1234"
Show propertiesHide properties
Any of:
string
stringany
anycountinteger | anyMax events per page (10–200, default 50).
default: 50
Show propertiesHide properties
Any of:
integer
integerany
anyallboolean | anyFollow has_more and return every page.
default: false
Show propertiesHide properties
Any of:
boolean
booleanany
anybeforestring | anyOldest sequenceId for paging. Pass the previous page's oldest message sequence_id.
Show propertiesHide properties
Any of:
string
stringany
anycookiestringrequiredThe 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 | anyOptional HTTP proxy. Example: http://username:password@ip:port
Show propertiesHide properties
Any of:
string
stringany
anyResponses
200Conversation messages with pagination info.
codeintegerrequiredResponse code
msgstringrequiredResponse message
dataDmHistoryV3Data | anyDM history data
Show propertiesHide properties
Any of:
DmHistoryV3Data
conversation_idstringrequiredConversation id
has_morebooleanrequiredWhether older messages are available
messagesMessageModel[]requiredList of message objects
Show propertiesHide properties
Array of
MessageModelidstringrequiredMessage ID
textstringrequiredMessage text
timestringrequiredMessage time
attachmentobject | anyMessage attachment
Show propertiesHide properties
Any of:
object
objectany
anyattachmentsobject[] | anyXChat media attachments (v3).
Show propertiesHide properties
Any of:
object[]
Array of
objectobjectany
anysequence_idstring | anyXChat sequence id. Use the oldest message's sequence_id as before for pagination.
Show propertiesHide properties
Any of:
string
stringany
anysender_idstring | anySender ID
Show propertiesHide properties
Any of:
string
stringany
anyrecipient_idstring | anyRecipient ID
Show propertiesHide properties
Any of:
string
stringany
anyany
any422Validation Error
detailValidationError[]Show propertiesHide properties
Array of
ValidationErrorlocstring | integer[]requiredShow propertiesHide properties
Array of
string | integerAny of:
string
stringinteger
integermsgstringrequiredtypestringrequiredinputanyctxobject⚡Interactive ConsolePOST
⚡Interactive Console / Try APIPOSTLive 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"
}'const response = await fetch("https://api.twexapi.io/v3/twitter/dm-history", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"recipient": "1928096185664843776:1989842918455291904",
"pin": "1234",
"count": 50,
"all": false,
"before": "2076684837654876160",
"cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
"proxy": "http://username:password@ip:port"
})
});import requests
response = requests.post(
"https://api.twexapi.io/v3/twitter/dm-history",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"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"
}
]
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}