# Approve emails

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

`POST https://api.won.dev/v1/email/messages/approve`

Approves emails that wait for approval (`pending_approval`): each goes out as written, from its mailbox, as soon as that mailbox may send and the recipient is in office hours. One that is not waiting, such as one approved already, stays as it is (`done: false`). A key that is set to ask for approval cannot approve (`forbidden`): a person does, in the console. Free.

- **Billing:** The call is free, and so are the emails: they go out from the sender's sending domains, paid for by the month, see [Sending domains](/docs/email#domains).

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

## Parameters [#parameters]

Parameters go in the JSON body. `POST` requests also take an `Idempotency-Key` header, see [Sending a request twice](/docs/email#idempotency).

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `message_ids` | string[] | yes | Up to 100 email IDs, such as `msg_3e5r4k2m9x7p1q8w`, from `GET /email/messages?status=pending_approval`. |

## Response [#response]

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

| Field | Type | Description |
| --- | --- | --- |
| `data` | object[] | One result per ID, in the order given. |
| `data[].id` | string |  |
| `data[].done` | boolean | Whether this call changed it. |
| `data[].status` | `pending_approval` \| `approved` \| `sending` \| `sent` \| `bounced` \| `failed` \| `skipped` \| null | Its status now. Null for an ID this account has no email with, or one of the other kind of key. |
| `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 https://api.won.dev/v1/email/messages/approve \
  -H "Authorization: Bearer $WON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "message_ids": [
    "msg_3e5r4k2m9x7p1q8w"
  ]
}'
```

```json
{
  "data": [
    {
      "id": "msg_3e5r4k2m9x7p1q8w",
      "done": true,
      "status": "approved"
    }
  ],
  "notice": null,
  "usage": {
    "cost": 0,
    "balance": 48.08,
    "replayed": false
  }
}
```