> ## Documentation Index
> Fetch the complete documentation index at: https://www.bitnob.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bitnob has two APIs. The Business API (payouts, cards, trading, virtual accounts, stablecoin and bitcoin transfers) is at https://api.bitnob.com. The Enterprise API (non-custodial wallets) is at https://api.platform.bitnob.com.
> Business API auth: sign every request with HMAC-SHA256 and send four headers: `X-Auth-Client` (your client ID), `X-Auth-Timestamp` (Unix seconds), `X-Auth-Nonce` (16 random bytes, hex), and `X-Auth-Signature`, the hex HMAC-SHA256 of `CLIENT_ID:TIMESTAMP:NONCE:BODY` keyed with your client secret. BODY is the exact request body string you send, or an empty string. A missing header, a bad signature, or a timestamp more than about 5 minutes off returns `401`.
> Enterprise API auth: send your key in the `X-API-Key` header. Write requests such as creating a transaction also need an `Idempotency-Key` header, or they fail with `idempotency_key_required` before anything happens.
> Sandbox and production share the Business API base URL. The credentials you sign with select the environment, and `GET /api/whoami` returns it in `data.environment`. Use sandbox credentials in sample code and tests, and never put live credentials in code.
> Amounts are strings unless stated otherwise. Never parse them into floats. Balances, transactions, withdrawals (`POST /api/withdrawals`) and virtual accounts use integer strings in the smallest unit: satoshis for BTC, 6 decimals for USDT and USDC, kobo for NGN, and cents for KES and UGX (100 is 1 KES or 1 UGX). A mobile money collection takes `amount` as a JSON integer in cents.
> Payouts and trading use decimal strings in major units: a payout quote `amount` of `"1"` is 1 USDT, and a trading `quantity` of `"0.0001"` is 0.0001 BTC. Payout responses also carry `cent_amount`, the settlement amount in minor units.
> Card amounts are micro-units (1 USD = 1,000,000). Send them as JSON integers. Card responses return them as integer strings, and card webhooks as integers.
> Generate a unique `reference` for each money movement before the first attempt, and reuse it on retries. A reused reference returns `409` on payout quotes (`ALREADY_EXISTS`), withdrawals (`DUPLICATE_KEY_ERROR`) and card creation (`ALREADY_EXISTS`). It returns the existing record on NGN-pair trading orders, NGN virtual accounts and active mobile money collections. On a mobile money collection that has closed or failed it returns `409` `DUPLICATE_REFERENCE`. It isn't checked on crypto-pair trading orders, so look the order up with `GET /api/trading/orders/{reference}` before resending.
> Quotes expire at `expires_at`; read it from the response instead of assuming a window. An expired trading quote returns `422` `PRECONDITION_FAILED`, and an expired payout quote returns `400` `VALIDATION_ERROR`. Create a new quote rather than retrying. A payout quote can be initialized once, and a trading quote is consumed by the order that fills it.
> Webhooks: verify the `x-bitnob-signature` header, the hex HMAC-SHA512 of the raw request body keyed with your webhook secret, before parsing JSON. Compare in constant time and de-duplicate on `event_id`. A successful API response means accepted: confirm the outcome from the webhook, such as `payouts.withdrawal.success`.
> Errors return `status`, `code` and `detail`. Branch on `code`, never on `detail`. Since the November 5, 2026 response format change, each company gets either the current or the new error codes until its cutoff date, so handle both: `PROVIDER_ERROR` or `PROCESSING_ERROR`, and `BVN_PROVIDER_UNAVAILABLE` or `BVN_VERIFICATION_UNAVAILABLE`. A body that fails to parse returns `{"error": {"code": "BAD_REQUEST"}}`.

# Receive payout webhooks

> Payout webhooks deliver five events to your callback URL. Verify the signature, de-duplicate on `event_id`, and act on `event`, never `data.status`.

