Timeline & DMs
Twitter DM API for message history & CRM sync
Read participant-scoped Twitter DMs with a connected account. Store private message rows, preserve sender and recipient IDs, and resume pages with next_cursor.
- 200
- 400
- 401
- 402
- 403
- 404
- 424
- 429
- 502
GET
Twitter DM API for message history & CRM sync
1 credit per result returned · All plans from $0.00012/credit
account. Store message IDs and
next_cursor in private systems. Keep full message text private. Use
Send DM when the workflow needs a reply.
Compare fields with X’s Direct Messages lookup guide.
Xquik returns the normalized message fields listed below.
Requires a connected X account passed via the
account query parameter. DM history is participant-scoped, so pass the connected account that belongs to the conversation.DM history responses can contain private message text. Store them in a
private support, CRM, warehouse, or agent memory system.
Do not write full DM bodies to shared logs or public artifacts.
Which DM workflow?
Read conversation history
Use
GET /x/dm/{userId}/history with account, then store
messages[].id and next_cursor in a private system.Send text reply
Use
POST /x/dm/{userId}, pass the same
connected account, and store the returned messageId.Send one media item
Use
POST /x/media first, then pass
the returned media ID as the only media_ids item on the DM send.Resolve participant ID
Use
GET /x/users/{id} when a workflow starts
from a handle and needs the numeric userId for history or send calls.dm_history rows. Store
message_id, sender_id, receiver_id, message_text, and created_at.
Also store optional media_url, conversation_user_id, sender_account, and
page_next_cursor for each page. Keep message_text only in private systems.
Use IDs, timestamps, media URLs, and job status in shared logs.
Path parameters
string
required
Target X user ID for the DM conversation (numeric string).
Query parameters
string
required
X handle (without the
@ prefix) of the connected X account used to read the conversation. DM history is participant-scoped, so the account must belong to the conversation. Connect an account on the dashboard before calling this endpoint.string
Pagination cursor. Use the previous response’s
next_cursor to fetch older messages.string
Legacy pagination cursor. Use
cursor for new integrations. When both are present, cursor takes precedence.Headers
string
required
Your API key. You can also authenticate with an OAuth bearer token.
Response
200 OK
object[]
boolean
Reports whether older messages are available.
string
Provides the next-page cursor. Returns an empty string after the final page.
400 Invalid user ID
400 Account required
account query parameter was missing or empty. Pass the handle of a connected X account that participates in the conversation.
401 Unauthenticated
402 Insufficient credits
no_subscription, subscription_inactive, no_credits, and insufficient_credits.
403 DM not permitted
403 Account restricted
403 Account needs reauth
404 Account not found
429 Rate limit exceeded
Retry-After before retrying.
424 Dependency failed
xquik-api-contract: 2026-04-29 to opt in. Default v1 returns 502.
502 X API unavailable
Twitter DM API questions
Can I retrieve DM history?
Yes. CallGET /x/dm/{userId}/history with a participating connected account.
Can I send a reply through this endpoint?
No. Use Send DM. This endpoint reads history only.Does this endpoint create direct message webhooks?
No. It reads participant-scoped history when called. It does not register webhooks.How do I authenticate?
Send an API key or OAuth bearer token.How do I handle a rate limit?
Wait forRetry-After, then retry the same page.
History sync handoff
Use this endpoint when a CRM, support desk, warehouse job, or agent needs participant-scoped DM context before sending a reply.Dedupe imported messages
Store
messages[].id as the external DM ID for CRM notes, support tickets,
warehouse rows, or agent memory.Preserve participants
Store
messages[].senderId and messages[].receiverId with the connected
account so each private conversation stays tied to the correct sender.Resume older pages
Store
next_cursor when has_next_page is true, then pass it as cursor
on the next sync job.Keep media context
Store optional
messages[].mediaUrl with messages[].createdAt when a DM
includes an image, GIF, or video attachment.Related. Direct Message Workflow for
lookup, participant-scoped history sync,
messageId storage, and media
handoff; Get User to resolve the recipient
userId; Send DM to reply from the
connected account; Upload Media when
a reply needs one uploaded mediaId.- 200
- 400
- 401
- 402
- 403
- 404
- 424
- 429
- 502
Twitter DM API for message history & CRM sync