# Change an email

Source: https://won.dev/docs/email/messages-update

`PATCH https://api.won.dev/v1/email/messages/{id}`

Changes the subject or the text of an email that waits for approval, or was approved and has not gone out, for this one person. It is checked as every email is, and then waits for approval again. Write it out: placeholders are already filled in. A follow-up that answers the email before it keeps that thread's subject. A later change of the campaign's steps leaves it as changed. Free.

- **Billing:** Free.

A test key (`won_test_...`) runs this in the [sandbox](/docs/email#sandbox): nothing is sent and nothing is charged.

## Parameters [#parameters]

`id` is part of the path. The others go in the JSON body. `PATCH` requests also take an `Idempotency-Key` header, see [Sending a request twice](/docs/email#idempotency).

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Email ID, such as `msg_3e5r4k2m9x7p1q8w`. |
| `subject` | string | no | The new subject line. |
| `text` | string | no | The new text, as plain text. The footer and the unsubscribe link are added when it goes out. |

## Response [#response]

Errors are described in [Errors](/docs/errors).

| Field | Type | Description |
| --- | --- | --- |
| `data` | object |  |
| `data.id` | string | Message ID, such as `msg_3e5r4k2m9x7p1q8w`. |
| `data.conversation_id` | string | Its conversation with the person, such as `cnv_9x7p1q8w3e5r4k2m`. |
| `data.campaign_id` | string |  |
| `data.recipient_id` | string |  |
| `data.from` | string \| null | The address it went out from: a mailbox of the sender's domains. |
| `data.to` | string |  |
| `data.kind` | `step` \| `reply` \| `single` | `step` of the sequence, `reply` (your answer to a reply), or `single` (an email you sent on its own with `POST /email/messages`). |
| `data.step` | integer \| null | The step, counted from 1. Null for a reply or a single email. |
| `data.version` | integer | Which version of the step went out, counted from 1. |
| `data.status` | `pending_approval` \| `approved` \| `sending` \| `sent` \| `bounced` \| `failed` \| `skipped` | `sent`, `bounced`, or `sending` for the seconds it takes. `failed` and `skipped` did not go out. On a campaign that asks for approval, `pending_approval` waits for a person to approve it, and `approved` waits for its mailbox and the recipient's office hours. |
| `data.subject` | string |  |
| `data.text` | string \| null | What it says, placeholders filled in, without the footer and the quoted email under a follow-up. On one that waits for approval, what will go out. |
| `data.opens` | integer | Opens that look like a person's. Machines that fetch mail to scan it are left out. |
| `data.clicks` | integer |  |
| `data.bounce_type` | `hard` \| `soft` \| null |  |
| `data.attachments` | object[] | The files that went with it. |
| `data.attachments[].filename` | string |  |
| `data.attachments[].content_type` | string |  |
| `data.attachments[].size` | integer | In bytes. |
| `data.sent_at` | string \| null |  |
| `notice` | string \| null | A plain sentence when there is something to know about this answer. Null otherwise. |
| `usage` | object | Nothing is charged here. The balance, for reference. |
| `usage.cost` | number | What this call cost, in US dollars. |
| `usage.balance` | number | The balance left after this call, in US dollars. |
| `usage.replayed` | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |

## Example [#example]

```bash
curl -X PATCH https://api.won.dev/v1/email/messages/msg_3e5r4k2m9x7p1q8w \
  -H "Authorization: Bearer $WON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "text": "Hi Dana,\n\nI saw that Harborline Imports imports office seating, and that you opened a warehouse in Savannah. We make mesh task chairs in Leeds and ship to the US in four weeks.\n\nWould a price list be useful?\n\nAlex"
}'
```

```json
{
  "data": {
    "id": "msg_3e5r4k2m9x7p1q8w",
    "conversation_id": "cnv_9x7p1q8w3e5r4k2m",
    "campaign_id": "cmp_7p1q8w3e5r4k2m9x",
    "recipient_id": "rcp_9x7p1q8w3e5r4k2m",
    "from": "alex@northwindseating.example",
    "to": "dana.whitfield@harborline-imports.example",
    "kind": "step",
    "step": 1,
    "version": 1,
    "status": "pending_approval",
    "subject": "Office chairs for Harborline Imports",
    "text": "Hi Dana,\n\nI saw that Harborline Imports imports office seating, and that you opened a warehouse in Savannah. We make mesh task chairs in Leeds and ship to the US in four weeks.\n\nWould a price list be useful?\n\nAlex",
    "opens": 0,
    "clicks": 0,
    "bounce_type": null,
    "attachments": [],
    "sent_at": null
  },
  "notice": null,
  "usage": {
    "cost": 0,
    "balance": 48.08,
    "replayed": false
  }
}
```