# Update a webhook endpoint

`PATCH /webhooks/{id}`

Requires the `businesses` scope.

`{"active": true}` also re-arms an endpoint that was auto-disabled after sustained failure.

## Path parameters

| Name | Type | | Description |
|---|---|---|---|
| `id` | string | **required** | Webhook endpoint id. |

## Body

| Field | Type | | Description |
|---|---|---|---|
| `url` | string |  |  |
| `events` | array of string |  |  |
| `businessId` | string |  | Set null to widen back to every business under the key. |
| `active` | boolean |  | false pauses the endpoint: new events are not queued for it, pending ones stop delivering. |

## Response

`200`: `{ "ok": true, … }`

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `webhook` | WebhookEndpoint | **required** | A webhook subscription. Deliveries are POSTed to `url`, signed with `secret` (see the Webhooks guide). |

Errors: `400`, `401`, `403`, `404`, `429`. Every failure answers `{ "error": …, "reason": … }`. Branch on `reason`.

## Examples

### cURL

```bash
curl -X PATCH "$BASE/webhooks/$DOC_ID" \
  -H "X-Api-Key: $KEY"
```
### Node

```node
const res = await fetch(`${BASE}/webhooks/${DOC_ID}`, {
  method: 'PATCH',
  headers: {
    'X-Api-Key': KEY,
  },
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.patch(
    f"{BASE}/webhooks/{DOC_ID}",
    headers={"X-Api-Key": KEY},
)
data = res.json()
```