Skip to content

Create a Worker

POST
/workers/create
curl -X POST https://api.xholic.ai/v1/workers/create \
-H "Authorization: Bearer $XHOLIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Example","voiceMode":"OWN","topicMode":"FOR_YOU","outputCount":8,"scheduleMode":"ON_DEMAND","dryRun":true}'

Create a Worker that writes posts on a schedule or on demand. Call it only when the user asked for this in the conversation; never on your own initiative.

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

PAUSED saves the worker without running it, for when the plan’s active workers are all in use.

string
default: ACTIVE
Allowed values: ACTIVE PAUSED
voiceMode
required

OWN is “My voice”; CREATOR writes in the creators’ style; HYBRID is the user’s voice with the creators’ rhythm.

string
Allowed values: OWN CREATOR HYBRID
creatorXIds

Creator xid values from findWorkerCreators: one for HYBRID unless the user asks for more (up to three), one to three for CREATOR, none for OWN.

Array<string>
default: <= 3 items
instructions

The worker’s brief, broad boundaries only: who it writes for, who speaks, how the account likes to write, the areas it usually writes in, when to mention products and hard bans. Never a thesis, a point of view to push or specific topics to cover.

string
nullable <= 2000 characters
applyAccountRules

Follow the account’s saved writing rules.

boolean
default: true
mirrorProvenPosts

Shape posts on formats that already work in the niche.

boolean
default: true
topicMode
required

FOR_YOU is “For you” (topics from the profile); PRODUCT is “Your products”; CUSTOM_TOPIC is a custom topic; NICHE_TRENDING follows what is trending for its keywords.

string
Allowed values: FOR_YOU PRODUCT CUSTOM_TOPIC NICHE_TRENDING
customTopic

CUSTOM_TOPIC: what to post about. NICHE_TRENDING: one to five comma-separated keywords.

string
nullable <= 500 characters
productIds

PRODUCT only: saved product IDs from getAutomationSetup or getAccountContext.

Array<string>
default: <= 5 items
outputCount
required
Any of:
number
Allowed values: 8
scheduleMode
required
string
Allowed values: ON_DEMAND DAILY WEEKLY
scheduleTimeMinutes

DAILY or WEEKLY: minutes after midnight in the account’s timezone, e.g. 540 for 9:00.

integer
nullable <= 1439
scheduleDayOfWeek

WEEKLY: 0 is Sunday, 6 is Saturday.

integer
nullable <= 6
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

{
"name": "Example",
"voiceMode": "OWN",
"topicMode": "FOR_YOU",
"outputCount": 8,
"scheduleMode": "ON_DEMAND",
"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"
}
}