# メールを承認する

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

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

承認待ち（`pending_approval`）のメールを承認します。それぞれ書かれたとおりに、そのメールボックスが送れるようになり、受信者が勤務時間内になったらすぐに送られます。承認待ちでないもの（すでに承認したものなど）はそのままです（`done: false`）。承認を求めるように設定したキーは承認できません（`forbidden`）。承認はコンソールで人が行います。無料です。

- **課金：** 呼び出しは無料で、メールも無料です。メールは送信者の送信ドメインから送られ、ドメインは月ごとに支払います。[送信ドメイン](/ja/docs/email#domains)を参照してください。

テストキー（`won_test_...`）では、これは[サンドボックス](/ja/docs/email#sandbox)で動きます。何も送信されず、課金もされません。

## パラメーター [#parameters]

パラメーターはJSONのリクエストボディで渡します。`POST`リクエストでは`Idempotency-Key`ヘッダーも使えます。[同じリクエストを2回送ったとき](/ja/docs/email#idempotency)を参照してください。

| パラメーター | 型 | 必須 | 説明（APIの原文） |
| --- | --- | --- | --- |
| `message_ids` | string[] | はい | Up to 100 email IDs, such as `msg_3e5r4k2m9x7p1q8w`, from `GET /email/messages?status=pending_approval`. |

## レスポンス [#response]

エラーについては[エラーコード](/ja/docs/errors)を参照してください。

| フィールド | 型 | 説明（APIの原文） |
| --- | --- | --- |
| `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]

```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
  }
}
```