Quickstart: receive your first webhook
1. Create an HTTPS webhook endpoint
Create a route in your application that can receive Brale webhook deliveries. Example endpoint:2. Get an access token with webhook scopes
Your OAuth application or API credential needs webhook scopes (these are provisioned by default when you make a credential set).
For subscription creation, use a credential with both
webhooks:read and webhooks:write.
3. Discover available event types
4. Create a webhook subscription
Create a subscription for your endpoint and event types.Choose your
account_id. The account_id in the path is the account that owns the subscription. If you onboard customers as managed accounts, use your managing account ID. One subscription covers events for the managing account and its managed accounts, so you don’t need one per customer. Register it before onboarding customers so it is ready for asynchronous verification events. See Choose the subscription owner.sharedSecretis returned only once.- Store it immediately in a secrets manager or encrypted environment variable.
- Do not log it.
- Do not expose it to browsers or client-side code.
- If you lose it, archive the subscription and create a new one.
Example: managed-account onboarding
To receive verification events for customers you onboard, create the subscription on your managing account withaccount.*:
data.account_id identifies the account the event concerns, such as the managed customer whose verification completed. Use it to route the event to the right customer record.
5. Verify incoming webhooks
Every webhook includes:- Header names may appear with different capitalization depending on your framework/server. Treat them as case-insensitive.
- The
Idempotency-Keyyou send to the management API is not the same concept as theidempotency-keyheader Brale sends with each webhook delivery. Use the webhook eventidand/or the webhookidempotency-keyheader for deduplication.
- Read the exact raw request body bytes.
- Decode
sharedSecretfrom Base64URL to raw bytes. - Compute HMAC-SHA256 over the raw request body.
- Encode the digest as lowercase hex.
- Compare to
x-request-signature-sha-256using constant-time comparison. - Only then parse and process the JSON payload.
6. Return 2xx quickly
Return any2xx response after verification and safe receipt.
If processing takes longer, acknowledge quickly and process asynchronously.
7. Deduplicate events
Webhook deliveries are at-least-once. Your endpoint may receive the same event more than once. Deduplicate using:- The envelope
id - The
idempotency-keyheader