> For the complete documentation index, see [llms.txt](https://docs.peakcommerce.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peakcommerce.com/developers/reference-pages/webhooks.md).

# Webhooks

Manage webhook subscriptions — the HTTPS endpoints we deliver event notifications to. For the delivery format and verification, see [Webhooks overview](/developers/api-reference/webhooks-overview.md).

* [`GET /api/v1/webhooks`](#get-apiv1webhooks) — list
* [`POST /api/v1/webhooks`](#post-apiv1webhooks) — create
* [`GET /api/v1/webhooks/{id}`](#get-apiv1webhooksid) — retrieve
* [`PATCH /api/v1/webhooks/{id}`](#patch-apiv1webhooksid) — update
* [`DELETE /api/v1/webhooks/{id}`](#delete-apiv1webhooksid) — remove

> All endpoints require the `admin` scope.

***

## `GET /api/v1/webhooks`

List webhook subscriptions in this tenant. Secrets are never returned by list/retrieve endpoints — only `POST` returns the secret, and only once.

### Response `200`

```json
{
  "data": [
    {
      "id": "whs_01H...",
      "url": "https://hooks.acme.com/peak",
      "events": ["order.created", "subscription.changed"],
      "isActive": true,
      "createdAt": "2026-05-02T14:01:23Z"
    }
  ],
  "nextActions": [
    { "rel": "create", "method": "POST", "href": "/api/v1/webhooks" }
  ]
}
```

### cURL

```bash
curl -H "Authorization: Bearer $PEAK_API_KEY" \
  https://api.example.com/api/v1/webhooks
```

***

## `POST /api/v1/webhooks`

Create a webhook subscription. The response includes a `secret`; copy it now — it cannot be retrieved later.

### Body

| Field    | Type           | Required | Description                 |
| -------- | -------------- | -------- | --------------------------- |
| `url`    | string (URL)   | yes      | HTTPS endpoint              |
| `events` | string\[] (≥1) | yes      | Event types to subscribe to |

### Response `201`

```json
{
  "data": {
    "id": "whs_01H...",
    "url": "https://hooks.acme.com/peak",
    "events": ["order.created", "subscription.changed"],
    "isActive": true,
    "secret": "whsec_82ab...c4f9",
    "createdAt": "2026-05-02T14:01:23Z"
  },
  "nextActions": [
    { "rel": "self", "method": "GET", "href": "/api/v1/webhooks/whs_01H..." },
    { "rel": "update", "method": "PATCH", "href": "/api/v1/webhooks/whs_01H..." },
    { "rel": "delete", "method": "DELETE", "href": "/api/v1/webhooks/whs_01H..." }
  ]
}
```

### Errors

| Status | When                                         |
| ------ | -------------------------------------------- |
| `400`  | Validation failed (URL not HTTPS, no events) |

### cURL

```bash
curl -X POST https://api.example.com/api/v1/webhooks \
  -H "Authorization: Bearer $PEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.acme.com/peak",
    "events": ["order.created", "subscription.changed", "payment.succeeded"]
  }'
```

***

## `GET /api/v1/webhooks/{id}`

Retrieve a webhook subscription (without secret).

### Response `200`

Same shape as the list rows.

### Errors

| Status | When      |
| ------ | --------- |
| `404`  | Not found |

### cURL

```bash
curl -H "Authorization: Bearer $PEAK_API_KEY" \
  https://api.example.com/api/v1/webhooks/whs_01H...
```

***

## `PATCH /api/v1/webhooks/{id}`

Update a webhook subscription.

### Body (all optional)

| Field      | Type         | Description               |
| ---------- | ------------ | ------------------------- |
| `url`      | string (URL) | Replace destination URL   |
| `events`   | string\[]    | Replace subscribed events |
| `isActive` | boolean      | Disable without deleting  |

### Response `200`

Same shape as `GET`.

### Errors

| Status | When              |
| ------ | ----------------- |
| `400`  | Validation failed |
| `404`  | Not found         |

### cURL

```bash
curl -X PATCH https://api.example.com/api/v1/webhooks/whs_01H... \
  -H "Authorization: Bearer $PEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "isActive": false }'
```

***

## `DELETE /api/v1/webhooks/{id}`

Permanently delete a webhook subscription. Pending retries are cancelled.

### Response `204`

Empty body.

### Errors

| Status | When      |
| ------ | --------- |
| `404`  | Not found |

### cURL

```bash
curl -X DELETE https://api.example.com/api/v1/webhooks/whs_01H... \
  -H "Authorization: Bearer $PEAK_API_KEY"
```

***

## Related

* [Webhooks overview](/developers/api-reference/webhooks-overview.md)
* Webhooks (admin app: **Settings → Developer Tools → Webhooks**)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.peakcommerce.com/developers/reference-pages/webhooks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
