AI writing

Draft an email or a whole sequence from a prompt, in your brand voice. Nothing is sent or saved until you do it.

Workspace context

Drafts use a per workspace context so they sound like you. Read it with GET /v1/workspace/ai-context and change the keys you send with PATCH /v1/workspace/ai-context.

FieldTypeDescription
product_name, category, founder_namestringAt most 120 characters each.
product_urlstringAt most 2048 characters. Links in a draft are limited to this host and the hosts in your prompt.
founder_voicestringHow the sender writes. At most 2000 characters.
tonestringAt most 1000 characters.
company_contextstringAt most 8000 characters.
instructionsstringStanding rules for every draft. At most 2000 characters.
languagesstring[]BCP 47 tags such as en or pt-BR, at most 12. Default ["en"].
default_languagestringOne of languages.

Generate

curl -X POST https://api.runearc.com/v1/ai/email \
  -H "Authorization: Bearer $RUNEARC_API_KEY" -H "Content-Type: application/json" \
  -d '{ "prompt": "welcome email for new signups, invite a reply", "language": "en" }'
RequestBodyReturns
POST /v1/ai/emailprompt (1 to 4000 characters), language, site_textsubject, preview_text and a document in the email document format.
POST /v1/ai/sequenceprompt, language, site_text, steps (1 to 10, default 4)name and steps: each with delay_days, subject, preview_text, document.
GET /v1/ai/usagenoneused, limit, month (first day, UTC), input_tokens, output_tokens.

language must be one of the workspace's languages. site_text is optional page text to ground the draft, at most 12,000 characters, and is treated as untrusted. Unsafe links in a draft are rejected rather than returned (ai_unsafe_link). Use the result as the document of a campaign or the steps of a sequence; Onboarding uses it to draft a welcome sequence.

Limits

Each successful generation uses one of the workspace's monthly allowance: 20 on Free, 500 on Pro, 5,000 on Scale and 50,000 on Enterprise, reset on the 1st (UTC). A failed generation is refunded. A call needs a key or role that can send.

CLI and MCP

runearc ai context                     # show; change with --set tone="plain and warm" (repeatable)
runearc ai email "welcome email for new signups" --language en
runearc ai sequence "onboard new trial users" --steps 4
runearc ai usage

MCP tools: get_ai_context, generate_email and generate_sequence.

Errors

CodeStatusMeaning and fix
invalid_prompt, invalid_steps400Prompt is 1 to 4000 characters; steps is 1 to 10.
invalid_language400Enable the language in the workspace context first.
invalid_ai_context400A context field is too long or malformed.
ai_limit_reached402The monthly allowance is used. Wait for the 1st (UTC), write it by hand or upgrade.
ai_unavailable503AI writing is not configured on this server.
ai_provider_busy429The model provider is busy. Retry shortly.
ai_provider_error, ai_provider_auth, ai_bad_output503The draft failed. Try again, or make the prompt more specific.
ai_refused400The model declined the prompt. Rephrase it.
ai_unsafe_link400The draft linked to a host you did not give. Mention the link in the prompt.
The context and usage are per workspace.

Something unclear or wrong? The API answers every error with a fix, and so should these docs. Back to runearc.com