Skip to content

Inbox Initial State

GET/tw-v2/interaction/inbox-initial-state

1 API unit per call · How billing works

Description

Get the initial state of your DM inbox. Returns conversations, messages, user data, and inbox timeline cursors for pagination. Use the returned cursor for polling updates via dm-user-updates endpoint.

Parameters

ParameterDescription
authTokenstringrequiredAccount authentication token (auth_token cookie value)
proxystringoptionalOptional proxy in format 'host:port@user:pass'

Code Examples

const params = new URLSearchParams({
  authToken: 'YOUR_AUTH_TOKEN'
});

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

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

Response

Success Response (200 OK)

200
{
  "conversations": [
    {
      "id": "1234567890-9876543210",
      "type": "ONE_TO_ONE",
      "participants": [
        "1234567890",
        "9876543210"
      ],
      "lastMessageId": "5003095839008393364",
      "lastMessageTime": "2024-08-04T07:00:14.115Z",
      "lastReadMessageId": "5001119709765224649",
      "trusted": true,
      "muted": false,
      "readOnly": false,
      "lowQuality": false,
      "nsfw": false,
      "notificationsDisabled": false
    },
    {
      "id": "9876543210-5555555555",
      "type": "ONE_TO_ONE",
      "participants": [
        "9876543210",
        "5555555555"
      ],
      "lastMessageId": "5007772619049708366",
      "lastMessageTime": "2024-10-10T17:11:43.250Z",
      "lastReadMessageId": "0",
      "trusted": false,
      "muted": false,
      "readOnly": false,
      "lowQuality": true,
      "nsfw": false,
      "notificationsDisabled": false
    }
  ],
  "messages": [
    {
      "id": "9001773380324071094",
      "conversationId": "1234567890-9876543210",
      "senderId": "1234567890",
      "recipientId": "9876543210",
      "text": "Sample post text 69685 for documentation.",
      "createdAt": "2024-08-04T07:00:14.000Z",
      "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "editCount": 0
    },
    {
      "id": "9002107545067596446",
      "conversationId": "1234567890-9876543210",
      "senderId": "9876543210",
      "recipientId": "1234567890",
      "text": "Sample post text 99582 for documentation.",
      "createdAt": "2024-08-04T07:01:30.000Z",
      "requestId": "b2c3d4e5-f6a7-8901-bcde-f90011496206",
      "editCount": 0,
      "replyTo": {
        "messageId": "9005722626798165465",
        "text": "Sample post text 69685 for documentation."
      }
    },
    {
      "id": "9006924863278004687",
      "conversationId": "1234567890-9876543210",
      "senderId": "1234567890",
      "recipientId": "9876543210",
      "text": "Sample post text 84623 for documentation.",
      "createdAt": "2024-08-04T07:05:00.000Z",
      "requestId": "c3d4e5f6-a7b8-9012-cdef-900145354256",
      "editCount": 0,
      "entities": {
        "urls": [
          {
            "url": "https://example.com/link-82642",
            "expandedUrl": "https://x.com/sample_user_78339/media/4444444444444444444",
            "displayUrl": "pic.x.com/example123"
          }
        ],
        "mentions": [],
        "hashtags": []
      },
      "attachment": {
        "type": "photo",
        "photo": {
          "id": "9007928766413753864",
          "url": "https://example.com/media/photo123.jpg",
          "width": 1200,
          "height": 800
        }
      }
    },
    {
      "id": "9001525177757834681",
      "conversationId": "9876543210-5555555555",
      "senderId": "5555555555",
      "recipientId": "9876543210",
      "text": "Sample post text 21652 for documentation.",
      "createdAt": "2024-10-10T17:11:43.000Z",
      "requestId": "d4e5f6a7-b8c9-0123-def1-900162319730",
      "editCount": 0,
      "entities": {
        "urls": [
          {
            "url": "https://example.com/link-11299",
            "expandedUrl": "https://example.com/link-94089",
            "displayUrl": "example.com"
          }
        ],
        "mentions": [],
        "hashtags": []
      }
    }
  ],
  "users": [
    {
      "id": "1234567890",
      "username": "john_doe",
      "name": "Sample User 21747",
      "bio": "Sample description for documentation 73203.",
      "location": "Sample City 459",
      "website": "https://example.com/profile-29900",
      "pinnedTweetIds": [],
      "avatar": "https://example.com/images/sample-avatar-06597.jpg",
      "banner": "https://example.com/images/sample-banner-70273.jpg",
      "profileImageShape": "Circle",
      "verified": false,
      "isBlueVerified": true,
      "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": 1523,
      "followingCount": 892,
      "tweetCount": 456,
      "listedCount": 12,
      "mediaCount": 89,
      "favoritesCount": 3456,
      "createdAt": "2020-01-15T10:30:00.000Z"
    },
    {
      "id": "9876543210",
      "username": "jane_smith",
      "name": "Sample User 93347",
      "bio": "Sample description for documentation 01890.",
      "location": "Sample City 196",
      "website": "https://example.com/profile-24546",
      "pinnedTweetIds": [],
      "avatar": "https://example.com/images/sample-avatar-50289.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": 2341,
      "followingCount": 567,
      "tweetCount": 789,
      "listedCount": 23,
      "mediaCount": 145,
      "favoritesCount": 5678,
      "createdAt": "2019-03-20T14:22:00.000Z"
    }
  ],
  "inboxTimelines": {
    "trusted": {
      "status": "AT_END",
      "min_entry_id": "9001287423245354173"
    },
    "untrusted": {
      "status": "HAS_MORE",
      "min_entry_id": "9002002559038635925"
    },
    "untrustedLowQuality": {
      "status": "HAS_MORE",
      "min_entry_id": "9001584235130441450"
    }
  },
  "cursor": "NEXT_CURSOR",
  "lastSeenEventId": "9001414306093561866"
}