Skip to content

Find people to DM

POST
/dm/preview-recipients
curl -X POST https://api.xholic.ai/v1/dm/preview-recipients \
-H "Authorization: Bearer $XHOLIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"FROM_TWEET","dryRun":true}'

Find people to message from a post’s repliers, a search, handles, an X list, recent interactions or a contact list, with whether each can be messaged. Returns the recipients (with preview tokens) that send_dms takes.

Media typeapplication/json
object
type
required

Where to find people: FROM_TWEET (repliers/reposters of tweetUrl), SEARCH (query), HANDLES (handles), X_LIST (listUrl or numeric listId), INTERACTIONS (people who replied to or reposted the account in the last days), CONTACT_LIST (listId of a contact list).

string
Allowed values: FROM_TWEET SEARCH HANDLES X_LIST INTERACTIONS CONTACT_LIST
tweetUrl
string format: uri
<= 2048 characters
includeReplies
boolean
includeReposts
boolean
keyword

FROM_TWEET: only replies matching one of these comma-separated terms.

string
nullable <= 120 characters
excludeMessagedForPost
boolean
continuation

FROM_TWEET: the continuation from a previous preview, to scan deeper.

object
key
additional properties
query
string
>= 1 characters <= 80 characters
handles
Array<string>
>= 1 items <= 500 items
listId

X_LIST: numeric X list id. CONTACT_LIST: the contact list id.

string
nullable <= 64 characters
listUrl
string format: uri
nullable <= 2048 characters
days
integer
>= 1 <= 7
skipQueued
boolean
skipCooldown
boolean
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

{
"type": "FROM_TWEET",
"dryRun": true
}

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"
}
}