AI text
Generate or rewrite copy inside the editor on the plugin owner's AI key.
Requires Authorization: Bearer {session_token} from the session endpoint and the embedded headers.
Generation runs on the key the owner attached through the AI Credentials tab. There is no fallback key, and the provider is not selectable per request. curation.ai.is_available in the bootstrap response tells the editor whether this endpoint will work.
Generate text
POST /public/plugin/v1/ai-text-generate
Content-Type: application/json| Field | Type | Required | Notes |
|---|---|---|---|
message | string | yes | What to write or rewrite. Max 5000 characters |
prompt | string | no | Extra instructions layered on top of the default copywriting prompt. Max 2000 characters |
prompt_template_id | integer | no | One of MailEditor's stored prompt templates. Replaces the default prompt |
If both prompt and prompt_template_id are sent, the template wins. prompt overrides the default behaviour wherever they conflict, so "translate this message into Spanish" works. message is always treated as content, never as instructions.
{ "message": "Write a headline for a summer sale on running shoes" }200
{
"message": "AI text generated successfully",
"result": {
"ai_text": "SUMMER SALE — UP TO 40% OFF",
"provider": "anthropic",
"model": "claude-haiku-4-5-20251001"
}
}Errors
| Status | error | Meaning |
|---|---|---|
| 403 | ai_not_configured | This plugin has no AI key |
| 403 | no_ai_credential | A key exists but could not be read |
| 502 | ai_generation_failed | The provider refused, was unreachable, or answered in an unreadable shape. The provider's response is not included |
| 402 | quota_exceeded | The period's generations are used up. result.feature is ai_generations |
| 422 | message missing or over 5000 characters | |
| 429 | Rate limited |
Allowance and throttling
Generations are checked against the ai_generations plan feature before the provider is called, so a refused generation costs nothing. Every plan allows unlimited generations, because they run on your own provider key. A plugin with no active subscription cannot generate.
| Limit | Keyed on |
|---|---|
| 20 per minute | session token |
| 200 per hour | session token |
| 2000 per day | plugin |

.png)