> ## 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.

# Webhook の削除

> Webhook を物理削除する（履歴は保持）

ストアから Webhook を削除します。これは**物理削除**です — 行は `store.store_webhooks` から即座に削除され、ソフトデリートフラグはありません。過去の `webhook_deliveries` レコードは監査のために保持されます（`storeWebhookId` 外部キーは `null` に設定されます）。

```
POST /v1/actions/store/remove-webhook
```

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

## リクエストボディ

| フィールド | 型      | 必須  | 説明           |
| ----- | ------ | --- | ------------ |
| `id`  | string | Yes | Webhook UUID |

## リクエスト例

<CodeGroup>
  ```typescript SDK theme={"system"}
  import { WaffoPancake } from "@waffo/pancake-ts";

  const client = new WaffoPancake({
    merchantId: process.env.WAFFO_MERCHANT_ID!,
    privateKey: process.env.WAFFO_PRIVATE_KEY!,
  });

  const { webhook } = await client.webhooks.remove({
    id: "11111111-2222-3333-4444-555555555555",
  });
  // webhook contains a snapshot of the row before deletion
  ```

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

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

削除直前に存在していた Webhook エンティティを返します（呼び出し元が削除内容を確認できるようにするため）。形状は [`add-webhook`](/ja/api-reference/endpoints/webhooks/add-webhook#成功レスポンス-200) と同じです。

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

| フィールド       | 型              | 説明                                    |
| ----------- | -------------- | ------------------------------------- |
| `id`        | string         | Webhook UUID                          |
| `storeId`   | string         | 所属ストアの UUID                           |
| `channel`   | string         | Webhook チャネル                          |
| `url`       | string         | 送信先 Webhook URL                       |
| `events`    | string\[]      | 購読するイベントタイプ                           |
| `testMode`  | boolean        | `true` はテストトランザクションで発火、`false` は本番で発火 |
| `secret`    | string \| null | チャネル固有の認証情報、未設定の場合は `null`            |
| `createdAt` | string         | 作成タイムスタンプ（ISO 8601）                   |
| `updatedAt` | string         | 最終更新タイムスタンプ（ISO 8601）                 |

## エラー

> **リトライポリシー**：4xx は一切リトライしない — リクエストを修正してから再送信。5xx は指数バックオフでリトライ（5s 開始、最大 3 回）。

| ステータス | `errors[0].message`                                | 意味                                                     | 推奨処理                                  |
| ----- | -------------------------------------------------- | ------------------------------------------------------ | ------------------------------------- |
| 400   | `Missing required field: id`                       | `id` が指定されていない                                         | リクエストボディを修正して再送信                      |
| 400   | `id must be a valid UUID`                          | `id` が有効な UUID ではない                                    | `id` を修正して再送信                         |
| 403   | `Not authorized to manage webhooks for this store` | 呼び出し元の所属ストアにおける merchant ロールが `owner` または `admin` ではない | 必要なロールを持つ API Key に切り替え               |
| 404   | `Webhook not found`                                | 指定された `id` の webhook が存在しない（またはすでに削除済み）                | Webhook はすでに存在しない — 成功として扱い、ローカル状態を整合 |
| 500   | `Internal server error`                            | サーバ側の予期しない障害                                           | 指数バックオフでリトライ（5s 開始、最大 3 回）            |
