# Update a Webhook

Updates a webhook. Send `account_id` and the fields you want to change. Use it to point a webhook at a new `url`, change the events it receives, rotate the credentials WHITELABEL delivers with, or deactivate it.

`state` turns deliveries on and off: `INACTIVE` stops them and keeps the configuration, and `ACTIVE` resumes them. A rotated `api_key`, `secret` or `hmac_client_secret` applies to the next delivery. To remove `renewal_days`, send `clear_renewal_days` as `true` on its own.

<Note>
Trigger fields are replaced, not merged. Send the full list of events you want the webhook subscribed to, and omit the field to leave it as it is.
</Note>

The [OAuth2](/reference/webhooks#oauth2) fields are configured as a set: when you change any of `oauth2_authentication_url`, `oauth2_client_id`, `oauth2_client_secret` or `oauth2_grant_type`, send the four of them.

Renaming a webhook to a `name` the account already uses, or moving it onto a `url` where another webhook listens to one of the same events, returns `409 WEBHOOK_ALREADY_EXISTS`.

**PATCH** `/webhooks/{webhook_id}`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Updates a webhook. Send only the fields you want to change, including the state and any rotated secret.

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Path parameters

- `webhook_id` (string, required)
  The unique identifier of the webhook, as returned by [Create a Webhook](/reference/webhooks/create-webhook).

## Body

Content type: `application/json`

- `account_id` (string<uuid>, required)
  The unique identifier of the account the webhook belongs to.
- `name` (string)
  Your name for the webhook. It must be unique within the account.
- `state` ("ACTIVE" | "INACTIVE")
  Set it to `INACTIVE` to stop the deliveries while keeping the configuration, and back to `ACTIVE` to resume them.
- `url` (string)
  The endpoint WHITELABEL sends the notifications to. It must be an `http` or `https` URL that resolves to a public, routable address.
- `api_key` (string)
  Replaces the `x-api-key` WHITELABEL sends on every delivery.
- `secret` (string)
  Replaces the `x-secret` WHITELABEL sends on every delivery.
- `hmac_client_secret` (string)
  Replaces the key WHITELABEL signs the payload with.
- `oauth2_authentication_url` (string)
  Your token endpoint. It must use HTTPS. Send `oauth2_authentication_url`, `oauth2_client_id`, `oauth2_client_secret` and `oauth2_grant_type` together.
- `oauth2_client_id` (string)
  The client identifier WHITELABEL authenticates with. Send `oauth2_authentication_url`, `oauth2_client_id`, `oauth2_client_secret` and `oauth2_grant_type` together.
- `oauth2_client_secret` (string)
  The client secret WHITELABEL authenticates with. Send `oauth2_authentication_url`, `oauth2_client_id`, `oauth2_client_secret` and `oauth2_grant_type` together.
- `oauth2_grant_type` (string)
  The grant type WHITELABEL requests the token with. Send `oauth2_authentication_url`, `oauth2_client_id`, `oauth2_client_secret` and `oauth2_grant_type` together.
- `oauth2_scope` (string)
  The scope WHITELABEL requests the token with.
- `oauth2_authorization_name` (string)
  The header WHITELABEL sends the token in. Defaults to `Authorization`.
- `oauth2_include_client_id` (boolean)
  Send the client identifier as a header on the token request as well.
- `enrollment_triggers` ("ENROLL" | "UNENROLL"[])
  Replaces the enrollment events the webhook subscribes to.
- `payment_triggers` ("AUTHORIZE" | "CANCEL" | "CAPTURE" | "CHARGEBACK" | "PRECHARGEBACK" | "PURCHASE" | "REFUND" | "VERIFY"[])
  Replaces the payment events the webhook subscribes to.
- `report_triggers` ("CREATE" | "UPDATE"[])
  Replaces the report events the webhook subscribes to.
- `subscription_triggers` ("ACTIVE" | "CANCEL" | "CLOSE_TO_RENEWAL" | "COMPLETE" | "CREATE" | "PAUSE" | "PLAN_CHANGE_CANCELED" | "PLAN_CHANGE_SCHEDULED" | "PLAN_CHANGED" | "RESUME"[])
  Replaces the subscription events the webhook subscribes to.
- `onboarding_triggers` ("BLOCKED" | "CANCELLED" | "CREATED" | "DECLINED" | "ERROR" | "EXPIRED" | "INACTIVE" | "PENDING" | "SUCCEEDED" | "TRANSFERRED" | "UNBLOCKED"[])
  Replaces the onboarding events the webhook subscribes to.
- `renewal_days` (integer)
  How many days before a renewal WHITELABEL sends the `CLOSE_TO_RENEWAL` notification. It must be 1 or more. Send it on its own, not together with `clear_renewal_days`.
- `clear_renewal_days` (boolean)
  Set it to `true` to remove `renewal_days`. Send it on its own, not together with `renewal_days`.

Example:

```json
{
  "account_id": "493e9374-510a-4201-9e09-de669d75f256",
  "name": "Production payments listener",
  "state": "INACTIVE",
  "url": "https://api.acme.com/whitelabel/webhooks",
  "api_key": "my-webhook-key-v2",
  "secret": "my-rotated-secret",
  "hmac_client_secret": "my-rotated-hmac-secret",
  "oauth2_authentication_url": "https://api.acme.com/oauth/token",
  "oauth2_client_id": "acme_client_id",
  "oauth2_client_secret": "acme_client_secret",
  "oauth2_grant_type": "client_credentials",
  "oauth2_scope": "webhooks:write",
  "oauth2_authorization_name": "Authorization",
  "oauth2_include_client_id": true,
  "enrollment_triggers": [
    "ENROLL"
  ],
  "payment_triggers": [
    "AUTHORIZE",
    "CAPTURE",
    "REFUND"
  ],
  "report_triggers": [
    "UPDATE"
  ],
  "subscription_triggers": [
    "CREATE",
    "CANCEL"
  ],
  "onboarding_triggers": [
    "CREATED",
    "SUCCEEDED"
  ],
  "renewal_days": 5,
  "clear_renewal_days": true
}
```

## Responses

### 200

The updated webhook.

- `id` (string)
  The unique identifier of the webhook.
- `account_id` (string<uuid>)
  The unique identifier of the account the webhook belongs to.
- `name` (string)
  Your name for the webhook.
- `state` ("ACTIVE" | "INACTIVE")
  `ACTIVE` webhooks receive notifications, `INACTIVE` ones do not. A webhook starts out `ACTIVE`.
- `url` (string)
  The endpoint WHITELABEL sends the notifications to.
- `api_key` (string,null)
  Masked as `***`, or `null` when you have not configured it.
- `secret` (string,null)
  Masked as `***`, or `null` when you have not configured it.
- `hmac_client_secret` (string,null)
  Masked as `***`, or `null` when you have not configured it.
- `oauth2_authentication_url` (string,null)
  Your token endpoint.
- `oauth2_client_secret` (string,null)
  Masked as `***`, or `null` when you have not configured it.
- `oauth2_client_id` (string,null)
  The client identifier WHITELABEL authenticates with.
- `oauth2_grant_type` (string,null)
  The grant type WHITELABEL requests the token with.
- `oauth2_scope` (string,null)
  The scope WHITELABEL requests the token with.
- `oauth2_authorization_name` (string,null)
  The header WHITELABEL sends the token in.
- `oauth2_include_client_id` (boolean)
  Whether WHITELABEL also sends the client identifier as a header on the token request.
- `enrollment_triggers` (array,null)
  The enrollment events the webhook subscribes to.
- `payment_triggers` (array,null)
  The payment events the webhook subscribes to.
- `report_triggers` (array,null)
  The report events the webhook subscribes to.
- `subscription_triggers` (array,null)
  The subscription events the webhook subscribes to.
- `onboarding_triggers` (array,null)
  The onboarding events the webhook subscribes to.
- `renewal_days` (integer,null)
  How many days before a renewal WHITELABEL sends the `CLOSE_TO_RENEWAL` notification.
- `created_at` (string<date-time>)
  The date and time the webhook was created, in ISO 8601.
- `updated_at` (string<date-time>)
  The date and time the webhook was last updated, in ISO 8601. It matches `created_at` until you update the webhook for the first time.

Example:

```json
{
  "id": "12345",
  "account_id": "493e9374-510a-4201-9e09-de669d75f256",
  "name": "Production payments listener",
  "state": "ACTIVE",
  "url": "https://api.acme.com/whitelabel/webhooks",
  "api_key": "***",
  "secret": "***",
  "hmac_client_secret": "***",
  "oauth2_authentication_url": "https://api.acme.com/oauth/token",
  "oauth2_client_secret": "***",
  "oauth2_client_id": "acme_client_id",
  "oauth2_grant_type": "client_credentials",
  "oauth2_scope": "webhooks:write",
  "oauth2_authorization_name": "Authorization",
  "oauth2_include_client_id": true,
  "enrollment_triggers": [
    "ENROLL",
    "UNENROLL"
  ],
  "payment_triggers": [
    "AUTHORIZE",
    "CAPTURE",
    "REFUND"
  ],
  "report_triggers": [
    "UPDATE"
  ],
  "subscription_triggers": [
    "CREATE",
    "CLOSE_TO_RENEWAL"
  ],
  "onboarding_triggers": [
    "CREATED",
    "SUCCEEDED"
  ],
  "renewal_days": 5,
  "created_at": "2026-07-09T13:05:36.482913Z",
  "updated_at": "2026-07-11T16:20:44.918330Z"
}
```

### 400

The request is invalid. The `code` tells you which rule it broke.

- `code` ("WEBHOOK_INVALID_REQUEST" | "INVALID_ACCOUNT_ID" | "WEBHOOK_INVALID_TRIGGER" | "WEBHOOK_INVALID_OAUTH2" | "WEBHOOK_INVALID_RENEWAL_DAYS" | "WEBHOOK_URL_UNSAFE")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "WEBHOOK_INVALID_REQUEST",
  "messages": [
    "string"
  ]
}
```

### 401

Your API credentials are missing or invalid.

- `code` ("NOT_AUTHENTICATED" | "INVALID_CREDENTIALS")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "NOT_AUTHENTICATED",
  "messages": [
    "string"
  ]
}
```

### 404

There is no webhook with that identifier on the account.

- `code` ("WEBHOOK_NOT_FOUND")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "WEBHOOK_NOT_FOUND",
  "messages": [
    "string"
  ]
}
```

### 409

The account already has a webhook with that name, or one with the same URL that listens to one of the same events.

- `code` ("WEBHOOK_ALREADY_EXISTS")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "WEBHOOK_ALREADY_EXISTS",
  "messages": [
    "string"
  ]
}
```

### 502

The webhook service is temporarily unavailable.

- `code` ("WEBHOOK_UPSTREAM_ERROR")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "WEBHOOK_UPSTREAM_ERROR",
  "messages": [
    "string"
  ]
}
```