DM
DM List
Fetch direct messages for a user
POST /twitter/dm/list
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
auth_token | string | Yes | User's auth token |
cursor | string | No | Pagination cursor |
count | number | No | Number of messages to fetch (default 50) |
Notes
- Fetches the user's direct messages.
- Pagination uses
next_cursoruntilhas_moreis false.
Response (200)
{
"userId": "1858475867762270208",
"message_count": 3,
"has_more": false,
"next_cursor": null,
"messages": [
{
"id": "2019082334717518331",
"createdAt": "2026-02-04T16:15:15.989Z",
"senderId": "1858475867762270208",
"recipientId": "1345154135381794816",
"text": "Hello from API test!",
"media": null
}
]
}Error Responses
400 - Missing auth_token
{
"error": "Missing required field: auth_token"
}401 - Invalid auth_token
{
"error": "Invalid auth_token - could not extract userId"
}Example
curl -X POST "https://api.getxapi.com/twitter/dm/list" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token"
}'
# With pagination
curl -X POST "https://api.getxapi.com/twitter/dm/list" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token",
"cursor": "DAABCgABG...",
"count": 50
}'