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

# Update Webhook

> Modify an existing webhook's URL, events, or active state

## Request

### Path Parameters

<ParamField path="id" type="string" required>
  The webhook's unique ID (UUID)
</ParamField>

### Headers

```
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
```

<Note>
  Requires an API key with the `webhooks:write` permission. All body fields are optional — only include the fields you want to change.
</Note>

### Body Parameters

<ParamField body="url" type="string">
  New HTTPS target URL. Must start with `https://` and not resolve to a private IP.
</ParamField>

<ParamField body="events" type="array">
  Replacement array of event type strings. **This replaces the full list** — it is not merged. To remove an event, send the array without it.
</ParamField>

<ParamField body="active" type="boolean">
  Pause (`false`) or resume (`true`) deliveries without changing configuration.
</ParamField>

<ParamField body="description" type="string">
  Update the human-readable description.
</ParamField>

## Response

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="webhook" type="object">
      <Expandable title="Webhook object">
        <ResponseField name="id" type="string">
          Webhook ID
        </ResponseField>

        <ResponseField name="url" type="string">
          Target URL
        </ResponseField>

        <ResponseField name="events" type="array">
          Current subscribed events
        </ResponseField>

        <ResponseField name="description" type="string">
          Description
        </ResponseField>

        <ResponseField name="active" type="boolean">
          Whether deliveries are enabled
        </ResponseField>

        <ResponseField name="updated_at" type="string">
          ISO 8601 timestamp of this update
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  The signing secret does **not** change on update. To rotate the secret, delete and recreate the webhook.
</Warning>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://data.leadlex.com/functions/v1/api-gateway/v1/webhooks/7f3c4d2a-1b8e-4a9c-9d6f-2e5b8c7a1f3d \
    -H "Authorization: Bearer wbk_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "events": ["contact.created", "contact.updated", "deal.updated"],
      "active": true
    }'
  ```

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

  API_KEY = "wbk_your_api_key_here"
  BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
  WEBHOOK_ID = "7f3c4d2a-1b8e-4a9c-9d6f-2e5b8c7a1f3d"

  response = requests.patch(
      f"{BASE_URL}/v1/webhooks/{WEBHOOK_ID}",
      headers={
          "Authorization": f"Bearer {API_KEY}",
          "Content-Type": "application/json",
      },
      json={
          "events": ["contact.created", "contact.updated", "deal.updated"],
          "active": True,
      },
  )

  webhook = response.json()["data"]["webhook"]
  ```

  ```javascript JavaScript theme={null}
  const WEBHOOK_ID = '7f3c4d2a-1b8e-4a9c-9d6f-2e5b8c7a1f3d';

  const response = await fetch(
    `https://data.leadlex.com/functions/v1/api-gateway/v1/webhooks/${WEBHOOK_ID}`,
    {
      method: 'PATCH',
      headers: {
        'Authorization': 'Bearer wbk_your_api_key_here',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        events: ['contact.created', 'contact.updated', 'deal.updated'],
        active: true,
      }),
    }
  );
  const { data } = await response.json();
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "data": {
    "webhook": {
      "id": "7f3c4d2a-1b8e-4a9c-9d6f-2e5b8c7a1f3d",
      "url": "https://example.com/leadlex/webhook",
      "events": ["contact.created", "contact.updated", "deal.updated"],
      "description": "Production CRM sync",
      "active": true,
      "updated_at": "2026-04-17T14:30:00Z"
    }
  }
}
```

## Errors

| Status | Code                       | Description                                              |
| ------ | -------------------------- | -------------------------------------------------------- |
| 400    | `invalid_url`              | URL is not HTTPS, malformed, or resolves to a private IP |
| 400    | `invalid_events`           | One or more event names are not recognized               |
| 401    | `invalid_key`              | Invalid or expired API key                               |
| 403    | `insufficient_permissions` | Missing `webhooks:write` permission                      |
| 404    | `webhook_not_found`        | No webhook with this ID in your workspace                |
| 429    | `rate_limited`             | Rate limit exceeded                                      |
