Skip to content

Send DMs now

POST
/dm/quick-send
curl -X POST https://api.xholic.ai/v1/dm/quick-send \
-H "Authorization: Bearer $XHOLIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"messageTemplate":"<messageTemplate>","confirmedConsent":true,"recipients":[{"creatorId":"<creatorId>","sourceType":"FROM_TWEET","previewToken":"<previewToken>"}],"dryRun":true,"idempotencyKey":"my-unique-key-1"}'

Send one message to up to 500 people found with dm.preview_recipients, paced safely from the user’s X account. Write the message yourself; variables like [first] personalise it. Only pass confirmedConsent true after the user confirmed these people agreed to or expect the message. Call it only when the user asked for this in the conversation; never on your own initiative.

Media typeapplication/json
object
name
string
nullable >= 1 characters <= 80 characters
messageTemplate
required

The message. Variables: [first], [name], [handle], [location], [followers], list fields such as [first_line], with optional fallbacks like [first|there]; spintax like {Hi|Hey}. Write it yourself in the user’s voice.

string
>= 1 characters <= 5000 characters
confirmedConsent
required
boolean
recipients
required

Recipients exactly as dm.preview_recipients returned them.

Array<object>
>= 1 items <= 500 items
object
creatorId
required

The person’s numeric X user id.

string
/^\d{1,24}$/
sourceType
required
string
Allowed values: FROM_TWEET SEARCH HANDLES X_LIST INTERACTIONS CONTACT_LIST FOLLOWERS FOLLOWING KEYWORD_POSTERS LIST_FOLLOWERS CSV
sourceReference
string
nullable <= 2048 characters
previewToken
required
string
>= 1 characters <= 256 characters
account

X account to act on, as @handle. Leave it out to use the connection’s default account.

string
>= 1 characters <= 64 characters
dryRun

Return exactly what would happen without doing it.

boolean
idempotencyKey

A unique key for this write. Repeating a call with the same key returns the first result instead of acting twice.

string
>= 8 characters <= 200 characters

Example

{
"messageTemplate": "<messageTemplate>",
"confirmedConsent": true,
"recipients": [
{
"creatorId": "<creatorId>",
"sourceType": "FROM_TWEET",
"previewToken": "<previewToken>"
}
],
"dryRun": true,
"idempotencyKey": "my-unique-key-1"
}

Success

Media typeapplication/json
object
ok
required
boolean
summary
required

One or two readable sentences about the result.

string
data
required

The result. Its shape depends on the action.

ids
object
key
additional properties
any
next
Array<string>
creditsCharged
number
dryRun
boolean

Example

{
"ok": true
}

Error

Media typeapplication/json
object
ok
required
boolean
error
required
object
code
required
string
Allowed values: UNAUTHENTICATED INVALID_CREDENTIAL SCOPE_MISSING ROLE_NOT_PERMITTED ACCOUNT_NOT_FOUND SUBSCRIPTION_REQUIRED FEATURE_NOT_INCLUDED APP_ONLY INVALID_INPUT NOT_FOUND CONFLICT CREDITS_CONFIRMATION_REQUIRED INSUFFICIENT_CREDITS RATE_LIMITED IDEMPOTENCY_KEY_REUSED IDEMPOTENCY_IN_PROGRESS X_DATA_LIMIT_REACHED UPSTREAM_UNAVAILABLE INTERNAL_ERROR
message
required
string
scope
required
string
Allowed values: account platform
retryAfterSeconds
integer
details

Example

{
"ok": false,
"error": {
"code": "UNAUTHENTICATED",
"scope": "account"
}
}