Guides
Webhooks

Webhooks

Register URLs per event type and understand payloads, retries and resends.

Bloquo notifies your app with a POST on every relevant change of deposits, withdrawals, refunds, trades, FX payments and counterparty compliance. Each delivery is RSA-signed (X-Bloquo-Signature header) and recorded as a notification order you can query and resend.

Register the URLs

Create one preference per orderType: Deposit, Withdrawal, Refund, Trade, FxPayment or Compliance. Only the Webhook channel delivers orders.

bash
curl -X POST https://bloquo.mimicr.dev/api/v1/customer/1001/notification/preference \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"notificationType": "Webhook", "orderType": "Withdrawal", "webhookUrl": "https://your-service.com/webhooks/bloquo"}'
json
{
  "status": true,
  "result": {
    "id": 1038,
    "customerId": 1001,
    "webhookUrl": "https://your-service.com/webhooks/bloquo",
    "email": null,
    "notificationType": "Webhook",
    "orderType": "Withdrawal",
    "isEnabled": true
  },
  "message": null
}
  • GET .../notification/preference lists the preferences (paginated with pageNumber).
  • PUT .../notification/preference with {"webhookUrl": "…"} replaces the URL of every enabled preference.
  • PUT .../notification/preference/enabled/false pauses them all; /enabled/true resumes.

An orderType outside the list answers 400 OrderType 'Pix' is not valid..

Which URL receives

orderTypeURL used
Deposit, Withdrawal, Refundthe webhookUrl sent on the order; otherwise the preference
Trade, FxPaymentthe preference only
Compliancethe customer's Compliance preference

With no URL, or with the preference disabled, the event is dropped and no notification order is created.

Bloquo says the Compliance URL comes from the compliance service. In Mimicr it is the Compliance preference.

When each event fires

orderTypeStatuses notified
DepositCOMPLETED, EXPIRED
RefundPROCESSING_REFUND, RETURNED
Withdrawalevery change: SENT_TO_CONNECTOR or PENDING_TREASURY on creation, PENDING_IN_BANK, COMPLETED, FAILED
Tradeevery change: PROCESSING, WaitingTreasury, COMPLETED, FAILED, REVERTED
FxPaymentevery change: WAITING_FUNDS, PENDING_APPROVAL, WAITING_WITHDRAWAL, COMPLETED, FAILED, REJECTED
Compliancethe decision on the counterparty relation: Approved or Rejected

Bloquo doesn't list the statuses that fire trade and FX payment webhooks. In Mimicr, every status change fires one.

Payloads

The body is JSON and varies by orderType. The webhookUrl field holds the URL that received the delivery. Deposit (and refund, with orderType: "REFUND"):

json
{
  "orderId": 1113,
  "orderType": "DEPOSIT",
  "accountId": 1004,
  "customerId": 1001,
  "amount": 200,
  "requestedAmount": 200,
  "feeAmount": 0,
  "totalAmount": 200,
  "currency": "BRL",
  "status": "COMPLETED",
  "requestedCounterparty": { "name": null, "taxId": null, "accountKey": null, "bankCode": null, "bankName": null, "bankBranch": null, "accountNumber": null, "bankId": null },
  "confirmedCounterparty": { "name": null, "taxId": null, "accountKey": null, "bankCode": null, "bankName": null, "bankBranch": null, "accountNumber": null, "bankId": null },
  "bankReference": "E1823612020261105201326CA2A49060",
  "finalizedAt": "2026-11-05T20:13:31.277Z",
  "failureReason": null,
  "e2eId": "E1823612020261105201326CA2A49060",
  "webhookUrl": "https://your-service.com/webhooks/bloquo"
}

Withdrawal: the same amount fields, plus failureReason, e2eId, walletAddress, blockchain, requestedCounterparty (the receiver) and confirmedCounterparty (filled on COMPLETED), with orderType: "WITHDRAWAL".

Trade:

