What is a Webhook Event?
A webhook event is a real-time notification sent from the Capa API to a partner’s specified URL whenever a specific action or change occurs within our system. These events could relate to a variety of operations, such as user verification (KYC) updates, transaction status changes, and more.General Structure of Webhook Events
Each webhook event sent by the Capa API follows a standardized structure to ensure consistency and ease of integration. Below is the general structure of a webhook event:- Event Type: A category defining the nature of the event.
- We currently support this type of events:
KYCTRANSACTIONUSER(bank account verification events)SIGNATURE(document/cédula signature events)
- We currently support this type of events:
- Event Name: A specific identifier of the event type (e.g.,
VERIFIED_USER,COMPLETED_ON_RAMP). - Payload: Contains relevant data and details specific to the event type.
type and event at the top level next to the event’s own fields. The notification id is not in the body; it is sent in the capa-delivery-id header (see Delivery Headers).
Example of a General Webhook Event
Field Conventions
- Optional fields are omitted when they have no value; they are not sent as
null. Treat anullthe same as a missing field. - Amounts (
fiatAmount,cryptoAmount,sourceAmount,targetAmount) are decimal strings: fiat with 2 decimals, crypto with 6.exchangeRateandrefundAmountare numbers. externalUserIdis present on every event (TRANSACTION,KYC,USERandSIGNATURE) and is never empty. If you created the user without anexternalUserId, it is the UUID Capa generated and returned in the Create User response.userId(Capa’s user id) andpartnerIdare included onTRANSACTIONandSIGNATUREevents.KYCandUSERevents carry onlyexternalUserId.- New fields and events can be added without notice. Ignore fields and
eventvalues you do not recognize.
blockchain Values
Transaction events that carry blockchain also carry blockchainSymbol, the chain code used in API requests: one of POL, SOL, ETH, BSC or TRX. Use blockchainSymbol rather than blockchain, and treat it as an open set. blockchainSymbol is optional: events created before it was added don’t have it, so fall back to blockchain when it is missing.
The blockchain field is the chain’s display name. The table maps the supported chains to their blockchainSymbol. The Create Quote, Create On-Ramp and Create Off-Ramp schemas document the chains you can request.
Display names are not guaranteed to stay the same, so if you have to map them, do it defensively (for example, fall back to reading the transaction when a name is unknown). Cross-ramp lifecycle events have no
blockchain or blockchainSymbol field; cross-ramp refund events do, describing Capa’s internal conversion.
Security and Authentication
To ensure secure communication, each webhook event is signed using HMAC (Hash-based Message Authentication Code) authentication. This signature is computed using a secret key shared between Capa and the partner. The partner must validate the signature to confirm that the notification is genuine and has not been tampered with.Common Event Types
-
KYC (Know Your Customer) Events:
- Triggered when there are updates or changes in the user’s identity verification process.
- Examples:
VERIFIED_USER,REJECTED_KYC,REVIEW_NEEDED_KYC.
-
Transaction Events:
- Triggered when there are updates or changes related to user transactions, such as cryptocurrency exchanges, purchases, or cancellations.
- Examples:
COMPLETED_ON_RAMP,COMPLETED_OFF_RAMP,CRYPTO_RECEIVED_OFF_RAMP,CANCELLED_ON_RAMP.
-
Signature Events:
- Triggered when a user or beneficial owner completes a document signature, such as the UBO cédula required for MX cross-ramp business users.
- Example:
DOCUMENT_SIGNED.
Handling Webhook Events
1. Registering a Webhook URL
Partners need to register a single webhook URL where they want to receive notifications. This URL should be provided via the designated endpoint:- Endpoint: PUT /api/partner/v2/webhook-settings
- Request Body Example:
2. Receiving Webhook Notifications
When an event occurs, the Capa API sends a POST request to the partner’s registered webhook URL. Partners should ensure their endpoints are always available to receive these notifications.3. Validating the Signature
Partners should validate the HMAC signature included in the event header to ensure the integrity and authenticity of the notification. This helps protect against tampered or spoofed events.4. Responding to Webhook Events
Respond with any2xx status to acknowledge receipt. Any other status code (including redirects), a timeout or a connection error counts as a failed attempt.
Error Handling and Retries
- Automatic Retries: Capa makes up to 5 delivery attempts, at about +0, +1, +6, +16 and +31 minutes, then marks the notification
FAILED. See How Our Webhooks Work. - Manual Retries: You can retry a
FAILED(orNOT_SENT) notification up to 3 times with the Retry Webhook Notification endpoint. Each retry starts a new cycle of attempts. - Duplicates and ordering: Delivery is at least once and not ordered. Deduplicate on the
capa-delivery-idheader.
Best Practices for Handling Events
- Ensure Endpoint Availability: Make sure your webhook URL is always available and responsive to receive notifications.
- Handle Retries Gracefully: Deduplicate on the
capa-delivery-idheader; it is the same on every retry of a notification. - Secure Your Webhook Endpoint: Validate the HMAC signature and use HTTPS to ensure secure communication.
- Log and Monitor Events: Log all incoming events and monitor them to detect any issues early.