# Update a webhook endpoint

`PATCH https://api.cademi.com.br/api/v3/webhooks/{webhook_id}`

Operation ID: `webhooks.update` · API v3

Updates the URL, subscribed event types, resource filters, description, or status of a webhook endpoint.

Changing `status` requires the `webhooks.activate` permission in addition to `webhooks.update`. A new URL is subject to the same destination restrictions as the create operation.

Send the `ETag` returned by the retrieve operation in the `If-Match` header to avoid overwriting changes made since the endpoint was retrieved. If the header is omitted, the update is applied to the current revision.

Required permissions: `webhooks.update`, `webhooks.activate`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `webhook_id` | path | string | yes |  |
| `If-Match` | header | string | no |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `description` | string or null | no |  |
| `event_types` | array of string | no |  |
| `resource_filters` | object or null | no |  |
| `status` | string, one of `active`, `inactive` | no |  |
| `url` | string (uri) | no |  |

## Responses

### 200

Returns the updated webhook endpoint.

Body: `data`: Webhook.

Fields of Webhook:

| Field | Type | Required | Description |
|---|---|---|---|
| `created_at` | string (date-time) | yes |  |
| `description` | string or null | no |  |
| `event_types` | array of string | yes |  |
| `health` | object or null | no |  |
| `id` | string | yes |  |
| `max_per_second` | integer | no |  |
| `object` | string, one of `webhook` | yes |  |
| `payload_version` | integer | no |  |
| `resource_filters` | object or null | no |  |
| `revision` | integer | yes |  |
| `secret` | string or null | no | Secret of the webhook destination. Returned only when the webhook is created or its secret is rotated, and shown only once. |
| `status` | string, one of `active`, `inactive` | yes |  |
| `timeout_ms` | integer | no |  |
| `updated_at` | string (date-time) | yes |  |
| `url` | string (uri) | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The webhook endpoint was not found or is not accessible with the current credentials.

Body: Error.

### 412

The webhook endpoint has changed since the revision supplied in If-Match, or the header does not identify this endpoint.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
