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

# Update Webhook Subscription

> Modify webhook subscription metadata, events, or status.

## Method

`PATCH` `/v1/webhooks/subscriptions/:id`

## Path Parameters

<ParamField path="id" type="uuid" required>Webhook subscription ID.</ParamField>

## Headers

<ParamField header="Authorization" type="string">Bearer token (requires `webhooks:write`).</ParamField>
<ParamField header="content-type" type="string">`application/json`</ParamField>

## Body Parameters

All fields are optional; include only the properties you want to change.

<ParamField name="url" type="string">Update the delivery endpoint (must be HTTPS).</ParamField>
<ParamField name="events" type="array">Replace the event list (must contain at least one string value).</ParamField>
<ParamField name="headers" type="object">Replace custom headers; pass `null` to clear.</ParamField>
<ParamField name="maxRetries" type="integer">Update retry limit (0–10).</ParamField>
<ParamField name="description" type="string">Update the description; pass `null` to clear.</ParamField>
<ParamField name="active" type="boolean">Pause (`false`) or resume (`true`) deliveries.</ParamField>

## Request Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.voyantcloud.com/v1/webhooks/subscriptions/whsub_01J0J3Y3TFX2V22Y7DQ0A6J5G5" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "events": ["booking.*"],
      "active": false,
      "headers": null
    }'
  ```

  ```javascript Node.js theme={null}
  await fetch("https://api.voyantcloud.com/v1/webhooks/subscriptions/whsub_01J0J3Y3TFX2V22Y7DQ0A6J5G5", {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
      "content-type": "application/json",
    },
    body: JSON.stringify({ maxRetries: 3, description: "Critical booking feed" }),
  })
  ```

  ```python Python theme={null}
  import os, requests

  payload = {"active": True, "events": ["product.*", "booking.created"]}

  resp = requests.patch(
    "https://api.voyantcloud.com/v1/webhooks/subscriptions/whsub_01J0J3Y3TFX2V22Y7DQ0A6J5G5",
    headers={
      "Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}",
      "content-type": "application/json",
    },
    json=payload,
  )
  updated = resp.json()["data"]
  ```
</RequestExample>

## Response Example

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "data": {
      "id": "whsub_01J0J3Y3TFX2V22Y7DQ0A6J5G5",
      "workspace_id": "ws_4a82d5bd-3330-4ad3-bf46-1b6a9a5d5d6a",
      "url": "https://example.com/webhooks/voyant",
      "events": ["booking.*"],
      "active": false,
      "max_retries": 3,
      "headers": null,
      "description": "Critical booking feed",
      "created_at": "2025-03-01T09:12:33.000Z",
      "updated_at": "2025-03-10T11:45:00.000Z",
      "last_delivery_at": "2025-03-09T18:11:04.000Z",
      "failure_count": 0
    }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": "Invalid request body",
    "code": "VALIDATION_400",
    "details": [
      { "message": "At least one field must be provided" }
    ]
  }
  ```
</ResponseExample>
