Skip to content

Article AI

POST
/articles/ai-run
curl -X POST https://api.xholic.ai/v1/articles/ai-run \
-H "Authorization: Bearer $XHOLIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id":"<id>","kind":"OUTLINE","idempotencyKey":"<idempotencyKey>","dryRun":true}'

Only when the user explicitly asks for Xholic’s article AI. Queues an outline, full draft, selection rewrite/expand/shorten, titles, conclusion, teaser post or thread, or an AI cover image. Price depends on kind and model. Uses Xholic AI credits: quote first and pass confirmCredits after the user agrees. Read the result with articles.get. Otherwise write the text yourself.

Uses Xholic AI credits (up to about 150). The first call returns CREDITS_CONFIRMATION_REQUIRED with a quote; after the user agrees, call again with confirmCredits and the quote’s quoteId.

Media typeapplication/json
object
id
required

Article id from articles.list.

string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
kind
required
string
Allowed values: OUTLINE FULL_ARTICLE REWRITE_SELECTION EXPAND_SELECTION SHORTEN_SELECTION TITLE_SUGGESTIONS CONCLUSION TEASER_POST TEASER_THREAD COVER COVER_EDIT
model

Luna fast, terra balanced (default), sol deep.

string
Allowed values: luna terra sol
instructions
string
<= 4000 characters
selectedText

Required for REWRITE_SELECTION, EXPAND_SELECTION and SHORTEN_SELECTION.

string
<= 20000 characters
coverStyle
string
Allowed values: surprise_me editorial minimal bold_typography illustration
sourceAssetId

Required for COVER_EDIT: the cover to edit.

string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
idempotencyKey
required

A unique key for this run so a retry never queues it twice.

string
>= 8 characters <= 120 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
confirmCredits

Xholic AI credits the user agreed to spend. Call first without it to get the quote, show the quote to the user, and pass the amount only after they say yes.

number
<= 100000
quoteId

The quoteId from the quote the user agreed to. Send it with confirmCredits.

string
>= 8 characters <= 100 characters

Example

{
"id": "<id>",
"kind": "OUTLINE",
"idempotencyKey": "<idempotencyKey>",
"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"
}
}