Skip to main content
Register a webhook to receive real-time deposit and conversion notifications. Receive real-time events for deposits and conversions.

Register Webhook

Use this endpoint to register the URL that will receive webhook callbacks. The webhook will notify your server when deposit or conversion events occur. POST /webhook/register
curl -X POST "https://api.useonion.xyz/v1/webhook/register" \
  -H "x-api-key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "client-id",
    "webhookUrl": "https://your-webhook-endpoint.com/webhook"
  }'

Request Body

FieldTypeRequiredDescription
clientIdstringYesYour Onion Finance client ID.
webhookUrlstringYesHTTPS endpoint that will accept POST events.

Response (200 OK)

{
  "success": true,
  "message": "Webhook URL registered successfully",
  "webhookUrl": "https://your-webhook-endpoint.com/webhook"
}

Response (4xx/5xx)

{ "error": "Invalid API key" }

Event Types

EventDescription
deposit.completedNew deposit has been confirmed
conversion.completedFX conversion has been completed

Sample Payload

{
  "event": "deposit.completed",
  "data": {
    "userId": "user_abc123",
    "amount": 5000,
    "currency": "NGN",
    "reference": "PSK123456",
    "timestamp": "2025-05-05T14:15:05Z"
  }
}