Conversation

GET/tw-v2/interaction/conversation

Description

Get messages from a specific DM conversation. Returns conversation details, messages, and user data. Supports pagination with cursor for loading message history.

Parameters

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')
cursorstringoptionalPagination cursor for loading older messages. Obtained from previous response.
proxystringoptionalOptional proxy in format 'host:port@user:pass'

Code Examples

const params = new URLSearchParams({
  authToken: 'YOUR_AUTH_TOKEN',
  conversationId: '123456789-987654321'
});

const response = await fetch(`https://api.tweetapi.com/tw-v2/interaction/conversation?${params}`, {
  method: 'GET',
  headers: {
    'X-API-Key': 'YOUR_API_KEY'
  }
});

const data = await response.json();
console.log(data);

Response

Success Response (200 OK)

200
{
  "messages": [
    {
      "id": "5000000000000000001",
      "conversationId": "1000000000000000001-1000000000000000002",
      "senderId": "1000000000000000002",
      "recipientId": "1000000000000000001",
      "text": "Hi, how are you doing?",
      "createdAt": "2024-01-25T10:00:00.000Z",
      "requestId": "00000000-0000-0000-0000-000000000004",
      "editCount": 0
    },
    {
      "id": "5000000000000000002",
      "conversationId": "1000000000000000001-1000000000000000002",
      "senderId": "1000000000000000002",
      "recipientId": "1000000000000000001",
      "text": "Look at this image, so cool, right? https://t.co/example456",
      "createdAt": "2024-01-25T10:15:00.000Z",
      "requestId": "00000000-0000-0000-0000-000000000005",
      "editCount": 0,
      "entities": {
        "urls": [
          {
            "url": "https://t.co/example456",
            "expandedUrl": "https://x.com/messages/media/5000000000000000002",
            "displayUrl": "pic.x.com/example456"
          }
        ],
        "mentions": [],
        "hashtags": []
      },
      "attachment": {
        "type": "photo",
        "photo": {
          "id": "5000000000000000003",
          "url": "https://example.com/dm/photo.jpg",
          "width": 800,
          "height": 600
        }
      }
    }
  ],
  "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"
    }
  ],
  "conversationInfo": {
    "id": "1000000000000000001-1000000000000000002",
    "type": "ONE_TO_ONE",
    "participants": [
      "1000000000000000001",
      "1000000000000000002"
    ],
    "lastMessageId": "5000000000000000002",
    "lastMessageTime": "2024-01-25T10:15:00.000Z",
    "lastReadMessageId": "5000000000000000002",
    "trusted": true,
    "muted": false,
    "readOnly": false,
    "lowQuality": false,
    "nsfw": false,
    "notificationsDisabled": false
  },
  "hasMore": false
}

API Playground

GET/tw-v2/interaction/conversation

Sensitive Credentials Required

Requires your Twitter authToken. Use a test account.

Press ⌘ + Enter to execute

curl -X GET "https://api.tweetapi.com/tw-v2/interaction/conversation" \
  -H "X-API-Key: YOUR_API_KEY"
Response

Click "Try It!" to see the response