Conversation History
POST
/tw-v2/xchat/historyDescription
Get decrypted conversation history for an end-to-end encrypted X Chat conversation. Returns messages in decrypted plaintext with metadata.
Prerequisite: You must call
/xchat/setupfirst before fetching history.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| authToken | string | required | Twitter authentication token (auth_token cookie value) |
| conversationId | string | required | Conversation ID in format 'userId1:userId2' (both user IDs separated by colon) |
| cursor | string | optional | Pagination cursor from previous response (nextCursor value) |
| limit | number | optional | Maximum number of messages to return (1-200, default: 200) |
| proxy | string | optional | Proxy in format 'hostname:port@username:password' |
Code Examples
const body = {
authToken: 'YOUR_AUTH_TOKEN',
conversationId: '1234567890123456789:9876543210987654321'
};
const response = await fetch('https://api.tweetapi.com/tw-v2/xchat/history', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});
const data = await response.json();
console.log(data);
Pagination Example
// Fetch next page using cursor from previous response
const body = {
authToken: 'YOUR_AUTH_TOKEN',
conversationId: '1234567890123456789:9876543210987654321',
cursor: '2011466279383891968' // nextCursor from previous response
};
const response = await fetch('https://api.tweetapi.com/tw-v2/xchat/history', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});
const data = await response.json();
console.log(data);
Response
Success Response (200 OK)
200
{
"messages": [
{
"id": "2011476201525952514",
"messageId": "72afe3e1-38c7-4b4b-9e45-b55347162a2d",
"senderId": "1234567890123456789",
"text": "Hello!",
"timestamp": 1736847291525,
"conversationKeyVersion": "1768394917884"
},
{
"id": "2011475490973106178",
"messageId": "7b9effa8-5f40-45d8-ba5f-c71ca4852a75",
"senderId": "9876543210987654321",
"text": "Hi, how are you?",
"timestamp": 1736847190973,
"conversationKeyVersion": "1768394917884"
}
],
"hasMore": true,
"nextCursor": "2011475490973106178"
}Response Fields
| Parameter | Type | Required | Description |
|---|---|---|---|
| messages | array | required | Array of decrypted messages |
| messages[].id | string | required | Message sequence ID (used for pagination) |
| messages[].messageId | string | required | Unique message UUID |
| messages[].senderId | string | required | Twitter/X user ID of the message sender |
| messages[].text | string | required | Decrypted message text |
| messages[].timestamp | number | required | Message timestamp in milliseconds |
| hasMore | boolean | required | Whether more messages are available |
| nextCursor | string | null | required | Cursor for fetching the next page (null if no more messages) |
Error Responses
400s Errors
400
BAD_REQUEST400
BAD_REQUEST400
BAD_REQUEST404
NOT_FOUND404
NOT_FOUND401
UNAUTHORIZED429
TOO_MANY_REQUESTSAPI Playground
POST
/tw-v2/xchat/historySensitive Credentials Required
Requires your Twitter authToken. Use a test account.
Press ⌘ + Enter to execute
curl -X POST "https://api.tweetapi.com/tw-v2/xchat/history" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Click "Try It!" to see the response