---
title: "Rewrite part of an email with AI"
description: "Up to five different versions of a subject or a body."
url: "https://openemail.uk/docs/api/emails/rewrite"
area: "API"
category: "Emails"
---

# Rewrite part of an email with AI

Up to five different versions of a subject or a body.

`POST /emails/rewrite`

## POST /emails/rewrite

Up to five different versions of a subject or a body.

## Example

Needs `emails:send`. `action` is `shorten`, `lengthen`, `rephrase`, `formal`, `casual` or `custom`, and `custom` needs `instruction` to say what to change. `target` is `body`, the default, or `subject`, and `count` asks for 1 to 5 versions, 3 by default.

**curl**

```
curl -X POST "$OE/emails/rewrite" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{ "text": "Hey, did you get a chance to look at the contract?", "action": "formal", "count": 2 }'
```

**Response**

```
{
  "object": "rewrite",
  "target": "body",
  "variations": [
    "Hello, I wanted to ask whether you have had a chance to review the contract.",
    "Good morning. Have you been able to look over the contract yet?"
  ]
}
```

> `threadId` makes the rewrite fit the conversation it replies in, and needs `threads:read`.

> The versions never repeat the original, and each call spends one AI action.

## Reference

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