POST Rewrite Or Generate Text​
POST
/ai/generate
Run one of the inline writing actions used by the email editors on a block of text.
content is required for every action except custom; for custom you must supply either content, custom_prompt, or both. AI must already be enabled and configured — this endpoint uses the saved provider, model, and key and ignores any credentials in the request body.
The call blocks for up to 30 seconds while the provider responds.
Required capability: fcrm_manage_emails
Enforced by AiPolicy::generate().
Authorizations​
ApplicationPasswords
WordPress Application Passwords — use Basic auth with your WordPress username and an application password in the format: username:application_password
Type
API Key (header: Authorization)
Request Body​
application/json
JSON
{
"action": "string",
"content": "string",
"tone": "string",
"custom_prompt": "string"
}
Responses​
Generated text.
application/json
JSON
{
"content": "string"
}