> ## 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"}}`.

# Webhook events

> The card event catalog: envelope shape, wire conventions, and the events across lifecycle, funding, transactions, declines, KYC, and activation.

Every card event shares one envelope. Payload details live in the [Virtual Cards webhooks reference](https://www.bitnob.dev/docs/card-issuing/webhook-payloads.md); delivery, signatures, and retries are covered in [Receive card webhooks](https://www.bitnob.dev/docs/card-issuing/receive-card-webhooks.md).

```json theme={null}
{
  "event_id": "<uuid, unique per event, your idempotency key>",
  "event": "<dot-delimited event name>",
  "data": { }
}
```

Conventions: the company ID is inside `data`; keys inside `data` are mostly camelCase, but `display_amount`, `transaction_type`, and the `merchant_*` fields are snake\_case; amounts are integers in micro-units (1 USD = 1,000,000), with `display_amount` as the same value in major units; `reference` is the join key against the matching ledger entry.

## Wire conventions for transaction events

Branch on `event` first, then on `transaction_type`, because several events share a name across pending and settled states. Documented as [Wire conventions](https://www.bitnob.dev/docs/card-issuing/webhook-payloads.md#wire-conventions-for-transaction-events) in the API reference.

| Field | Meaning |
| - | - |
| `transaction_type` | Bitnob's stable internal classification: `authorization`, `settlement`, `pre_auth_approved`, `authorization_declined`, `refund_authorization`, `refund_settled`, `reversal`, `reversal_settled`, `cross_border_pending`, `cross_border_settled`, `cross_border_reversal`, `contactless_pending`, `contactless_settled`, `verification`. |
| `status` | Wire-level outcome: `completed`, `pending`, `decline`, `terminated`, or `failed`. |

Four events fire with different `transaction_type` values:

| Event | Fires for |
| - | - |
| `virtualcard.transaction.refund` | `refund_authorization`, then `refund_settled`. |
| `virtualcard.transaction.contactless` | `contactless_pending`, then `contactless_settled`. |
| `virtualcard.transaction.reversed` | `reversal_settled` or `cross_border_reversal`. |
| `virtualcard.transaction.crossborder` | `cross_border_pending` (fee from your wallet), then `cross_border_settled` (card balance). Each has its own `reference`. |

## Card lifecycle

| Event | Fires when |
| - | - |
| `virtualcard.created.completed` | Card created and active. The signal to show the card. |
| `virtualcard.created.failed` | Creation failed; `failureReason` says why. |
| `virtualcard.terminated.refund` | Card terminated and remaining balance refunded to your wallet. |
| `virtualcard.terminated.failed` | Termination failed. |
| `virtualcard.regularized` | A terminated card's balance was corrected. |
| `virtualcard.expiration` | Advance notice that a card is approaching its expiry date. |

## Funding and withdrawal

| Event | Fires when |
| - | - |
| `virtualcard.topup.completed` | Card load succeeded. |
| `virtualcard.topup.failed` | A card load failed during processing; `reason` says why. |
| `virtualcard.withdrawal.completed` | Withdrawal from card back to your account completed. |
| `virtualcard.withdrawal.failed` | A withdrawal failed during processing; `reason` says why. |

## Transactions

| Event | Fires when |
| - | - |
| `virtualcard.transaction.authorization` | Merchant placed an authorization hold; settlement pending. |
| `virtualcard.transaction.settlement` | Previously authorized charge settled. |
| `virtualcard.transaction.pre-auth.approved` | Pre-authorization hold, for example hotel or fuel. |
| `virtualcard.transaction.verification` | Zero-amount card-on-file check, `amount: 0`. |
| `virtualcard.transaction.refund` | Merchant refund; fires twice, see wire conventions. |
| `virtualcard.transaction.reversed` | Authorization reversed before settlement; also carries cross-border reversals. |
| `virtualcard.transaction.crossborder` | Cross-border activity; fires twice, see wire conventions. |
| `virtualcard.crossborder.complete` | Reward credit posted on a settled cross-border transaction. |
| `virtualcard.transaction.contactless` | Tap-to-pay; fires twice, see wire conventions. |
| `virtualcard.transaction.terminated.refund` | Per-transaction refund posted during termination cleanup, credited to your float. |

## Declines and risk

| Event | Fires when |
| - | - |
| `virtualcard.transaction.declined` | Generic decline; `reason` says why. |
| `virtualcard.transaction.declined.charge` | Decline-rule violation fee charged; carries `feeAmount` and `violationCount`. See [Fees and decline rules](https://www.bitnob.dev/docs/card-issuing/card-fees.md). |
| `virtualcard.transaction.declined.frozen` | Authorization declined because the card is frozen. |
| `virtualcard.transaction.declined.terminated` | The issuer terminated the card after a declined authorization. |
| `virtualcard.transaction.issuerexpiration` | The issuer reversed an expired authorization. |

## Activation and KYC

| Event | Fires when |
| - | - |
| `virtualcard.contactless.activation` | A contactless activation code, or a 3DS code for a `prepaid_platinum` or `prepaid_premium` card. See [Activation & KYC](https://www.bitnob.dev/docs/card-issuing/webhook-payloads.md#activation-kyc). |
| `virtualcard.tokenization` | Outcome of adding the card to a mobile wallet. |
| `virtualcard.user.kyc.pending` | Cardholder verification is under review. |
| `virtualcard.user.kyc.complete` | Cardholder verification passed. |
| `virtualcard.user.kyc.failed` | Cardholder verification failed. |
| `virtualcard.company.kyb.pending` | Business verification is under review. |
| `virtualcard.company.kyb.complete` | Business verification passed. |
| `virtualcard.company.kyb.failed` | Business verification failed. |

## Deposits

| Event | Fires when |
| - | - |
| `virtualcard.deposit.autofunded` | A crypto deposit funded the card automatically. |
| `virtualcard.deposit.parked` | A crypto deposit was held instead of funding the card. |


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