Skip to main content
POST
Generate or revise template content with AI

Authorizations

Authorization
string
header
required

API key for account management endpoints. Use your api_ prefixed token.

Body

application/json

Total body size must stay under 75,000 bytes.

requestId
string
required

Idempotency key, stable across retries. Replaying one returns the original result without charging; reusing one with different input is a 409.

Pattern: ^[a-zA-Z0-9_-]{16,100}$
templateId
string
required

Template to work on. Required.

action
enum<string>
required

Selects the task and the credit cost. rewrite_block and translate_block require target.

Available options:
subject_variants,
rewrite_block,
translate_block,
draft_email,
template_chat,
generate_template
prompt
string

Required for every action except translate_block.

Maximum string length: 4000
tone
string
default:Match the current brand and request
Maximum string length: 80
language
string
default:English
Maximum string length: 80
history
object[]

Ignored; the server uses its own template-scoped history.

context
object

The live editor content, which is the source of truth for the request.

target
object | null

The selected block, for block-scoped actions. All three fields are required when present.

Response

Validated draft

success
boolean
Example:

true

replayed
boolean

True when the requestId was already completed; the stored result was returned and nothing was charged.

requestId
string
result
object

Validated AI output. Always a draft: applying it is a separate user action, and nothing here is saved or sent. kind selects the shape.

chat
object
credits
object

AI credit wallet for the authenticated owner, for the current monthly UTC cycle.