> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dacard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update or delete a webhook

> Patch a webhook (URL, events, enabled), or delete it permanently.

Patch a webhook (URL, events, enabled), or delete it permanently. Both actions require the `account:manage_integrations` permission.

## Patch a webhook

```bash theme={null}
curl -X PATCH https://app.dacard.ai/api/webhooks/wh_xyz \
  -H "Authorization: Bearer $DACARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.example.com/dacard",
    "events": ["score.completed"],
    "enabled": true
  }'
```

## Delete a webhook

```bash theme={null}
curl -X DELETE https://app.dacard.ai/api/webhooks/wh_xyz \
  -H "Authorization: Bearer $DACARD_API_KEY"
```

| Property                | Value                                               |
| ----------------------- | --------------------------------------------------- |
| **Auth**                | Required                                            |
| **Required permission** | `account:manage_integrations`                       |
| **Idempotent**          | PATCH yes. DELETE yes (returns 404 on second call). |

## Allowed events

`score.completed`, `subscription.changed`. Unknown event names are silently dropped from the array.

## Body (PATCH)

| Field     | Type      | Notes                                      |
| --------- | --------- | ------------------------------------------ |
| `url`     | string    | Must start with `https://`. HTTP rejected. |
| `events`  | string\[] | Replaces the prior list.                   |
| `enabled` | boolean   | Toggles delivery.                          |

All fields optional. Omitted fields are unchanged.

## Errors

| Status | Code                | When                                                  |
| ------ | ------------------- | ----------------------------------------------------- |
| 400    | `url must be HTTPS` | URL with `http://` scheme.                            |
| 401    | `AUTH_REQUIRED`     | No session.                                           |
| 403    | `FORBIDDEN`         | Caller lacks `account:manage_integrations`.           |
| 404    | `Not found`         | Webhook does not exist or belongs to another account. |
| 500    | `INTERNAL_ERROR`    | Write failed.                                         |
