# Edit a webhook

PATCH /v1/webhooks/{webhook_id}

Source: https://cherami.to/docs/api/webhooks/update-webhook



{/* Generated from apps/web/openapi. Edit the contract, not this file. */}

`PATCH /v1/webhooks/{webhook_id}`

Requires an [API key](https://cherami.to/docs/api#authentication): `Authorization: Bearer YOUR_CREDENTIAL`.

Changes the event types, inbox scope or enabled state. The URL can't be edited: add a webhook with the new URL, then delete this one.

Values are absolute, so a lost or uncertain change is safe to repeat with the same values.

## Parameters [#parameters]

| Parameter    | Location | Required | Type   | Meaning                                  |
| ------------ | -------- | -------- | ------ | ---------------------------------------- |
| `webhook_id` | path     | Yes      | string | Cherami resource ID returned by the API. |

## Request body [#request-body]

JSON object, at most 4 KiB in total.

### Schema: UpdateWebhook [#schema-updatewebhook]

Omitted fields stay as they are, and a supplied array replaces the whole list.

| Field         | Required | Type                                                  | Meaning and constraints                                                                                                                                                  |
| ------------- | -------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `event_types` | No       | array of [WebhookEventType](#schema-webhookeventtype) | `minItems`: `1` `maxItems`: `2`                                                                                                                                          |
| `inbox_ids`   | No       | array of string                                       | Replaces the scope with up to 10 of the account's live inboxes; \[] means every inbox, including ones created later. Omit it to keep the current scope. `maxItems`: `10` |
| `enabled`     | No       | boolean                                               | false pauses deliveries; true resumes them, including after repeated delivery failures disabled the webhook.                                                             |

Unknown fields are rejected.

At least 1 field must be supplied.

## curl example [#curl-example]

Supply `CHERAMI_API_KEY` privately.

Save the payload as `request.json`, replacing the example values.

```json
{
  "event_types": [
    "message.received",
    "message.sent"
  ],
  "enabled": true
}
```

```sh
curl --silent --show-error --include --request PATCH \
  "https://cherami.to/v1/webhooks/WEBHOOK_ID" \
  --header "Authorization: Bearer $CHERAMI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-binary @request.json
```

## Responses [#responses]

### HTTP 200 [#http-200]

Success.

* `X-Request-ID`: Identifies this request; include it when reporting a problem.

Content type: `application/json`.

[Webhook](#schema-webhook)

```json
{
  "id": "55555555-5555-4555-8555-555555555555",
  "created_at": "2026-10-01T00:00:00.000Z",
  "url": "https://example.com/hooks/cherami",
  "event_types": [
    "message.received"
  ],
  "inbox_ids": [
    "11111111-1111-4111-8111-111111111111"
  ],
  "deleted_inbox_ids": [],
  "enabled": true,
  "updated_at": "2026-10-01T00:00:00.000Z",
  "status": "active",
  "pending_operation": null,
  "secret_rotated_at": null,
  "previous_secret_expires_at": null
}
```

### HTTP 400 [#http-400]

`invalid_json`: Send a valid UTF-8 JSON object, not an array or scalar.

`invalid_webhook_update`: Supply at least one of `event_types`, `inbox_ids` and `enabled`, with `enabled` as a boolean.

`invalid_webhook_event_types`: Supply a nonempty array of `message.received`, `message.sent` or both.

`invalid_webhook_inbox_ids`: Supply `inbox_ids` as an array of at most 10 inbox IDs, or an empty array for every inbox.

`unknown_webhook_inbox`: An `inbox_ids` entry is not a live inbox of this account. Remove the IDs listed in `error.details.inbox_ids`.

`invalid_webhook_settings`: The settings were refused, and nothing changed. Read the webhook, then send corrected values.

* `X-Request-ID`: Identifies this request; include it when reporting a problem.

Content type: `application/json`.

[Error](#schema-error)

### HTTP 401 [#http-401]

`unauthorized`: Send a valid API key as `Authorization: Bearer <key>`. If the key stopped working, get a new one through [recovery](https://cherami.to/docs/guides/recovery).

* `X-Request-ID`: Identifies this request; include it when reporting a problem.
* `WWW-Authenticate`: `"Bearer"`

Content type: `application/json`.

[Error](#schema-error)

### HTTP 404 [#http-404]

`not_found`: The resource does not exist or does not belong to this account. A reply or forward source must also be in the sending inbox.

* `X-Request-ID`: Identifies this request; include it when reporting a problem.

Content type: `application/json`.

[Error](#schema-error)

### HTTP 409 [#http-409]

`webhook_operation_in_progress`: Another change to this webhook is in progress. Retry in a minute.

`webhook_endpoint_missing`: This webhook no longer receives events and cannot be changed. Delete it and add it again; the new webhook has a new ID and signing secret.

* `X-Request-ID`: Identifies this request; include it when reporting a problem.

Content type: `application/json`.

[Error](#schema-error)

### HTTP 413 [#http-413]

`body_too_large`: Reduce the JSON request to the operation's body limit.

* `X-Request-ID`: Identifies this request; include it when reporting a problem.

Content type: `application/json`.

[Error](#schema-error)

### HTTP 415 [#http-415]

`unsupported_media_type`: Send `Content-Type: application/json`.

* `X-Request-ID`: Identifies this request; include it when reporting a problem.

Content type: `application/json`.

[Error](#schema-error)

### HTTP 503 [#http-503]

`webhook_provider_unavailable`: The request could not be completed, and nothing changed. Retry later.

`webhook_settings_uncertain`: The settings change was not confirmed. Apply the same values again; repeating them is safe.

`webhooks_unavailable`: Webhook management failed. If it was a change, it may have been applied: list or read the webhooks before repeating it.

* `X-Request-ID`: Identifies this request; include it when reporting a problem.

Content type: `application/json`.

[Error](#schema-error)

## Schema: Webhook [#schema-webhook]

status is active (delivering), disabled (not delivering until you set enabled to true; you or repeated delivery failures turned it off), pending (creation or removal not yet confirmed; read it again shortly) or unknown (the configuration couldn't be read and its fields are null; if it stays unknown, delete the webhook and add it again). pending\_operation names the unconfirmed work.

| Field                        | Required | Type                                                          | Meaning and constraints                                                                                           |
| ---------------------------- | -------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `id`                         | Yes      | string                                                        | Cherami resource ID.                                                                                              |
| `created_at`                 | Yes      | string                                                        | UTC timestamp with milliseconds. `format`: `date-time` `pattern`: `^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$` |
| `url`                        | Yes      | string or null                                                | Destination URL; null while status is pending or unknown.                                                         |
| `event_types`                | Yes      | array of [WebhookEventType](#schema-webhookeventtype) or null |                                                                                                                   |
| `inbox_ids`                  | Yes      | array of string or null                                       | Scoped inboxes; empty means every inbox.                                                                          |
| `deleted_inbox_ids`          | Yes      | array of string                                               | Scoped inboxes that have since been deleted. They match nothing; edit inbox\_ids to remove them.                  |
| `enabled`                    | Yes      | boolean or null                                               |                                                                                                                   |
| `updated_at`                 | Yes      | string or null                                                |                                                                                                                   |
| `status`                     | Yes      | `"active"` or `"disabled"` or `"pending"` or `"unknown"`      |                                                                                                                   |
| `pending_operation`          | Yes      | object or null                                                |                                                                                                                   |
| `secret_rotated_at`          | Yes      | string or null                                                |                                                                                                                   |
| `previous_secret_expires_at` | Yes      | string or null                                                |                                                                                                                   |

## Schema: WebhookEventType [#schema-webhookeventtype]

message.received: a received message is ready to read. message.sent: the provider accepted a sent message, which is not delivery.

`"message.received"` or `"message.sent"`

## Schema: Error [#schema-error]

| Field   | Required | Type   | Meaning and constraints |
| ------- | -------- | ------ | ----------------------- |
| `error` | Yes      | object |                         |

### `error` fields [#error-fields]

| Field     | Required | Type   | Meaning and constraints                                               |
| --------- | -------- | ------ | --------------------------------------------------------------------- |
| `code`    | Yes      | string | Code to handle. Handle a code you don't recognize by its HTTP status. |
| `message` | Yes      | string | Explanation of this case; its wording can change.                     |

[Errors, limits and pagination](https://cherami.to/docs/api/errors) · [Download OpenAPI 3.1](https://cherami.to/openapi.json)
