Overview
The Karma Business API acts as a webhook relay for Bridge API events. When Bridge sends webhook events to our central endpoint, we automatically forward them to your configured webhook URL.Architecture
How It Works
- Bridge sends webhook event to Karma’s endpoint
- Karma receives and validates the event payload
- Karma identifies your business based on the
external_user_idorcustomer_idin the event - Karma forwards the complete event to your configured webhook URL
- Karma returns 200 OK to Bridge
Step 1: Configure Your Webhook URL
Use the admin API to set a webhook URL for your business:- URL must use HTTPS
- URL must be publicly accessible
- Endpoint should return 200 status code quickly
Step 2: Implement Webhook Endpoint
Create an endpoint in your application to receive webhooks:Step 3: Handle Different Event Types
Process events based on their type:Step 4: Use Idempotency Keys
Events may be delivered multiple times. Useevent_id as an idempotency key:
Common Event Types
Virtual Account Events
| Event Type | Description |
|---|---|
virtual_account.activity.created | Fiat deposit received |
transfer.created | Transfer initiated |
transfer.completed | Crypto sent to destination |
Liquidation Address Events
| Event Type | Description |
|---|---|
liquidation_address.drain.completed | Crypto converted and fiat sent |
liquidation_address.drain.failed | Liquidation failed |
KYC Events
| Event Type | Description |
|---|---|
kyc_link.approved | KYC verification approved |
kyc_link.rejected | KYC verification rejected |
customer.created | Customer account created (after ToS) |
Event Structure
Bridge webhook events follow this structure:Headers Sent to Your Endpoint
When forwarding events, Karma includes these headers:Best Practices
Return 200 quickly
Return 200 quickly
Respond with
200 OK within 5 seconds. Process events asynchronously if needed to avoid timeouts.Use idempotency
Use idempotency
Webhook events may be delivered more than once. Use the
event_id to ensure idempotent processing.Use HTTPS
Use HTTPS
Your webhook URL must use HTTPS in production to encrypt event data.
Handle errors gracefully
Handle errors gracefully
If your processing fails, log the error but still return 200 to prevent retries. Store the event for manual review.
Testing Webhooks Locally
For testing webhooks locally, use tools like ngrok to expose your local server to the internet:Next Steps
- Webhook API Reference - Full webhook endpoint documentation
- Update Webhook URL - Change your webhook configuration
