Skip to main content

What webhooks do

Webhooks push signed HTTP POST requests to a URL you control whenever a KavachOS auth event occurs. Use them to sync user records, trigger onboarding flows, alert on suspicious logins, or feed events into your analytics pipeline.

Setup

Store the webhook secret in an environment variable, not in source code. KavachOS uses it to sign every request with HMAC-SHA256.

Subscribing to events

Each endpoint subscribes to one or more event types. Use '*' to receive all events.

Event reference

Request headers

Every webhook delivery includes these headers:

Verifying signatures

Always verify the signature before trusting the payload.

Retry behavior

If your endpoint returns a non-2xx status or times out, KavachOS retries the delivery three times with exponential backoff: After three failures the delivery is marked failed and no further retries occur.

Testing a webhook URL

Use the kavach.webhooks.test() method to send a synthetic ping event to any registered endpoint:
The test delivery sends { event: 'ping', timestamp: '...' } and respects the same signing and retry logic as real events.

Next steps

Lifecycle hooks

Run async callbacks on auth events inside the SDK process.

Audit log

Query the full record of every authorization decision.
Last modified on April 29, 2026