Skip to the documentation
API

Write an email with AI

The body of an email from a prompt, in the style of the mail you send.

POST/emails/compose

Runs the real call on your workspace.

POST /emails/compose

The body of an email from a prompt, in the style of the mail you send.

Example

Needs emails:send. prompt is an instruction, a rough draft or a few notes. subject, to and cc help the greeting and the tone fit, and threadId writes a reply, reading that thread as context, which also needs threads:read.

curl
curl -X POST "$OE/emails/compose" -H "$AUTH" -H "Content-Type: application/json" \  -d '{ "prompt": "Thank Ada for the signed contract and ask for the invoice by Friday.", "to": ["[email protected]"] }'
Response
{  "object": "composition",  "body": "Hi Ada,\n\nThank you for sending the signed contract. Could you send the invoice by Friday?\n\nBest,\nGrace"}

Nothing is saved or sent. Send the body with POST /emails, or save it with POST /drafts.

Each call spends one AI action. A workspace that has used them all for the day gets a 429 ai_quota_exceeded.

Reference