> ## Documentation Index
> Fetch the complete documentation index at: https://docs.waffo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 受信者を削除

> ストアのマーチャント通知受信者リストからアドレスを削除する

ストアの受信者リストからアドレスを削除します。同じアドレスは後から再度追加できます。

```
POST /v1/actions/store-notification-recipient/remove-recipient
```

**認証：** API Key（owner または admin ロールが必要）

## リクエストボディ

| フィールド         | 型      | 必須 | 説明                                            |
| ------------- | ------ | -- | --------------------------------------------- |
| `storeId`     | string | はい | ストア ID（Short ID 形式 `STO_xxx`）                 |
| `recipientId` | string | はい | 実在の受信者の UUID。フォールバックエントリのセンチネル id は 404 を返します |

## リクエスト例

<CodeGroup>
  ```bash cURL theme={"system"}
  curl -X POST https://api.waffo.com/v1/actions/store-notification-recipient/remove-recipient \
    -H "Content-Type: application/json" \
    -H "X-Merchant-Id: $WAFFO_MERCHANT_ID" \
    -H "X-Signature: ..." \
    -d '{
      "storeId": "STO_2aUyqjCzEIiEcYMKj7TZtw",
      "recipientId": "11111111-2222-3333-4444-555555555555"
    }'
  ```

  ```javascript JavaScript theme={"system"}
  const response = await fetch(
    "https://api.waffo.com/v1/actions/store-notification-recipient/remove-recipient",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "X-Merchant-Id": process.env.WAFFO_MERCHANT_ID,
        "X-Signature": signature,
      },
      body: JSON.stringify({
        storeId: "STO_2aUyqjCzEIiEcYMKj7TZtw",
        recipientId: "11111111-2222-3333-4444-555555555555",
      }),
    },
  );

  const { data } = await response.json();
  ```
</CodeGroup>

## 成功レスポンス (200)

```json theme={"system"}
{
  "data": {
    "recipientId": "11111111-2222-3333-4444-555555555555",
    "removed": true
  }
}
```

<Warning>
  最後の 1 件を削除しても 200 を返します —— 「最低 1 件は残す」というガードはありません。その後ストアはオーナーのアカウントメールにフォールバックし、ストアレベルの `notify*` トグルを使います。
  フォールバックエントリ自体は**削除できません**：保存された行ではないため、`OWNER_<storeId>` センチネル id を送ると 404 を返します。置き換えるには実在の受信者を追加してください。消費者向けのトランザクションメールは別系統であり、引き続き動作します。
</Warning>

## レスポンスフィールド

| フィールド         | 型       | 説明                                                 |
| ------------- | ------- | -------------------------------------------------- |
| `recipientId` | string  | 削除された受信者の UUID                                     |
| `removed`     | boolean | 常に `true`。該当なしの場合は `removed: false` ではなく 404 を返します |

## エラー

> **リトライ方針：** 4xx は決してリトライしないでください —— リクエストを修正して再送します。5xx は指数バックオフでリトライします（初回 5 秒、最大 3 回）。

| ステータス | `errors[0].message`                                               | 意味                                              | 推奨対応                                      |
| ----- | ----------------------------------------------------------------- | ----------------------------------------------- | ----------------------------------------- |
| 400   | `Missing required field: recipientId`                             | `recipientId` が未指定                              | リクエストボディを修正して再送                           |
| 400   | `Invalid recipient id format: expected UUID, got "..."`           | `recipientId` が UUID でも当ストアのセンチネル値でもない          | add-recipient や GraphQL が返した `id` をそのまま渡す |
| 401   | `Missing merchantId in request context`                           | API Key 認証でマーチャントを解決できなかった                      | API Key のヘッダーと署名を確認                       |
| 403   | `Not authorized to manage notification recipients for this store` | マーチャントがそのストアの `owner` / `admin` ではない            | ストアにおけるマーチャントのロールを確認                      |
| 404   | `Notification recipient not found`                                | そのストアに該当 id の受信者がない、またはその id が削除不可のフォールバックセンチネル | リストを取得し直す                                 |
| 409   | `Notification recipients changed concurrently, please retry`      | 読み取りと書き込みの間に並行書き込みがリストを変更                       | リストを取得し直して再試行                             |
| 500   | `Internal server error`                                           | サーバー側の予期しない障害                                   | 指数バックオフでリトライ（初回 5 秒、最大 3 回）               |
