Send Message

POST/tw-v2/xchat/send

This endpoint costs 10 request units per call.

Description

Send an end-to-end encrypted direct message via X Chat.

Prerequisite: You must call /xchat/setup first before sending messages.

Request Body

ParameterTypeRequiredDescription
authTokenstringrequiredTwitter authentication token (auth_token cookie value)
recipientIdstringrequiredTwitter/X user ID of the message recipient (numeric string)
messagestringrequiredThe message text to send (max 10,000 characters)
proxystringoptionalProxy 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

400BAD_REQUEST
400BAD_REQUEST
404NOT_FOUND
401UNAUTHORIZED
429TOO_MANY_REQUESTS

API Playground

POST/tw-v2/xchat/send

Sensitive 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