Skip to content

API reference

Send a direct message

dm_send — Send exactly this text as a DM, into an existing conversation (thread_id from inbox_list_threads) or to a person by @handle, optionally with one image / GIF / video from media_create_upload (X Chat, a

dm_send · Write on X (creates a job)

Send exactly this text as a DM, into an existing conversation (thread_id from inbox_list_threads) or to a person by @handle, optionally with one image / GIF / video from media_create_upload (X Chat, agent 1.13.0+). Waits when X Chat is locked and its passcode is not saved. Counts against DM (new / reply).

REST POST /api/public/v1/accounts/{account}/actions/dm
MCP tool dm_send
Permission needed inbox.reply — Owner, Manager, Operator
Scope group inbox:send
Group Actions on X
Shown up front in profiles Operate X accounts

Input

Field Type Required Description
account string (1–100 chars) Yes The X account to use: its X-Buddy account_id (from account_list) or its @handle. Ambiguous names return candidates instead of guessing.
thread_id string (uuid) No X-Buddy conversation id (inbox_list_threads).
person string (1–60 chars) No Start or continue a conversation with this person.
text string (1–10000 chars) Yes Message text, sent as is.
media_ids array of string (0–500 chars) (0–1 items) No At most one attachment: a media_id returned by media_create_upload.

Result

Creates a job for the X account's VPS. REST waits up to wait seconds (default 15, max 20): when done it returns 200 with the result, otherwise 202 with Location: /api/public/v1/jobs/{job_id}. The final status is succeeded, failed, cancelled or unknown.

Needs an idempotency key (Idempotency-Key, 8–128 characters). Retrying with the same key never repeats the action.

This deletes data or can't be undone. Ask the person before calling it.

A job that ends unknown may already have happened on X: never resend it with a new idempotency key.

Example

Call over REST

curl -X POST "https://reach-link-craft.lovable.app/api/public/v1/accounts/%40your_x_account/actions/dm" \
  -H "Authorization: Bearer $XBUDDY_API_KEY" \
  -H "Idempotency-Key: 6f1c2a90-example-key" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello from X-Buddy"}'

Call over MCP

{
  "method": "tools/call",
  "params": {
    "name": "dm_send",
    "arguments": {
      "account": "@your_x_account",
      "text": "Hello from X-Buddy",
      "idempotency_key": "6f1c2a90-example-key"
    }
  }
}

Errors you may get

Back to all operations