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.
| Field | Type | Description |
|---|---|---|
| product_name, category, founder_name | string | At most 120 characters each. |
| product_url | string | At most 2048 characters. Links in a draft are limited to this host and the hosts in your prompt. |
| founder_voice | string | How the sender writes. At most 2000 characters. |
| tone | string | At most 1000 characters. |
| company_context | string | At most 8000 characters. |
| instructions | string | Standing rules for every draft. At most 2000 characters. |
| languages | string[] | BCP 47 tags such as en or pt-BR, at most 12. Default ["en"]. |
| default_language | string | One 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" }'| Request | Body | Returns |
|---|---|---|
| POST /v1/ai/email | prompt (1 to 4000 characters), language, site_text | subject, preview_text and a document in the email document format. |
| POST /v1/ai/sequence | prompt, language, site_text, steps (1 to 10, default 4) | name and steps: each with delay_days, subject, preview_text, document. |
| GET /v1/ai/usage | none | used, 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 usageMCP tools: get_ai_context, generate_email and generate_sequence.
Errors
| Code | Status | Meaning and fix |
|---|---|---|
| invalid_prompt, invalid_steps | 400 | Prompt is 1 to 4000 characters; steps is 1 to 10. |
| invalid_language | 400 | Enable the language in the workspace context first. |
| invalid_ai_context | 400 | A context field is too long or malformed. |
| ai_limit_reached | 402 | The monthly allowance is used. Wait for the 1st (UTC), write it by hand or upgrade. |
| ai_unavailable | 503 | AI writing is not configured on this server. |
| ai_provider_busy | 429 | The model provider is busy. Retry shortly. |
| ai_provider_error, ai_provider_auth, ai_bad_output | 503 | The draft failed. Try again, or make the prompt more specific. |
| ai_refused | 400 | The model declined the prompt. Rephrase it. |
| ai_unsafe_link | 400 | The draft linked to a host you did not give. Mention the link in the prompt. |