json
{
  "reason": "Notification",
  "entityName": "Trade",
  "entityId": "1074",
  "operation": "StatusUpdate",
  "customerId": 1001,
  "orderId": 1074,
  "orderType": "Trade",
  "accountId": 1007,
  "status": "COMPLETED",
  "currency": "USD",
  "requestedAmount": 100,
  "quoteCurrency": "BRL",
  "quoteAmount": 522.6,
  "price": 5.226,
  "side": "Buy",
  "expireAt": null,
  "webhookUrl": "https://your-service.com/webhooks/bloquo"
}

FX payment:

json
{
  "orderId": 1112,
  "customerId": 1001,
  "counterpartyId": null,
  "fundingType": "DepositOrder",
  "fundingOwnerType": "Customer",
  "fundingOwnerId": 1001,
  "fundingCurrency": "BRL",
  "fundingAmount": 200,
  "depositOrderId": 1113,
  "status": "COMPLETED",
  "webhookUrl": "https://your-service.com/webhooks/bloquo"
}

Compliance:

json
{
  "customerId": 1001,
  "entityId": 1084,
  "baseChannel": "Webhook",
  "toEmail": null,
  "notifyTeams": false,
  "notifyTelegram": false,
  "notifyWebsocket": false,
  "status": "Approved",
  "counterparty": { "name": "Maria Santos", "taxId": "987.654.321-00", "accountKey": "987.654.321-00", "bankCode": null, "bankName": null, "bankBranch": null, "accountNumber": null, "bankId": null },
  "webhookUrl": "https://your-service.com/webhooks/bloquo"
}

The payload is fixed: it reflects the order at the moment the notification was created, even on a retry.

Delivery and retries

  • POST with Content-Type: application/json and X-Bloquo-Signature: t=<unix>,v1=<signature>. Verify it before processing: Verify the signature.
  • Any 2xx is a success. Any other status, a connection error or more than 10 seconds without a response is a failure.
  • After failed attempt n, the next one comes 2 min × 2^(n−1) later: 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1024 minutes.
  • There are 11 automatic attempts: the first, immediate one and 10 retries. If none succeeds, the notification becomes Failed (about 34 hours after the first).

Notification order status: Pending → Processing → Completed, or WaitingForRetry between failures, until Failed.

Bloquo's documentation contradicts itself: the text says "after 10 failed attempts", but the table lists 10 retries (2 to 1024 min) and the Failed status is described as "All 10 retry attempts exhausted". Mimicr follows the table: 1 attempt + 10 retries. The 10-second timeout is Mimicr's.

Query and resend

GET /api/v1/customer/{customerId}/notification/order lists the notification orders with the payload sent and each attempt (success, response, source Automatic or Manual). Filters: accountId, type, orderId, orderType, status; sorting with sortBy (CustomerId, OrderId, AccountId, CreatedAt) and sortOrder. With no results, the response is 204.

bash
curl -X POST https://bloquo.mimicr.dev/api/v1/customer/1001/notification/order/1121/resend \
  -H "Authorization: Bearer <token>"
json
{ "status": true, "result": "Completed", "message": null }

The resend makes a manual attempt right away and returns Completed or Failed. A manual attempt that fails leaves the notification Failed, with no further automatic retries.

Good practices

  • Answer 2xx fast and process later, from a queue.
  • Use orderId + orderType + status as the idempotency key: the same delivery may arrive more than once.
  • Monitor GET .../notification/order?status=Failed and resend whatever was left behind.

Test

bash
npx mimicr wait bloquo delivery order_type=Withdrawal order_id=1057 event=FAILED
curl "https://api.mimicr.dev/v1/bloquo/deliveries?order_type=Deposit&status=WaitingForRetry" -H "Authorization: Bearer mk_..."
npx mimicr action bloquo notification.resend notificationId=1121
npx mimicr clock bloquo +2h

Advance the clock so due retries run without waiting. To simulate a flaky URL, turn chaos on with webhookFailRate (first attempt fails) and webhookDuplicateRate (duplicate delivery). See Sandbox control.

Reference: Create notification preference, List notification preferences, Update notification webhook URL, Enable or disable notifications, List notification orders, Resend notification, Export notification report.