Send Message
POST
/tw-v2/xchat/sendThis endpoint costs 10 request units per call.
Description
Send an end-to-end encrypted direct message via X Chat.
Prerequisite: You must call
/xchat/setupfirst before sending messages.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| authToken | string | required | Twitter authentication token (auth_token cookie value) |
| recipientId | string | required | Twitter/X user ID of the message recipient (numeric string) |
| message | string | required | The message text to send (max 10,000 characters) |
| proxy | string | optional | Proxy in format 'hostname:port@username:password' |
Code Examples
const body = {
authToken: 'YOUR_AUTH_TOKEN',
recipientId: '9876543210987654321',
message: 'Hello! This is an encrypted message.'
};
const response = await fetch('https://api.tweetapi.com/tw-v2/xchat/send', {
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
{
"messageId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"conversationId": "1234567890123456789:9876543210987654321",
"timestamp": 1768479256916,
"status": "sent",
"recipientId": "9876543210987654321",
"mode": "e2e"
}Error Responses
400s Errors
400
BAD_REQUEST400
BAD_REQUEST404
NOT_FOUND401
UNAUTHORIZED429
TOO_MANY_REQUESTSAPI Playground
POST
/tw-v2/xchat/sendSensitive Credentials Required
Requires your Twitter authToken. Use a test account.
Press ⌘ + Enter to execute
curl -X POST "https://api.tweetapi.com/tw-v2/xchat/send" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Click "Try It!" to see the response