---
title: "Write an email with AI"
description: "The body of an email from a prompt, in the style of the mail you send."
url: "https://openemail.uk/docs/api/emails/compose"
area: "API"
category: "Emails"
---

# Write an email with AI

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

`POST /emails/compose`

## 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": ["ada@example.com"] }'
```

**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

- [`POST /emails/compose`](https://openemail.uk/docs/api/reference/emails#post-emails-compose): full reference
