How Webhooks Work
1
Register endpoint
Configure a webhook endpoint URL in the HIFI Dashboard.
2
Receive events
HIFI sends POST requests to your endpoint when events occur.
3
Verify signature
Validate the JWT signature using your webhook secret to ensure authenticity.
4
Process event
Execute your application logic based on the event data.
5
Return 2xx response
Respond with a 2xx status code to acknowledge receipt.
Registering Webhooks
Register webhook endpoints in the HIFI Dashboard:- Navigate to Developer → Webhooks
- Enter your webhook URL (must be HTTPS)
- Save to receive your webhook secret
Webhook Secret: After registration, you’ll receive a public key used to
verify webhook signatures. Store this securely - you’ll need it to validate
incoming requests.
Event Structure
All webhook events follow a consistent structure:Event Types
HIFI sends webhook events for various types of operations. Each event category has a dedicated page with detailed information about the event types, payloads, and examples.- User Events - Events for user creation and updates
- KYC Events - Events for KYC data and status changes
- Wallet Events - Events for wallet transfers, bridges, and token balance updates
- Account Events - Events for onramp, offramp, and virtual account creation and updates
- Onramp Events - Events for onramp transfer creation and status updates
- Offramp Events - Events for offramp transfer creation and status updates
Verifying Webhook Signatures
Critical: Always verify webhook signatures to ensure requests are from HIFI and haven’t been tampered with.Verification Process
Webhooks include a JWT token in theAuthorization header. Verify this token using your webhook public key:
- Extract the JWT token from the
Authorization: Bearer <token>header - Verify the token using your webhook public key with RS256 algorithm
- If verification succeeds, process the event
- If verification fails, reject the request with 401 status
Implementation Examples
Retry Behavior
HIFI automatically retries failed webhook deliveries to ensure reliability.Retry Schedule
- Duration: Up to 24 hours
- Strategy: Exponential backoff
- Interval: 60 seconds to 1 hour between retries
- Success criteria: Your endpoint returns a 2xx status code
Retry Conditions
HIFI retries when:- Your endpoint returns a 5xx error
- Connection timeout occurs
- Network error prevents delivery
- Your endpoint returns a 4xx error (indicates a permanent failure)
- Your webhook endpoint is disabled or deleted
- 24 hours have elapsed since the original event
Best Practices
Respond quickly
Respond quickly
Return a 2xx response as soon as you receive the webhook, before processing the event. Process the event asynchronously to avoid timeouts:
Implement idempotency
Implement idempotency
Use
eventId to ensure you process each event only once. Store processed event IDs:Handle event order
Handle event order
Events may arrive out of order. Use
createdAt and timestamp to determine the correct sequence. Store the latest known state:Monitor webhook health
Monitor webhook health
Track webhook delivery success rates and response times. Set up alerts for: -
High failure rates - Slow response times - Signature verification failures
This helps identify issues early before retries are exhausted.
Test with sandbox
Test with sandbox
Use the HIFI sandbox environment to test your webhook integration:
- Register a test webhook endpoint
- Trigger test events using sandbox API
- Verify your endpoint handles events correctly
- Test retry behavior by temporarily failing your endpoint
Getting Help
- 📧 Email: support@hifi.com
- 💬 Slack: Message us in our shared Slack channel
Related Resources
- Wallet Transfers - Track transfer events
- Onramps - Monitor onramp events
- Offramps - Track offramp events
- Users - Monitor user and KYC events