Send Dm

POST/tw-v2/interaction/send-dm

Description

Send a direct message to a Twitter user with optional media attachment. Supports images, GIFs, and videos with automatic type detection and processing. Maximum 1 media item per DM.

Request Body

ParameterTypeRequiredDescription
authTokenstringrequiredTwitter authentication token (auth_token cookie value)
conversationIdstringrequiredConversation ID. For 1-on-1 conversations: 'userId1-userId2' (e.g., '123456789-987654321'). For group conversations: single conversation ID (e.g., '1234567890')
textstringrequiredThe text content of the direct message (max 10,000 characters)
requestIdstringoptionalOptional UUID for request tracking. Auto-generated if not provided.
mediaarrayoptionalOptional array with 1 media object. Can be {url: string} or {data: string, type: string}
proxystringrequiredProxy in format 'hostname:port@username:password' (required for better success rates)

Code Examples

const body = {
  authToken: 'YOUR_AUTH_TOKEN',
  conversationId: '123456789-987654321',
  text: 'Hello! This is a test DM.',
  media: [{"url":"https://example.com/image.jpg"}]
};

const response = await fetch('https://api.tweetapi.com/tw-v2/interaction/send-dm', {
  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
{
  "message": {
    "id": "7000000000000000001",
    "conversationId": "1000000000000000001-1000000000000000002",
    "senderId": "1000000000000000001",
    "recipientId": "1000000000000000002",
    "text": "Hello! This is a test message.",
    "createdAt": "2024-02-01T14:00:00.000Z",
    "requestId": "00000000-0000-0000-0000-000000000008",
    "editCount": 0
  },
  "users": [
    {
      "id": "1000000000000000001",
      "username": "user_one",
      "name": "User One",
      "bio": "Sample bio for user one",
      "location": null,
      "website": null,
      "pinnedTweetIds": [],
      "avatar": "https://example.com/avatar1.jpg",
      "banner": null,
      "profileImageShape": null,
      "verified": false,
      "isBlueVerified": false,
      "verifiedType": null,
      "verifiedSince": null,
      "isIdentityVerified": false,
      "isProtected": false,
      "possiblySensitive": false,
      "profileInterstitialType": null,
      "withheldInCountries": [],
      "professional": null,
      "businessAccount": null,
      "creatorSubscriptionsCount": 0,
      "hasHiddenSubscriptions": false,
      "highlightsInfo": null,
      "hasGraduatedAccess": false,
      "isProfileTranslatable": false,
      "hasCustomTimelines": false,
      "isTranslator": false,
      "affiliatesHighlightedLabel": null,
      "defaultProfile": false,
      "defaultProfileImage": false,
      "followerCount": 100,
      "followingCount": 50,
      "tweetCount": 0,
      "listedCount": 0,
      "mediaCount": 0,
      "favoritesCount": 0,
      "createdAt": "2020-01-01T00:00:00.000Z"
    },
    {
      "id": "1000000000000000002",
      "username": "user_two",
      "name": "User Two",
      "bio": "Sample bio for user two",
      "location": null,
      "website": null,
      "pinnedTweetIds": [],
      "avatar": "https://example.com/avatar2.jpg",
      "banner": null,
      "profileImageShape": null,
      "verified": false,
      "isBlueVerified": false,
      "verifiedType": null,
      "verifiedSince": null,
      "isIdentityVerified": false,
      "isProtected": false,
      "possiblySensitive": false,
      "profileInterstitialType": null,
      "withheldInCountries": [],
      "professional": null,
      "businessAccount": null,
      "creatorSubscriptionsCount": 0,
      "hasHiddenSubscriptions": false,
      "highlightsInfo": null,
      "hasGraduatedAccess": false,
      "isProfileTranslatable": false,
      "hasCustomTimelines": false,
      "isTranslator": false,
      "affiliatesHighlightedLabel": null,
      "defaultProfile": false,
      "defaultProfileImage": false,
      "followerCount": 200,
      "followingCount": 150,
      "tweetCount": 0,
      "listedCount": 0,
      "mediaCount": 0,
      "favoritesCount": 0,
      "createdAt": "2020-02-01T00:00:00.000Z"
    }
  ]
}

API Playground

POST/tw-v2/interaction/send-dm

Sensitive Credentials Required

Requires your Twitter authToken. Use a test account.

Press ⌘ + Enter to execute

curl -X POST "https://api.tweetapi.com/tw-v2/interaction/send-dm" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"
Response

Click "Try It!" to see the response