Use this file to discover all available pages before exploring further.
1 credit per result returned · All plans from $0.00012/credit
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.
The examples normalize each page into private dm_history rows. Store
message_id, sender_id, receiver_id, message_text, created_at,
optional media_url, conversation_user_id, sender_account, and
page_next_cursor. Keep message_text only in private systems; use the IDs,
timestamp, media URL, and job status in shared logs.
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.
{ "error": "account_required", "message": "Provide ?account=<x_handle> for a connected X account. DM history requires a connected participant account." }
The account query parameter was missing or empty. Pass the handle of a connected X account that participates in the conversation.
{ "error": "unauthenticated" }
Missing or invalid API key.
{ "error": "no_subscription" }
No active subscription or insufficient credits. Possible error values: no_subscription, subscription_inactive, no_credits, insufficient_credits.
{ "error": "dm_not_permitted", "message": "X rejected the DM read. The connected account is not a participant in this conversation, or it needs reauthentication. Reconnect the account on the dashboard and try again." }
X rejected the DM read. The connected account is not a participant in this conversation, or it needs reauthentication. Reconnect the account and retry.
{ "error": "account_restricted" }
The connected X account is suspended, locked, or otherwise restricted. Use a different connected account.
{ "error": "account_needs_reauth" }
The connected account needs to be reauthenticated. Reconnect it from the dashboard.
{ "error": "account_not_found" }
The requested connected X account was not found. Connect it first or pass another account handle.
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.