# Webhooks Overview

A webhook tells WHITELABEL where to send event notifications (`url`), which events to send (triggers), and how WHITELABEL should authenticate to your endpoint when it delivers them. The same configuration is available from the [WHITELABEL dashboard](/docs/webhooks/configure-webhooks).

`account_id` is required on every request, in the body for `POST` and `PATCH` and as a query parameter for `GET` and `DELETE`. You can only manage the webhooks of the accounts in your own organization.

## Secrets

Secrets are write-only. `api_key`, `secret`, `hmac_client_secret` and `oauth2_client_secret` are returned as `***` once configured, and as `null` otherwise.

To keep a secret as it is, omit it from the update. Sending the masked value back stores `***` as the secret itself, and sending an empty string removes the secret.

## Triggers

A webhook subscribes to events through five trigger fields, one per domain, and needs at least one trigger. A webhook with `payment_triggers: ["AUTHORIZE"]` is notified when a payment is authorized. Place each trigger in the field of its own domain, since the field is what subscribes the webhook to that family of events. See [Events and Triggers](/docs/webhooks/events) for every value each field accepts and the event it maps to, and [Payloads and Examples](/docs/webhooks/object-and-examples) for the payload each one carries.

| Field | Subscribes to |
| :---- | :------------- |
| `enrollment_triggers` | Payment method enrollment and unenrollment |
| `payment_triggers` | Payment lifecycle events (authorize, capture, refund, and more) |
| `subscription_triggers` | Subscription lifecycle events |
| `onboarding_triggers` | Onboarding lifecycle events |
| `report_triggers` | Report lifecycle events |

`renewal_days` sets how many days before a renewal WHITELABEL sends the `CLOSE_TO_RENEWAL` notification, and is valid only when `subscription_triggers` contains `CLOSE_TO_RENEWAL`.

## Delivery authentication

This is how WHITELABEL authenticates to your endpoint when it sends an event, so your receiver can tell a genuine notification from a forged one. All the methods are optional and you can combine them.

### API key and secret

Configure `api_key` and `secret`. WHITELABEL sends them as headers on every delivery, and your endpoint checks that they match what you configured.

```http
x-api-key: <api_key>
x-secret:  <secret>
```

### HMAC signature

Configure `hmac_client_secret`. WHITELABEL signs the payload with it and sends the signature as a header, so you can verify that the notification is authentic and was not tampered with.

A webhook's authentication (including `hmac_client_secret`) is scoped to the webhook object itself, not to a specific payment provider connection. If your account routes payments through multiple PSP connections, a single webhook still delivers and signs events for all of them the same way — there's no separate secret per connection. Configure more than one webhook only if you need events split across different endpoints, not to segment by provider.

```http
x-hmac-signature: Base64(
  HMAC-SHA256(key = hmac_client_secret, msg = <raw request body>)
)
```

See [Verify Webhook Signatures (HMAC)](/docs/webhooks/verify-webhook-signatures-hmac) for how to compute and check this signature.

### OAuth2

Configure your token endpoint and your client credentials. Before delivering, WHITELABEL requests a token from your endpoint and sends it as `Authorization: Bearer <token>`.

Your token endpoint must use HTTPS. WHITELABEL reuses a token across the deliveries of an account until it is close to expiring, so a short-lived token means a token request on almost every delivery.

| Field | Description |
| :---- | :---- |
| `oauth2_authentication_url` | Your token endpoint, over HTTPS. |
| `oauth2_client_id` | The client identifier WHITELABEL authenticates with. |
| `oauth2_client_secret` | The client secret WHITELABEL authenticates with. |
| `oauth2_grant_type` | The grant type WHITELABEL requests the token with, typically `client_credentials`. |
| `oauth2_scope` | The scope WHITELABEL requests the token with. Set it with [Update a Webhook](/reference/webhooks/update-webhook). |
| `oauth2_authorization_name` | The header WHITELABEL sends the token in. Defaults to `Authorization`. |
| `oauth2_include_client_id` | Send the client identifier as a header on the token request as well. |

Send `oauth2_authentication_url`, `oauth2_client_id`, `oauth2_client_secret` and `oauth2_grant_type` together, since they are configured as a set.