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

# Freeze, unfreeze, or terminate a card

> Cards move between active, frozen, and terminated. How to drive each transition, what Bitnob triggers automatically, and what each state still allows.

A live card is in one of three states, and the transitions are one-way in a single place:

```mermaid theme={null}
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#E6F7F2','primaryTextColor':'#004233','primaryBorderColor':'#00A57F','lineColor':'#00A57F','secondaryColor':'#CCEEE5','tertiaryColor':'#F2FCF9','fontFamily':'inherit'}}}%%
flowchart LR
    A[active] -->|freeze| F[frozen]
    F -->|unfreeze| A
    A -->|terminate| T[terminated]
    F -->|terminate| T
```

Freezing is reversible. Termination is not.

Other statuses appear around these. A card is `pending` while the issuer creates it, then `active`, or `failed` if creation fails. It's `pending_termination` while a termination completes.

## What each state allows

| State | New authorizations | Funding | Settlements of prior auths | Refunds and reversals |
| - | - | - | - | - |
| `active` | Yes | Yes | Yes | To the card |
| `frozen` | No | No | Yes | To the card |
| `terminated` | No, auto-declined | No | No | To your master balance |

A card becomes `active` when creation completes, and again when unfrozen. A `terminated` card stays visible in transaction history for audit and disputes.

## Freeze and unfreeze

Both go through [Freeze or unfreeze](https://www.bitnob.dev/api-reference/cards/freeze-or-unfreeze.md):

```http theme={null}
POST /api/cards/{cardId}/status
{ "status": "frozen" }
```

```http theme={null}
POST /api/cards/{cardId}/status
{ "status": "active" }
```

Expose freeze in your UI: it is the single most-wanted control when a cardholder sees a charge they do not recognize, and it works instantly. Each card allows one status change every 30 seconds. Another inside that window fails with `400` and a "rate limit exceeded" message.

Bitnob also freezes cards automatically:

| Trigger | Detail |
| - | - |
| Fraud suspicion | Abnormal usage patterns, unusual merchant activity, or velocity violations. |
| Unauthorized refund | A refund arrives from a merchant the card never spent at, for example a \$20 AliExpress refund on a card that never paid AliExpress. |

An automatic freeze surfaces as the `virtualcard.transaction.declined.frozen` webhook on the next authorization attempt. Cards frozen for fraud may need compliance review before they can be unfrozen.

## Terminate

```http theme={null}
DELETE /api/cards/{cardId}
{ "reason": "Card no longer needed" }
```

[Terminate card](https://www.bitnob.dev/api-reference/cards/terminate-card.md) permanently deactivates the card and sweeps any remaining balance back to your wallet, reported as `virtualcard.terminated.refund`. `reason` is required. A card with a negative balance can't be terminated. Two more constraints:

> [!WARNING]
>
> Termination is irreversible, and a card cannot be terminated within 24 hours of creation. A cardholder who needs to keep transacting gets a new card; never try to revive a terminated one.

Bitnob terminates cards automatically on:

| Trigger | Detail |
| - | - |
| Confirmed fraud | Flagged behavior confirmed as high-risk or abusive. |
| Repeated decline violations | Reaching the decline-rule violation limit, three by default, terminates the card after the fee is charged. See [Set your decline limit](https://www.bitnob.dev/docs/card-issuing/decline-limit.md). |
| Usage violations | Attempts on blocked MCCs or unsupported countries. |

Auto-termination from decline rules arrives as `virtualcard.terminated.refund`. If the card issuer terminates a card after a declined authorization, you get `virtualcard.transaction.declined.terminated`.

## React to the status webhooks

| Event | Meaning | Do this |
| - | - | - |
| `virtualcard.transaction.declined.frozen` | A charge was declined because the card is frozen. | Tell the user, offer unfreeze or support. |
| `virtualcard.transaction.declined.terminated` | The issuer terminated the card after a declined authorization. | Prompt the user to create a new card. |
| `virtualcard.terminated.refund` | Terminated card's balance was refunded. | Reconcile the credit to your wallet. |

Payloads are on [Webhook events](https://www.bitnob.dev/docs/card-issuing/webhooks.md). In your UI: show status clearly, grey out terminated cards but keep their history visible, and route users from a terminated card straight into issuing a replacement.


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