Bitnob notifies your server as a payout advances, so you can update records and notify users without polling. Set the destination with `callback_url` when you [initialize a payout](https://www.bitnob.dev/api-reference/payouts/initialize-payout.md), or configure a global webhook URL on your dashboard.

Before handling payout events, have the shared plumbing in place from [Webhooks](https://www.bitnob.dev/docs/payouts/webhook-events.md): verify the `x-bitnob-signature` HMAC on every delivery, return `200` quickly, and expect retries, which means the same event can arrive more than once. De-duplicate on `event_id`.

## The five events

| Event | Fires when | Act on it |
| - | - | - |
| `payouts.initialized` | Payout accepted against a quote. Nothing settled. | Mark as in flight. |
| `payouts.processing` | Bitnob started sending it to the settlement rail. Not yet delivered. | Show progress. |
| `payouts.withdrawal.success` | Funds delivered to the beneficiary. | Credit the order, notify the user. |
| `payouts.withdrawal.expired` | Quote expired unfunded. Nothing settled. | Re-quote to retry. |
| `payouts.withdrawal.failed` | The payout failed. | Read `failure_reason`, then fix the cause or re-quote. |

This is the complete catalog. Webhooks can be missed, so also run a reconciliation sweep against [Get payout](https://www.bitnob.dev/api-reference/payouts/get-payout.md).

> [!NOTE]
>
> `data.status` in a payout webhook is the lowercase event outcome (`initiated`, `pending_address_deposit`, `processing`, `success`, `expired`, `failed`). It is not the payout record's uppercase lifecycle status. Route on the `event` field.

## Payloads

Every event carries the payout record, so field names match the payouts API responses. Use `reference` to match events to your own records. On `payouts.withdrawal.success`, `completed_at` is when settlement finished; act on this event when crediting an order. On `payouts.withdrawal.expired`, nothing settled; create a fresh quote to retry.

```json payouts.initialized theme={null}
{
  "event": "payouts.initialized",
  "event_id": "802561d3-78fa-4436-a3cc-fdbebe4772ed",
  "data": {
    "id": "019f8132-4969-7e63-a2da-c439ace1613d",
    "quote_id": "QT2_21434859",
    "company_id": "00000000-0000-4000-8000-000000000001",
    "reference": "6c9ace6b-891a-4b91-bff4-8bfdh784jc3f",
    "status": "initiated",
    "from_asset": "btc",
    "to_currency": "ngn",
    "amount": "0.00018555",
    "settlement_amount": "16823.2",
    "fees": "0",
    "fee_currency": "USD",
    "source_fee": "0",
    "total_amount": "0.00018555",
    "beneficiary": {
      "country": "NG",
      "bank_code": "100004",
      "account_number": "****3123"
    },
    "created_at": "2026-07-20T20:23:04.297953Z",
    "updated_at": "2026-07-20T20:23:25.444269082Z"
  }
}
```

```json payouts.processing theme={null}
{
  "event": "payouts.processing",
  "event_id": "51ff21dc-9629-41b5-8771-9cbc0d670000",
  "data": {
    "id": "019f8330-71e6-7649-a382-2209fd73b56f",
    "quote_id": "QT2_21439667",
    "company_id": "00000000-0000-4000-8000-000000000001",
    "reference": "4fb1e02e-1234-467a-b91b-3a18dc000000",
    "status": "processing",
    "from_asset": "usdt",
    "to_currency": "ngn",
    "amount": "1.801875",
    "settlement_amount": "2500",
    "fees": "0",
    "fee_currency": "USD",
    "source_fee": "0",
    "total_amount": "1.801875",
    "beneficiary": {
      "country": "NG",
      "bank_code": "100004",
      "account_number": "****4000"
    },
    "created_at": "2026-07-21T05:40:18.02242Z",
    "updated_at": "2026-07-21T05:40:47.522051588Z"
  }
}
```

```json payouts.withdrawal.success theme={null}
{
  "event": "payouts.withdrawal.success",
  "event_id": "d9c47581-5e93-4cdf-bb12-3f0a47486500",
  "data": {
    "id": "019f812d-ed2c-7f17-a2e9-12435e670813",
    "quote_id": "QT2_21434859",
    "company_id": "00000000-0000-4000-8000-000000000001",
    "reference": "76543-1234-4304-869j-3a98e85f0812",
    "status": "success",
    "from_asset": "usdt",
    "to_currency": "ngn",
    "amount": "100.988948",
    "settlement_amount": "140174.8",
    "fees": "0",
    "fee_currency": "USD",
    "source_fee": "0",
    "total_amount": "100.988948",
    "beneficiary": {
      "country": "NG",
      "bank_code": "100004",
      "account_number": "****3001"
    },
    "created_at": "2026-07-20T20:18:18.541002Z",
    "updated_at": "2026-07-20T20:18:39.515031203Z",
    "completed_at": "2026-07-20T20:18:39.515031203Z"
  }
}
```

```json payouts.withdrawal.expired theme={null}
{
  "event": "payouts.withdrawal.expired",
  "event_id": "0756585e-80a1-4eb8-a9aa-859574500000",
  "data": {
    "id": "019f8128-01b9-7801-b123-123456789abc",
    "quote_id": "QT2_21434706",
    "company_id": "00000000-0000-4000-8000-000000000001",
    "reference": "12345678-c888-0987-1234-2435464844",
    "status": "expired",
    "from_asset": "usdc",
    "to_currency": "ngn",
    "amount": "25.795811",
    "settlement_amount": "35804.11",
    "fees": "0",
    "fee_currency": "USD",
    "source_fee": "0",
    "total_amount": "25.795811",
    "payment_reason": "Crypto offramp",
    "created_at": "2026-07-20T20:05:17.371329Z",
    "updated_at": "2026-07-20T20:24:01.352781396Z",
    "completed_at": "2026-07-20T20:24:01.352781396Z"
  }
}
```

```json payouts.withdrawal.failed theme={null}
{
  "event": "payouts.withdrawal.failed",
  "event_id": "3f2a9c1e-7b44-4d10-9a55-6e1f0c2b7d11",
  "data": {
    "id": "019f8140-22aa-7c31-8d10-5a2b3c4d5e6f",
    "quote_id": "QT2_21435102",
    "company_id": "00000000-0000-4000-8000-000000000001",
    "reference": "7b1e02e4-5678-467a-b91b-3a18dc000111",
    "status": "failed",
    "from_asset": "usdt",
    "to_currency": "ngn",
    "amount": "1.801875",
    "settlement_amount": "2500",
    "fees": "0",
    "fee_currency": "USD",
    "source_fee": "0",
    "total_amount": "1.801875",
    "beneficiary": {
      "country": "NG",
      "bank_code": "100004",
      "account_number": "****4000"
    },
    "failure_reason": "The payout could not be delivered. Your funds have been returned.",
    "created_at": "2026-07-21T06:02:11.40112Z",
    "updated_at": "2026-07-21T06:03:02.77310418Z",
    "completed_at": "2026-07-21T06:03:02.77310418Z"
  }
}
```

## Handler checklist

* Verify the signature before parsing anything else; see [Verifying events](https://www.bitnob.dev/api-reference/webhooks.md#verify-every-delivery).
* Return `200` immediately and process asynchronously. If processing fails temporarily, return a `5xx` so the event is retried; a `400` or `422` drops it for good. See [Retries and duplicates](https://www.bitnob.dev/api-reference/webhooks.md#retries-and-duplicates).
* Make the handler idempotent on `event_id`.
* Confirm terminal state with [Get payout](https://www.bitnob.dev/api-reference/payouts/get-payout.md) before releasing goods or services; do not act on a webhook alone.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.