# Receivify API — v1.0.0 > Non-custodial crypto payment gateway — invoices, forwarding addresses, payment links and webhooks. This document is generated from `openapi.yaml`, the frozen v1 contract, so it describes what the code actually does. It is intended to be sufficient on its own for an agent to build a working integration. Base URL: `https://receivify.io` The frozen v1 contract. Four official SDKs and the published docs are generated from THIS file, so it describes what the code actually does, not what it ideally should. ## Scope This document covers exactly the SDK surface: - everything under `/api/v1/**` - everything under `/api/public/**` - `GET /api/health` Two surfaces are deliberately EXCLUDED and must never be modelled in an SDK: - **`/api/admin/**`** — the owner-only operator console. It authenticates with `ADMIN_TOKEN`, answers `404 not_found` on auth failure by design, uses offset (`limit`+`skip`) pagination, names list arrays `data` on some routes and `docs` on others, and includes raw database access. Its shapes may change without notice. - **`/api/auth/**`** — browser session bootstrap for the dashboard (`register`, `login`, `logout`, `me`). It trades an API key for a cookie; an SDK that already holds the key has no reason to call it, and its error codes (`exists`, `invalid_credentials`, `totp_required`, `totp_invalid`) are NOT part of the frozen `ERROR_CODES` registry below. ## Versioning `/api/v1` receives additive changes only. Breaking changes ship as `/api/v2` with a 12-month sunset window. The full policy — what counts as additive, what counts as breaking, and how a `v2` would be introduced — is in the Versioning section of the API docs. There is no `Accept-Version` or `X-Api-Version` header: the URL path is the entire version identifier. ## Authentication `Authorization: Bearer rcv_live_…`. Every `/api/v1` endpoint except the two public catalogue endpoints requires it. The same routes ALSO accept the dashboard session cookie (`rcv_session`) on the same routes — that path exists for the browser dashboard and is documented here as a second security scheme, but SDKs should always use the bearer key. ## Money **Every monetary quantity on the wire is an exact-integer, base-unit STRING** — satoshis for BTC, wei for ETH, the coin's smallest unit otherwise. They are typed `string` and never `number` because IEEE-754 doubles cannot represent a 256-bit wei value, and a language that parses JSON numbers as floats would silently corrupt a payment amount. Divide by `10 ** decimals` (from `GET /api/v1/tickers` or `GET /api/v1/assets`) only for display. **No money field is a JSON number anywhere in this API.** `Invoice.amount_fiat` and `RecurringSchedule.amount_fiat` were the last two and are now decimal strings like the rest (e.g. `"25.00"`) — they are display prices rather than base-unit quantities, so they are decimal rather than integer strings, but they are strings. THREE amounts are decimal rather than base-unit and are called out individually in their schemas: `Forward.min_forward`, `PublicPaymentLink.amount_btc` and `RecurringSchedule.amount`. Treating any of these as base units is wrong by a factor of 10^decimals, so check the field's own description before doing arithmetic on it. **FX rates are the one deliberate exception and stay JSON numbers** — on `GET /api/v1/summary` and `GET /api/public/links/{id}`. They are rates, not money: they are advisory, they are published as doubles by the upstream feed, and nothing is ever settled against them. Rounding a rate cannot lose value the way rounding an amount can. ## Timestamps ISO-8601 UTC with milliseconds, always — `Response.json` serialises every `Date` that way. Epoch seconds appear in exactly one place: the `t=` component of the webhook signature header. ## Conventions - **Single resource** — the bare object, never wrapped, always carrying an identifier. - **List** — always `{ data, has_more, next_cursor }`. `has_more` is a fact (the query reads `limit + 1` rows), never inferred from `data.length === limit`. - **Error** — always `{ error, detail }`, where `error` is a key of the frozen `ERROR_CODES` registry. 4xx means the caller must change something; 5xx means a retry may help. An unhandled server throw becomes `500 {"error":"internal"}` in the same shape, never an HTML stack page. - **Pagination** — `?limit=<1..200>&cursor=`, keyset on `(created_at, _id)` descending. A malformed cursor is a `400 bad_request`, never a silent reset to page one. - **Idempotency** — `Idempotency-Key` on the mutating POSTs that declare the header parameter. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. ## Endpoints ## Invoices ### GET `/api/v1/invoices` **List invoices** — `listInvoices` Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | | `status` | query | no | Exact-match filter on the invoice status. Not validated against the enum — an unknown value simply matches nothing. | Responses: - `200` — One page of invoices, newest first. - `400` — `bad_request` — `limit` is not an integer in 1..200, or `cursor` is not a valid pagination cursor. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | Invoice[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### POST `/api/v1/invoices` **Create an invoice** — `createInvoice` Derives a fresh deposit address and returns the invoice. **Always 201**, including on both replay channels: - an `Idempotency-Key` replay returns the stored body with its original 201, plus `Idempotent-Replay: true`; - `reference` is a BUSINESS key that ALSO de-duplicates — repeating a `reference` with the same terms (asset, chain, and the same fiat price or coin amount) returns the EXISTING invoice with a 201. Repeating it with DIFFERENT terms is a different order that collided (two shops on one account, a shop whose order numbers restarted) and returns `409 already_exists` instead of the other order's invoice. Make references unique per order, e.g. prefixed with the store name. Exactly one amount field is required. They are tried in this order and the first present one wins: `amount_fiat` (+`currency`), `amount`, `amount_sats`, `amount_btc`. Whichever you use is the amount you want to RECEIVE if `add_fee_ontop` is `true`, and the amount you want the payer to SEND if it is `false`. With the flag on, `amount_expected` is grossed up to `amount / (1 - fee_bps/10000)` so that our commission, which is charged on the gross, still leaves you exactly the amount you asked for. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | Request body — `InvoiceCreateRequest`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `asset` | string | no | Lower-cased. Must be enabled on this deployment and settleable. | | `chain` | string | no | The network — see `AssetPair.chain` (`GET /api/v1/assets?expand=networks`). DOCUMENTED DEFAULT for API compatibility: omitted, a UTXO coin uses its own network, a Solana/Tron-home coin that chain, and an EVM asset (including multi-chain tokens such as `usdt`, `usdc`) uses `ethereum` when it exists there and otherwise its home chain. The dashboard always sends `chain` for a multi-chain token. Only consulted for EVM assets (plus the literal `solana` / `tron` for those editions of a multi-network token). Omitted, an EVM asset uses `ethereum` when it exists there and otherwise its home chain (the chain where it is native, e.g. `avalanche` for AVAX, else the first chain carrying it, e.g. `bsc` for BUSD). An `(asset, chain)` pair that is not a real native coin or registered token on that chain is `400 asset_unavailable`. | | `amount_fiat` | number \| string | no | A fiat price, converted at the current rate and LOCKED onto the invoice. Highest precedence of the four amount fields. | | `currency` | string | no | ISO-4217 code for `amount_fiat`. Defaults to USD inside the pricing layer. | | `amount` | string | no | A decimal amount in the coin's own units. | | `amount_sats` | string | no | Exact base units as an integer string. Named `sats` for historical reasons but applies to every asset. | | `amount_btc` | string | no | Legacy. Only honoured when `asset` is `btc`. | | `reference` | string | no | Your business key. See the de-duplication note on `Invoice.reference`. | | `callback_url` | string | no | Per-invoice webhook target, in addition to every registered account-level endpoint. Must be https in production, or http to a .onion address (delivered over Tor). | | `return_url` | string | no | Optional. Where the hosted checkout sends the payer back to once the invoice is `paid`, e.g. your order-received page (`https://shop.example/checkout/order-received/123?key=…`). The query string is kept exactly as given. Must be an `https://` URL with no embedded credentials, no whitespace or control characters, at most 2048 characters — anything else (`http:`, `javascript:`, `data:`) is `400 bad_request`. The pay page re-checks it before redirecting. | | `cancel_url` | string | no | Optional. Where the hosted checkout sends the payer if the invoice expires or is cancelled (e.g. your cart or "pay again" page). Same rules as `return_url`. | | `return_redirect_seconds` | integer | no | Optional. Seconds the paid screen counts down before redirecting to `return_url` (default 3). `0` turns the automatic redirect off and shows only a "Back to store" button. | | `add_fee_ontop` | boolean | no | Add our commission ON TOP of the amount instead of taking it out. With `true`, the payer is quoted a grossed-up `amount_expected` and you receive the amount you asked for in full. Must be a real JSON boolean — a string is `400 bad_request`. OMITTING it is not the same as sending `false`: omitted defers to the account default (`add_fee_ontop` on `GET /api/v1/settings`), while `false` forces fee-out-of-amount for this invoice regardless of that default. | | `customer_email` | string | no | Optional. Your customer's email address. When set, Receivify emails them for you (awaiting payment with a Pay now button, partial payment, receipt, expired) — at most four emails per invoice, with a one-click unsubscribe. Requires customer emails to be unlocked on your account ($25,000 monthly volume, a plan that includes them, or email credits); otherwise `403 customer_emails_locked` — the address is never silently dropped. | | `notify` | boolean | no | Per-invoice switch for customer emails. `false` stores `customer_email` without emailing it (and needs no unlock). Must be a real JSON boolean. | | `metadata` | object | no | | Responses: - `201` — The invoice. Returned for a genuine create, for an `Idempotency-Key` replay, and for a `reference` match on an existing invoice. - `400` — `bad_request` — body is not JSON, asset not enabled, no amount field, an unparseable amount, an amount that rounds to zero base units, a non-boolean `add_fee_ontop`, or a `callback_url` that is not a valid URL (and, in production, not https — plain http is accepted only for a .onion address, delivered over Tor). `asset_unavailable` — the asset is enabled but its settlement backend cannot take it, or the `(asset, chain)` pair is not a real token on that chain. `suspended` / `amount_too_low` — raised by `createInvoice` and mapped through `failFromCode`; before this was wired they arrived as a retryable `502`. `payout_address_mismatch` — the account HAS a payout address for this asset on the invoice's network (e.g. `usdt@tron` for `chain: "tron"`, or `usdt` for an EVM chain), but it is not an address on that network, so the payment could never be forwarded. Fix it in the dashboard (Payouts). No payout address at all is `409 payout_address_missing`. `limit_exceeded` — the account already has its maximum of open (unpaid) invoices on EVM, Solana and Tron (default 2,000; 200 for an account under 7 days old whose email is not verified). Let some expire or cancel unused ones; support can raise the limit. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `403` — `customer_emails_locked` — `customer_email` was supplied (with `notify` not `false`) but this account has not unlocked customer emails, or the deployment has them switched off. Nothing was created. Omit `customer_email`, or pass `notify: false` to store it unsent. - `409` — `already_exists` — this `reference` is already used by an invoice with different terms (asset, chain or amount). Nothing was created; retry with a reference unique to this order. `payout_address_missing` — the account has no ACTIVE payout address for this asset on the invoice's network (e.g. no `usdt@tron` for `chain: "tron"`), so a payment could never be forwarded and the invoice is refused. The `detail` names the coin, the network and the dashboard URL. A change still waiting on its email confirmation / timelock does not count yet; an address that is already live keeps working while a change is pending. Testnet invoices follow the same rule. Check `GET /api/v1/payout-status` (or `payout_ready` on `GET /api/v1/assets`) to hide coins that would be refused. An API key cannot set the address — the merchant does it in the dashboard. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. - `502` — `upstream_error` — a node or payment provider we depend on failed while deriving the deposit address. Retryable. Reserved for genuine infrastructure failure: a caller error never arrives here. - `503` — `rate_unavailable` — `amount_fiat` was supplied but no fresh FX rate exists to price it. Retryable. `201` body — `Invoice`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `reference` | string \| null | yes | Your own business key. It is ALSO a de-duplication key: creating a second invoice with a reference this merchant has already used returns the EXISTING invoice with a 201. | | `asset` | string | yes | Lower-case symbol, e.g. `btc`, `usdc`. | | `amount_expected` | string | yes | **Exact-integer base units, as a STRING** — satoshis for BTC, wei for ETH, the coin's smallest unit otherwise. Never a JSON number: a 256-bit wei value does not survive a double. | | `amount_received` | string | yes | Exact-integer base units, as a string. `"0"` until something arrives. | | `amount_fiat` | string \| null | yes | **A DECIMAL string** (e.g. `"25.00"`), not base units and not a JSON number. It is the fiat price captured at create time and is display information only; the authoritative amount is `amount_expected`. Never settle against it. Always carries at least two fraction digits, and never fewer digits than the stored value needs — padding only ever adds zeros, so the value round-trips exactly. | | `fiat_currency` | string \| null | yes | ISO-4217 code that `amount_fiat` is denominated in. | | `chain` | string \| null | yes | The EVM chain for EVM assets, the literal `solana` or `tron` for those providers, and `null` for BTC and every other `utxo`-provider coin. The `chain` you SEND at create time defaults to `ethereum` regardless of asset; it is only consulted for EVM assets. | | `provider` | string \| null | yes | The settlement backend that derived the address. `utxo` is the BTC/LTC/DOGE/BCH/ZEC/XMR family settled on our own nodes. | | `address` | string | yes | The deposit address. Send exactly this asset on exactly this chain. | | `status` | InvoiceStatus | yes | The invoice lifecycle, mirrored by the strict Mongo validator. Treat it as an OPEN enum and keep a default branch: a new value is an additive change. `pending` is the creation state. `confirming` means seen on-chain but not yet final; `partial` means less than expected arrived; `swept` means the funds left the deposit address for the payout wallet; `partial_expired` means the window closed on an under-payment. | | `expires_at` | string | yes | | | `paid_at` | string \| null | yes | | | `created_at` | string | yes | | | `metadata` | object | yes | Whatever you stored. Always an object, never null — an omitted `metadata` comes back as `{}`. | | `checkout_url` | string | yes | The hosted checkout page for this invoice. Redirecting here is the fast path, but it is OPTIONAL — `address`, `amount_expected`, `decimals`, `payment_uri`, `expires_at` and `status` are everything needed to render your own checkout instead. Poll `GET /api/public/invoices/{id}` (no API key, browser-safe) for live status. | | `return_url` | string \| null | no | Where the hosted checkout sends the payer after the invoice is `paid` (a "Back to store" button plus an automatic redirect after a short, cancellable countdown). `null` when not set at create time. Your query string is preserved exactly as given. | | `cancel_url` | string \| null | no | Where the hosted checkout sends the payer when the invoice has expired or was cancelled (and a quiet "cancel and return" link while it is still open). `null` when not set. | | `return_redirect_seconds` | integer \| null | no | Seconds the paid screen waits before sending the payer to `return_url`. `0` shows the "Back to store" button only. `null` = the default (3). | | `decimals` | integer | no | Decimal places for this invoice's asset — the divisor for `amount_expected`, which is in BASE UNITS. Display amount is `amount_expected / 10 ** decimals`. Per-token on EVM (USDC 6, DAI 18), so it cannot be assumed from the chain. Returned so a custom checkout does not need a second call to `/api/v1/assets`. | | `amount_decimal` | string | no | `amount_expected` already divided by `10 ** decimals`, as a decimal STRING (never a float — see the money note at the top of this spec). Provided for display only; keep using `amount_expected` for any comparison or arithmetic. | | `payment_uri` | string \| null | no | A wallet-scannable payment URI to put in a QR code, or `null` when the chain has no safe one — in which case show the bare `address`. Non-obvious rules this saves you from re-deriving: Monero uses `tx_amount` rather than `amount`; Zcash uses ZIP-321 (`zcash:`); Solana invoices get a Solana Pay transfer request (`solana:
?amount=…`, plus `spl-token=` for tokens), on mainnet only; EVM and Tron get `null` because an EIP-681 URI encodes a chain id and, for tokens, a contract call — get it wrong and a wallet silently prefills the wrong asset on the wrong network. | | `add_fee_ontop` | boolean | no | Whether our commission was added ON TOP of the requested amount rather than taken out of it. `false` (the default) means `amount_expected` is what you asked for and you receive it minus the fee; `true` means the payer covers the fee and you receive the full `amount_net_requested`. Always present — invoices created before this existed report `false`, which is what they are. | | `amount_net_requested` | string | no | **Exact-integer base units, as a STRING.** What you asked to RECEIVE. Equal to `amount_expected` whenever `add_fee_ontop` is `false`; smaller than it when the fee was added on top. | | `fee_ontop` | string | no | **Exact-integer base units, as a STRING.** `amount_expected - amount_net_requested` — what the gross-up added to the payer's bill. Always `"0"` when `add_fee_ontop` is `false`, never `null`, so it can be displayed unconditionally. The gross-up is `net / (1 - fee_bps/10000)`, not `net * (1 + fee_bps/10000)`: the fee is charged on the GROSS, so the naive form would leave you short by `net * rate²`. | | `fiat_value` | FiatValue \| null | no | ADDITIVE. The fiat value of this invoice LOCKED at the time of the order — never today's rate. `null` on an older crypto-priced invoice created before rates were snapshotted. | | `fx_at_creation` | FxAtCreation \| null | no | ADDITIVE. On a crypto-priced invoice, the rate snapshot taken at creation in your display currency: `currency`, `rate` (fiat per WHOLE coin, exact decimal string), `decimals`, `at`. `null` on fiat-priced invoices (their price is the lock) and on older invoices. | | `partial_settlement` | PartialSettlement \| null | no | ADDITIVE. Only meaningful on a `partial_expired` invoice (part of the amount arrived before it expired); `null` on every other invoice. What arrived is forwarded to the merchant's payout address by itself once the late-payment window after expiry has passed (or when the merchant presses "Send it now"), minus the normal fee. The invoice stays `partial_expired` and `invoice.paid` is never sent for it. `sweep.sent` fires when the money leaves. | ### GET `/api/v1/invoices/{id}` **Retrieve an invoice** — `getInvoice` The authoritative current state of an invoice. Poll this rather than relying on a webhook replay, which re-sends a frozen snapshot of the moment the event happened. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The invoice id. Validated as a UUID before any database read. | Responses: - `200` — The invoice. - `400` — `bad_request` — the id is not a UUID. Checked before any database read. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `Invoice`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `reference` | string \| null | yes | Your own business key. It is ALSO a de-duplication key: creating a second invoice with a reference this merchant has already used returns the EXISTING invoice with a 201. | | `asset` | string | yes | Lower-case symbol, e.g. `btc`, `usdc`. | | `amount_expected` | string | yes | **Exact-integer base units, as a STRING** — satoshis for BTC, wei for ETH, the coin's smallest unit otherwise. Never a JSON number: a 256-bit wei value does not survive a double. | | `amount_received` | string | yes | Exact-integer base units, as a string. `"0"` until something arrives. | | `amount_fiat` | string \| null | yes | **A DECIMAL string** (e.g. `"25.00"`), not base units and not a JSON number. It is the fiat price captured at create time and is display information only; the authoritative amount is `amount_expected`. Never settle against it. Always carries at least two fraction digits, and never fewer digits than the stored value needs — padding only ever adds zeros, so the value round-trips exactly. | | `fiat_currency` | string \| null | yes | ISO-4217 code that `amount_fiat` is denominated in. | | `chain` | string \| null | yes | The EVM chain for EVM assets, the literal `solana` or `tron` for those providers, and `null` for BTC and every other `utxo`-provider coin. The `chain` you SEND at create time defaults to `ethereum` regardless of asset; it is only consulted for EVM assets. | | `provider` | string \| null | yes | The settlement backend that derived the address. `utxo` is the BTC/LTC/DOGE/BCH/ZEC/XMR family settled on our own nodes. | | `address` | string | yes | The deposit address. Send exactly this asset on exactly this chain. | | `status` | InvoiceStatus | yes | The invoice lifecycle, mirrored by the strict Mongo validator. Treat it as an OPEN enum and keep a default branch: a new value is an additive change. `pending` is the creation state. `confirming` means seen on-chain but not yet final; `partial` means less than expected arrived; `swept` means the funds left the deposit address for the payout wallet; `partial_expired` means the window closed on an under-payment. | | `expires_at` | string | yes | | | `paid_at` | string \| null | yes | | | `created_at` | string | yes | | | `metadata` | object | yes | Whatever you stored. Always an object, never null — an omitted `metadata` comes back as `{}`. | | `checkout_url` | string | yes | The hosted checkout page for this invoice. Redirecting here is the fast path, but it is OPTIONAL — `address`, `amount_expected`, `decimals`, `payment_uri`, `expires_at` and `status` are everything needed to render your own checkout instead. Poll `GET /api/public/invoices/{id}` (no API key, browser-safe) for live status. | | `return_url` | string \| null | no | Where the hosted checkout sends the payer after the invoice is `paid` (a "Back to store" button plus an automatic redirect after a short, cancellable countdown). `null` when not set at create time. Your query string is preserved exactly as given. | | `cancel_url` | string \| null | no | Where the hosted checkout sends the payer when the invoice has expired or was cancelled (and a quiet "cancel and return" link while it is still open). `null` when not set. | | `return_redirect_seconds` | integer \| null | no | Seconds the paid screen waits before sending the payer to `return_url`. `0` shows the "Back to store" button only. `null` = the default (3). | | `decimals` | integer | no | Decimal places for this invoice's asset — the divisor for `amount_expected`, which is in BASE UNITS. Display amount is `amount_expected / 10 ** decimals`. Per-token on EVM (USDC 6, DAI 18), so it cannot be assumed from the chain. Returned so a custom checkout does not need a second call to `/api/v1/assets`. | | `amount_decimal` | string | no | `amount_expected` already divided by `10 ** decimals`, as a decimal STRING (never a float — see the money note at the top of this spec). Provided for display only; keep using `amount_expected` for any comparison or arithmetic. | | `payment_uri` | string \| null | no | A wallet-scannable payment URI to put in a QR code, or `null` when the chain has no safe one — in which case show the bare `address`. Non-obvious rules this saves you from re-deriving: Monero uses `tx_amount` rather than `amount`; Zcash uses ZIP-321 (`zcash:`); Solana invoices get a Solana Pay transfer request (`solana:
?amount=…`, plus `spl-token=` for tokens), on mainnet only; EVM and Tron get `null` because an EIP-681 URI encodes a chain id and, for tokens, a contract call — get it wrong and a wallet silently prefills the wrong asset on the wrong network. | | `add_fee_ontop` | boolean | no | Whether our commission was added ON TOP of the requested amount rather than taken out of it. `false` (the default) means `amount_expected` is what you asked for and you receive it minus the fee; `true` means the payer covers the fee and you receive the full `amount_net_requested`. Always present — invoices created before this existed report `false`, which is what they are. | | `amount_net_requested` | string | no | **Exact-integer base units, as a STRING.** What you asked to RECEIVE. Equal to `amount_expected` whenever `add_fee_ontop` is `false`; smaller than it when the fee was added on top. | | `fee_ontop` | string | no | **Exact-integer base units, as a STRING.** `amount_expected - amount_net_requested` — what the gross-up added to the payer's bill. Always `"0"` when `add_fee_ontop` is `false`, never `null`, so it can be displayed unconditionally. The gross-up is `net / (1 - fee_bps/10000)`, not `net * (1 + fee_bps/10000)`: the fee is charged on the GROSS, so the naive form would leave you short by `net * rate²`. | | `fiat_value` | FiatValue \| null | no | ADDITIVE. The fiat value of this invoice LOCKED at the time of the order — never today's rate. `null` on an older crypto-priced invoice created before rates were snapshotted. | | `fx_at_creation` | FxAtCreation \| null | no | ADDITIVE. On a crypto-priced invoice, the rate snapshot taken at creation in your display currency: `currency`, `rate` (fiat per WHOLE coin, exact decimal string), `decimals`, `at`. `null` on fiat-priced invoices (their price is the lock) and on older invoices. | | `partial_settlement` | PartialSettlement \| null | no | ADDITIVE. Only meaningful on a `partial_expired` invoice (part of the amount arrived before it expired); `null` on every other invoice. What arrived is forwarded to the merchant's payout address by itself once the late-payment window after expiry has passed (or when the merchant presses "Send it now"), minus the normal fee. The invoice stays `partial_expired` and `invoice.paid` is never sent for it. `sweep.sent` fires when the money leaves. | ### GET `/api/v1/invoices/{id}/pdf` **Download an invoice or receipt as PDF** — `getInvoicePdf` A PDF of one of YOUR invoices: a receipt once the invoice is paid, otherwise the invoice with the amount still to pay. It states that it records a cryptocurrency payment and that it is not a tax invoice. The merchant name, address, tax ID, accent colour and uploaded logo come from Dashboard → Branding → Invoices and receipts. An invoice of another merchant answers 404. Rate-limited to 30 requests a minute per merchant. The response carries an `ETag`; send it back in `If-None-Match` to get `304` while nothing has changed. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The invoice id. Validated as a UUID before any database read. | | `locale` | query | no | The language of the labels. Numbers and dates keep that locale's formatting. Defaults to the request's language, then English. | Responses: - `200` — The PDF (`application/pdf`, attachment). - `304` — Not modified. The `If-None-Match` value matches the current `ETag`. - `400` — `bad_request` — the id is not a UUID. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. - `503` — The PDF service is busy. Retry after the `Retry-After` seconds (5). ### POST `/api/v1/invoices/{id}/cancel` **Cancel a pending, unpaid invoice** — `cancelInvoice` Only an invoice that is still `pending` AND has received nothing can be cancelled — the match is atomic (`findOneAndUpdate` on `{status:'pending', amount_received:0}`), so a payment that lands mid-request wins. Returns the cancelled invoice. NOT idempotent: a second call on an already-cancelled invoice is `409 not_allowed`. Rate limited to 60 cancels per minute per account (each one reads the chain). Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The invoice id. Not format-checked on this route. | Responses: - `200` — The invoice, now `cancelled`. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `409` — `not_allowed` — the invoice exists but is not pending-and-unpaid. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `Invoice`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `reference` | string \| null | yes | Your own business key. It is ALSO a de-duplication key: creating a second invoice with a reference this merchant has already used returns the EXISTING invoice with a 201. | | `asset` | string | yes | Lower-case symbol, e.g. `btc`, `usdc`. | | `amount_expected` | string | yes | **Exact-integer base units, as a STRING** — satoshis for BTC, wei for ETH, the coin's smallest unit otherwise. Never a JSON number: a 256-bit wei value does not survive a double. | | `amount_received` | string | yes | Exact-integer base units, as a string. `"0"` until something arrives. | | `amount_fiat` | string \| null | yes | **A DECIMAL string** (e.g. `"25.00"`), not base units and not a JSON number. It is the fiat price captured at create time and is display information only; the authoritative amount is `amount_expected`. Never settle against it. Always carries at least two fraction digits, and never fewer digits than the stored value needs — padding only ever adds zeros, so the value round-trips exactly. | | `fiat_currency` | string \| null | yes | ISO-4217 code that `amount_fiat` is denominated in. | | `chain` | string \| null | yes | The EVM chain for EVM assets, the literal `solana` or `tron` for those providers, and `null` for BTC and every other `utxo`-provider coin. The `chain` you SEND at create time defaults to `ethereum` regardless of asset; it is only consulted for EVM assets. | | `provider` | string \| null | yes | The settlement backend that derived the address. `utxo` is the BTC/LTC/DOGE/BCH/ZEC/XMR family settled on our own nodes. | | `address` | string | yes | The deposit address. Send exactly this asset on exactly this chain. | | `status` | InvoiceStatus | yes | The invoice lifecycle, mirrored by the strict Mongo validator. Treat it as an OPEN enum and keep a default branch: a new value is an additive change. `pending` is the creation state. `confirming` means seen on-chain but not yet final; `partial` means less than expected arrived; `swept` means the funds left the deposit address for the payout wallet; `partial_expired` means the window closed on an under-payment. | | `expires_at` | string | yes | | | `paid_at` | string \| null | yes | | | `created_at` | string | yes | | | `metadata` | object | yes | Whatever you stored. Always an object, never null — an omitted `metadata` comes back as `{}`. | | `checkout_url` | string | yes | The hosted checkout page for this invoice. Redirecting here is the fast path, but it is OPTIONAL — `address`, `amount_expected`, `decimals`, `payment_uri`, `expires_at` and `status` are everything needed to render your own checkout instead. Poll `GET /api/public/invoices/{id}` (no API key, browser-safe) for live status. | | `return_url` | string \| null | no | Where the hosted checkout sends the payer after the invoice is `paid` (a "Back to store" button plus an automatic redirect after a short, cancellable countdown). `null` when not set at create time. Your query string is preserved exactly as given. | | `cancel_url` | string \| null | no | Where the hosted checkout sends the payer when the invoice has expired or was cancelled (and a quiet "cancel and return" link while it is still open). `null` when not set. | | `return_redirect_seconds` | integer \| null | no | Seconds the paid screen waits before sending the payer to `return_url`. `0` shows the "Back to store" button only. `null` = the default (3). | | `decimals` | integer | no | Decimal places for this invoice's asset — the divisor for `amount_expected`, which is in BASE UNITS. Display amount is `amount_expected / 10 ** decimals`. Per-token on EVM (USDC 6, DAI 18), so it cannot be assumed from the chain. Returned so a custom checkout does not need a second call to `/api/v1/assets`. | | `amount_decimal` | string | no | `amount_expected` already divided by `10 ** decimals`, as a decimal STRING (never a float — see the money note at the top of this spec). Provided for display only; keep using `amount_expected` for any comparison or arithmetic. | | `payment_uri` | string \| null | no | A wallet-scannable payment URI to put in a QR code, or `null` when the chain has no safe one — in which case show the bare `address`. Non-obvious rules this saves you from re-deriving: Monero uses `tx_amount` rather than `amount`; Zcash uses ZIP-321 (`zcash:`); Solana invoices get a Solana Pay transfer request (`solana:
?amount=…`, plus `spl-token=` for tokens), on mainnet only; EVM and Tron get `null` because an EIP-681 URI encodes a chain id and, for tokens, a contract call — get it wrong and a wallet silently prefills the wrong asset on the wrong network. | | `add_fee_ontop` | boolean | no | Whether our commission was added ON TOP of the requested amount rather than taken out of it. `false` (the default) means `amount_expected` is what you asked for and you receive it minus the fee; `true` means the payer covers the fee and you receive the full `amount_net_requested`. Always present — invoices created before this existed report `false`, which is what they are. | | `amount_net_requested` | string | no | **Exact-integer base units, as a STRING.** What you asked to RECEIVE. Equal to `amount_expected` whenever `add_fee_ontop` is `false`; smaller than it when the fee was added on top. | | `fee_ontop` | string | no | **Exact-integer base units, as a STRING.** `amount_expected - amount_net_requested` — what the gross-up added to the payer's bill. Always `"0"` when `add_fee_ontop` is `false`, never `null`, so it can be displayed unconditionally. The gross-up is `net / (1 - fee_bps/10000)`, not `net * (1 + fee_bps/10000)`: the fee is charged on the GROSS, so the naive form would leave you short by `net * rate²`. | | `fiat_value` | FiatValue \| null | no | ADDITIVE. The fiat value of this invoice LOCKED at the time of the order — never today's rate. `null` on an older crypto-priced invoice created before rates were snapshotted. | | `fx_at_creation` | FxAtCreation \| null | no | ADDITIVE. On a crypto-priced invoice, the rate snapshot taken at creation in your display currency: `currency`, `rate` (fiat per WHOLE coin, exact decimal string), `decimals`, `at`. `null` on fiat-priced invoices (their price is the lock) and on older invoices. | | `partial_settlement` | PartialSettlement \| null | no | ADDITIVE. Only meaningful on a `partial_expired` invoice (part of the amount arrived before it expired); `null` on every other invoice. What arrived is forwarded to the merchant's payout address by itself once the late-payment window after expiry has passed (or when the merchant presses "Send it now"), minus the normal fee. The invoice stays `partial_expired` and `invoice.paid` is never sent for it. `sweep.sent` fires when the money leaves. | ### POST `/api/v1/invoices/bulk` **Bulk-cancel invoices** — `bulkInvoiceAction` Naturally idempotent — the update filter only matches pending, unpaid invoices belonging to the caller, so a stray or already-paid id is skipped rather than force-cancelled. Does NOT accept `Idempotency-Key`. Compare `requested` with `cancelled` to see how many were actually eligible; the response does not say which. Each cancelled invoice sends `invoice.cancelled` to your webhook endpoints, like a single cancel. An own-chain invoice (EVM, Solana, Tron) whose deposit address already holds or is receiving a payment is not cancelled (`skipped_funds_arrived`); one that cannot be checked right now is not cancelled either (`skipped_unverified`). Auth: `bearerAuth` or `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ids` | string[] | yes | Invoice ids. Non-string entries are silently dropped before the count is checked. | | `action` | `cancel` | yes | | Responses: - `200` — How many were requested and how many were actually cancelled. - `400` — `bad_request` — body is not JSON, `ids` is empty after filtering, more than 500 ids, or `action` is not `cancel`. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `BulkResult`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `action` | `cancel` | yes | | | `requested` | integer | yes | How many ids survived the string filter and were submitted. | | `cancelled` | integer | yes | How many were actually eligible and changed. The response does not say which. | | `skipped_funds_arrived` | integer | no | Pending own-chain invoices NOT cancelled because a payment has already arrived at (or is on its way to) the deposit address. They will be credited. | | `skipped_unverified` | integer | no | Pending own-chain invoices NOT cancelled because the deposit address could not be checked right now. Try again shortly. | ## Forwarding ### GET `/api/v1/address` **List forwarding addresses** — `listForwards` Items are the plain `Forward` shape — WITHOUT the `payments` / `callbacks` detail arrays that `GET /api/v1/address/{id}` adds. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | | `status` | query | no | Validated against the forward status enum — an unknown value is a `400 bad_request`, unlike the invoice list's `status`. | | `ticker` | query | no | Exact match on the ticker string as it was supplied at create time, lower-cased. | Responses: - `200` — One page of forwards, newest first. - `400` — `bad_request` — a bad `limit`/`cursor`, or a `status` outside the enum. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | Forward[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### POST `/api/v1/address` **Create (or return) a forwarding address** — `createForward` **Deterministic.** The identity of a forward is `(merchant, resolved asset, destination, callback_url)`, backed by a unique index — so repeating this call does not burn a second HD derivation index. - **201** — a new address was derived. - **200** — an existing forward with the same identity was returned. Single-session tickers (`ltc`, `doge`, `bch`, `xmr`, `zec`) are deliberately NEVER deduped: each mints a fresh address with a real `expires_at`, so they always return 201. Input aliases are accepted: `ticker`/`coin`/`currency`/`asset`, `destination`/`address`/`to`/`payout_address`, `callback`/`callback_url`/`webhook`/`webhook_url`/`url`, `confirmations`/`confs`. The invoice API does NOT accept those aliases. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | Request body — `ForwardCreateRequest`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ticker` | string | yes | Aliases: `coin`, `currency`, `asset`. Trimmed and lower-cased. | | `destination` | string | yes | Aliases: `address`, `to`, `payout_address`. Validated against the chain's address format. EVM destinations are compared case-insensitively for dedupe, because EIP-55 casing is cosmetic. | | `callback` | string | no | Aliases: `callback_url`, `webhook`, `webhook_url`, `url`. Part of the forward's deterministic identity — a different callback creates a DIFFERENT forward. Must be https in production, or http to a .onion address (delivered over Tor). | | `confirmations` | integer | no | Alias: `confs`. A non-integer or non-positive value falls back to the deployment default instead of erroring. | | `metadata` | object | no | | Responses: - `200` — An existing forward with this identity was returned unchanged. - `201` — A new deposit address was derived. - `400` — `bad_request` — body is not JSON, `ticker`/`destination` missing, or `callback` is not a valid URL (and, in production, not https — plain http is accepted only for a .onion address, delivered over Tor). `bad_ticker` — unknown ticker, or a single-session ticker whose coin is not currently enabled for settlement. The `detail` carries a "did you mean" suggestion when one exists. `bad_destination` — the destination fails the address-format check for that chain. `suspended` — this account cannot create new resources right now (contact support). Checked FIRST, so it cannot be side-stepped by aiming the call at a forward that already exists. `limit_exceeded` — creating a NEW forwarding address would exceed the account's maximum of active EVM / Solana / Tron forwards (default 500; 50 for an account under 7 days old whose email is not verified). Re-using an existing binding is never refused. Disable addresses you no longer need, or ask support for a higher limit. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `not_allowed` — a forward with this identity exists but is `paused` or `disabled`. Creation never silently resurrects a killed forward: the pause may have been pulled with a key that is now compromised. The `detail` names the forward id and the PATCH that re-enables it. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. - `502` — `upstream_error` — the node call that derives the address failed. Retryable. `200` body — `Forward`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | The identifier. Canonical — every resource in this API names its identifier `id`, including this one. | | `forward_id` | string | yes | **Deprecated alias for `id`**, carrying the identical value. Forwards were the one resource that named their identifier something other than `id`, which forced an SDK to special-case them. New code should read `id`. It is NOT going away: removing a response field is a breaking change under the versioning policy, so `forward_id` will be emitted for the whole life of v1. Note also that `forward_id` inside a `forward.*` webhook payload is NOT deprecated — there it names a relationship to a forward rather than the payload's own identity. | | `ticker` | string | yes | The ticker string exactly as you supplied it at create time, not the canonical form. Two spellings that resolve to the same asset still share ONE forward. | | `provider` | `bitcoind` \| `utxo` \| `evm` \| `solana` \| `tron` | yes | | | `chain` | string \| null | yes | `null` for `btc` and the other `utxo`-provider coins, which have no chain concept here. | | `address` | string | yes | The deposit address to hand to payers. | | `destination` | string | yes | Your wallet. IMMUTABLE — `PATCH` refuses to change it with `409 not_allowed`. | | `callback_url` | string \| null | yes | Receives `forward.*` events only. Account-level webhook endpoints do NOT receive them. | | `confirmations_required` | integer | yes | Confirmations before a payment is credited. Defaults to the deployment's BTC confirmation count. | | `min_forward` | string | yes | **The one money field on this object that is NOT base units.** It is a DISPLAY-UNIT decimal string (e.g. `"0.500000"`) sitting inside an object of exact base-unit values, computed from the stored `min_forward_base` at serialisation time. Multiply by `10 ** decimals` before comparing it with a `value` from `ForwardPayment`. The base-unit field itself is stored but never serialised. | | `status` | ForwardStatus | yes | `active` — watching for new deposits and forwarding everything credited. `paused` — the merchant kill switch. No NEW deposit is credited; money ALREADY credited still forwards. Reversible with `PATCH`. `disabled` — soft delete via `DELETE`. Same money semantics as `paused`, not intended to be undone. The row is never removed because funds may still arrive. `expired` — a single-session deposit window closed. Set by the system, never assignable by the API. | | `expires_at` | string \| null | yes | `null` for every permanent address (BTC, EVM, Solana, Tron). An ISO timestamp only for the single-session `utxo` coins. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | `null` on every forward created before the resource became mutable, and on any that has never been patched. | ### GET `/api/v1/address/create` **Create (or return) a forwarding address via query parameters** — `createForwardViaQuery` The browser/`curl`-friendly twin of `POST /api/v1/address` — same auth, rate-limit bucket (`fwd:`), validation, error codes, status codes and response shape, with query parameters instead of a JSON body. It still MUTATES on the first call for a given identity (it can return 201), so it remains a non-idempotent GET in the HTTP sense; determinism plus `Idempotency-Key` are what make a retry safe. **SDKs should use the POST.** The API key is never accepted as a query parameter — only the `Authorization` header, or the session cookie when the browser marks the request `Sec-Fetch-Site: same-origin` (a cross-site link or image cannot use a signed-in merchant's cookie to create forwards). Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | | `ticker` | query | yes | Aliases `coin`, `currency`, `asset` are also accepted. | | `destination` | query | yes | Aliases `address`, `to`, `payout_address` are also accepted. | | `callback` | query | no | Aliases `callback_url`, `webhook`, `webhook_url`, `url` are also accepted. | | `confirmations` | query | no | Alias `confs`. Non-numeric values are ignored rather than rejected. | | `metadata` | query | no | A JSON object encoded as a string. A parse failure is silently ignored, never an error. | Responses: - `200` — An existing forward with this identity was returned unchanged. - `201` — A new deposit address was derived. - `400` — Identical to `POST /api/v1/address`. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `not_allowed` — the matching forward is `paused` or `disabled`. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. - `502` — `upstream_error` — address derivation failed upstream. Retryable. `200` body — `Forward`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | The identifier. Canonical — every resource in this API names its identifier `id`, including this one. | | `forward_id` | string | yes | **Deprecated alias for `id`**, carrying the identical value. Forwards were the one resource that named their identifier something other than `id`, which forced an SDK to special-case them. New code should read `id`. It is NOT going away: removing a response field is a breaking change under the versioning policy, so `forward_id` will be emitted for the whole life of v1. Note also that `forward_id` inside a `forward.*` webhook payload is NOT deprecated — there it names a relationship to a forward rather than the payload's own identity. | | `ticker` | string | yes | The ticker string exactly as you supplied it at create time, not the canonical form. Two spellings that resolve to the same asset still share ONE forward. | | `provider` | `bitcoind` \| `utxo` \| `evm` \| `solana` \| `tron` | yes | | | `chain` | string \| null | yes | `null` for `btc` and the other `utxo`-provider coins, which have no chain concept here. | | `address` | string | yes | The deposit address to hand to payers. | | `destination` | string | yes | Your wallet. IMMUTABLE — `PATCH` refuses to change it with `409 not_allowed`. | | `callback_url` | string \| null | yes | Receives `forward.*` events only. Account-level webhook endpoints do NOT receive them. | | `confirmations_required` | integer | yes | Confirmations before a payment is credited. Defaults to the deployment's BTC confirmation count. | | `min_forward` | string | yes | **The one money field on this object that is NOT base units.** It is a DISPLAY-UNIT decimal string (e.g. `"0.500000"`) sitting inside an object of exact base-unit values, computed from the stored `min_forward_base` at serialisation time. Multiply by `10 ** decimals` before comparing it with a `value` from `ForwardPayment`. The base-unit field itself is stored but never serialised. | | `status` | ForwardStatus | yes | `active` — watching for new deposits and forwarding everything credited. `paused` — the merchant kill switch. No NEW deposit is credited; money ALREADY credited still forwards. Reversible with `PATCH`. `disabled` — soft delete via `DELETE`. Same money semantics as `paused`, not intended to be undone. The row is never removed because funds may still arrive. `expired` — a single-session deposit window closed. Set by the system, never assignable by the API. | | `expires_at` | string \| null | yes | `null` for every permanent address (BTC, EVM, Solana, Tron). An ISO timestamp only for the single-session `utxo` coins. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | `null` on every forward created before the resource became mutable, and on any that has never been patched. | ### GET `/api/v1/address/{id}` **Retrieve a forwarding address with its payment and callback log** — `getForward` The `Forward` fields SPREAD at the top level, plus two capped sub-collections. The caps are declared rather than silent: `payments` is capped at 200 and `callbacks` at 50, and `payments_has_more` / `callbacks_has_more` tell you when you are seeing a truncated view. Neither sub-collection is paginated — there is no cursor for them. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The forwarding address's `id`, returned at create time. (The response also carries `forward_id` with the same value — deprecated, kept permanently for backwards compatibility; read `id`.) Not format-checked — an unknown value is a 404. | Responses: - `200` — The forward plus its payment and callback history. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `ForwardDetail`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | The identifier. Canonical — every resource in this API names its identifier `id`, including this one. | | `forward_id` | string | yes | **Deprecated alias for `id`**, carrying the identical value. Forwards were the one resource that named their identifier something other than `id`, which forced an SDK to special-case them. New code should read `id`. It is NOT going away: removing a response field is a breaking change under the versioning policy, so `forward_id` will be emitted for the whole life of v1. Note also that `forward_id` inside a `forward.*` webhook payload is NOT deprecated — there it names a relationship to a forward rather than the payload's own identity. | | `ticker` | string | yes | The ticker string exactly as you supplied it at create time, not the canonical form. Two spellings that resolve to the same asset still share ONE forward. | | `provider` | `bitcoind` \| `utxo` \| `evm` \| `solana` \| `tron` | yes | | | `chain` | string \| null | yes | `null` for `btc` and the other `utxo`-provider coins, which have no chain concept here. | | `address` | string | yes | The deposit address to hand to payers. | | `destination` | string | yes | Your wallet. IMMUTABLE — `PATCH` refuses to change it with `409 not_allowed`. | | `callback_url` | string \| null | yes | Receives `forward.*` events only. Account-level webhook endpoints do NOT receive them. | | `confirmations_required` | integer | yes | Confirmations before a payment is credited. Defaults to the deployment's BTC confirmation count. | | `min_forward` | string | yes | **The one money field on this object that is NOT base units.** It is a DISPLAY-UNIT decimal string (e.g. `"0.500000"`) sitting inside an object of exact base-unit values, computed from the stored `min_forward_base` at serialisation time. Multiply by `10 ** decimals` before comparing it with a `value` from `ForwardPayment`. The base-unit field itself is stored but never serialised. | | `status` | ForwardStatus | yes | `active` — watching for new deposits and forwarding everything credited. `paused` — the merchant kill switch. No NEW deposit is credited; money ALREADY credited still forwards. Reversible with `PATCH`. `disabled` — soft delete via `DELETE`. Same money semantics as `paused`, not intended to be undone. The row is never removed because funds may still arrive. `expired` — a single-session deposit window closed. Set by the system, never assignable by the API. | | `expires_at` | string \| null | yes | `null` for every permanent address (BTC, EVM, Solana, Tron). An ISO timestamp only for the single-session `utxo` coins. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | `null` on every forward created before the resource became mutable, and on any that has never been patched. | | `payments` | ForwardPayment[] | yes | Newest first, capped at 200. Not paginated. | | `payments_has_more` | boolean | yes | True when the 200 cap truncated the array. There is no cursor to reach the rest. | | `callbacks` | ForwardCallback[] | yes | Delivery log for this forward's own webhooks. Newest first, capped at 50. Not paginated. | | `callbacks_has_more` | boolean | yes | True when the 50 cap truncated the array. | ### PATCH `/api/v1/address/{id}` **Update a forwarding address** — `updateForward` The merchant kill switch. **Mutable: `status` (`active` ⇄ `paused`) and `callback_url`.** `destination` and `ticker` are IMMUTABLE and are refused with `409 not_allowed` BEFORE the forward is looked up — so the answer is identical whether or not the id exists, and a patch carrying an illegal field alongside a legal one can never be half-applied. Repointing a live deposit address is exactly what a leaked key would be used for. Changing `callback_url` recomputes the forward's deterministic identity; if that would collide with another of your forwards the call is `409 already_exists`. Returns the updated resource in the plain `Forward` shape — no `payments` / `callbacks`. Does NOT accept `Idempotency-Key`. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The forwarding address's `id`, returned at create time. (The response also carries `forward_id` with the same value — deprecated, kept permanently for backwards compatibility; read `id`.) Not format-checked — an unknown value is a 404. | Request body — `ForwardUpdateRequest`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `status` | `active` \| `paused` | no | Only these two are assignable. `expired` is a fact about a closed single-session window; use `DELETE` for `disabled`. | | `callback_url` | string \| null | no | Aliases `callback`, `webhook`, `webhook_url`, `url` are also accepted. `null` or an empty string clears it. Changing it recomputes the forward's dedupe identity. | Responses: - `200` — The updated forward. - `400` — `bad_request` — body is not a JSON object, `status` is not `active`/`paused`, `callback_url` is not a valid URL (and, in production, not https — plain http is accepted only for a .onion address, delivered over Tor), or the body contains no mutable field at all. `limit_exceeded` — re-activating a paused forward would exceed the account's maximum of active EVM / Solana / Tron forwards. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `409` — `not_allowed` — an immutable field (`destination`/`address`/`to`/`payout_address`, `ticker`/`coin`/`currency`/`asset`/`chain`/`provider`) was present, or a `status` change was requested on an `expired` forward, whose single-session deposit window cannot be reopened. `already_exists` — the new `callback_url` would collide with another of your forwards. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `Forward`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | The identifier. Canonical — every resource in this API names its identifier `id`, including this one. | | `forward_id` | string | yes | **Deprecated alias for `id`**, carrying the identical value. Forwards were the one resource that named their identifier something other than `id`, which forced an SDK to special-case them. New code should read `id`. It is NOT going away: removing a response field is a breaking change under the versioning policy, so `forward_id` will be emitted for the whole life of v1. Note also that `forward_id` inside a `forward.*` webhook payload is NOT deprecated — there it names a relationship to a forward rather than the payload's own identity. | | `ticker` | string | yes | The ticker string exactly as you supplied it at create time, not the canonical form. Two spellings that resolve to the same asset still share ONE forward. | | `provider` | `bitcoind` \| `utxo` \| `evm` \| `solana` \| `tron` | yes | | | `chain` | string \| null | yes | `null` for `btc` and the other `utxo`-provider coins, which have no chain concept here. | | `address` | string | yes | The deposit address to hand to payers. | | `destination` | string | yes | Your wallet. IMMUTABLE — `PATCH` refuses to change it with `409 not_allowed`. | | `callback_url` | string \| null | yes | Receives `forward.*` events only. Account-level webhook endpoints do NOT receive them. | | `confirmations_required` | integer | yes | Confirmations before a payment is credited. Defaults to the deployment's BTC confirmation count. | | `min_forward` | string | yes | **The one money field on this object that is NOT base units.** It is a DISPLAY-UNIT decimal string (e.g. `"0.500000"`) sitting inside an object of exact base-unit values, computed from the stored `min_forward_base` at serialisation time. Multiply by `10 ** decimals` before comparing it with a `value` from `ForwardPayment`. The base-unit field itself is stored but never serialised. | | `status` | ForwardStatus | yes | `active` — watching for new deposits and forwarding everything credited. `paused` — the merchant kill switch. No NEW deposit is credited; money ALREADY credited still forwards. Reversible with `PATCH`. `disabled` — soft delete via `DELETE`. Same money semantics as `paused`, not intended to be undone. The row is never removed because funds may still arrive. `expired` — a single-session deposit window closed. Set by the system, never assignable by the API. | | `expires_at` | string \| null | yes | `null` for every permanent address (BTC, EVM, Solana, Tron). An ISO timestamp only for the single-session `utxo` coins. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | `null` on every forward created before the resource became mutable, and on any that has never been patched. | ### DELETE `/api/v1/address/{id}` **Disable a forwarding address** — `disableForward` Soft delete — sets `status: "disabled"`. The row is NEVER removed: money can still arrive at a deposit address after a merchant stops using it, and a deleted row would make that money unattributable. Same money semantics as `paused` — no NEW deposit is credited, and everything already credited still forwards to the destination. Idempotent: disabling an already-disabled forward returns it unchanged. Note that this also overwrites `expired`. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The forwarding address's `id`, returned at create time. (The response also carries `forward_id` with the same value — deprecated, kept permanently for backwards compatibility; read `id`.) Not format-checked — an unknown value is a 404. | Responses: - `200` — The forward, now `disabled`. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `Forward`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | The identifier. Canonical — every resource in this API names its identifier `id`, including this one. | | `forward_id` | string | yes | **Deprecated alias for `id`**, carrying the identical value. Forwards were the one resource that named their identifier something other than `id`, which forced an SDK to special-case them. New code should read `id`. It is NOT going away: removing a response field is a breaking change under the versioning policy, so `forward_id` will be emitted for the whole life of v1. Note also that `forward_id` inside a `forward.*` webhook payload is NOT deprecated — there it names a relationship to a forward rather than the payload's own identity. | | `ticker` | string | yes | The ticker string exactly as you supplied it at create time, not the canonical form. Two spellings that resolve to the same asset still share ONE forward. | | `provider` | `bitcoind` \| `utxo` \| `evm` \| `solana` \| `tron` | yes | | | `chain` | string \| null | yes | `null` for `btc` and the other `utxo`-provider coins, which have no chain concept here. | | `address` | string | yes | The deposit address to hand to payers. | | `destination` | string | yes | Your wallet. IMMUTABLE — `PATCH` refuses to change it with `409 not_allowed`. | | `callback_url` | string \| null | yes | Receives `forward.*` events only. Account-level webhook endpoints do NOT receive them. | | `confirmations_required` | integer | yes | Confirmations before a payment is credited. Defaults to the deployment's BTC confirmation count. | | `min_forward` | string | yes | **The one money field on this object that is NOT base units.** It is a DISPLAY-UNIT decimal string (e.g. `"0.500000"`) sitting inside an object of exact base-unit values, computed from the stored `min_forward_base` at serialisation time. Multiply by `10 ** decimals` before comparing it with a `value` from `ForwardPayment`. The base-unit field itself is stored but never serialised. | | `status` | ForwardStatus | yes | `active` — watching for new deposits and forwarding everything credited. `paused` — the merchant kill switch. No NEW deposit is credited; money ALREADY credited still forwards. Reversible with `PATCH`. `disabled` — soft delete via `DELETE`. Same money semantics as `paused`, not intended to be undone. The row is never removed because funds may still arrive. `expired` — a single-session deposit window closed. Set by the system, never assignable by the API. | | `expires_at` | string \| null | yes | `null` for every permanent address (BTC, EVM, Solana, Tron). An ISO timestamp only for the single-session `utxo` coins. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | `null` on every forward created before the resource became mutable, and on any that has never been patched. | ## Catalogue ### GET `/api/v1/tickers` **List forwarding tickers** — `listTickers` Public. Every `(asset, chain)` pair this deployment offers for forwarding. A finite catalogue returned as ONE page, so `has_more` is honestly `false` and `next_cursor` is `null`; `limit` and `cursor` are not read. A ticker listed here can still be rejected with `bad_ticker` at create time — the listing gates on the UTXO payment nodes being configured at all, not on a specific coin being enabled. Responses: - `200` — The full ticker catalogue. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | Ticker[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### GET `/api/v1/fees/estimate` **Estimate current network (blockchain) fees** — `estimateNetworkFees` Public. The current estimated NETWORK fee per chain — what the blockchain charges, not what Receivify charges. A finite catalogue returned as ONE page, so `has_more` is honestly `false` and `next_cursor` is `null`; `limit` and `cursor` are not read. **This endpoint never calls a node.** A background worker refreshes a per-chain cache on a jittered timer and this route does a single indexed read of it, exactly as FX rates work. Upstream call volume is a function of that timer and the chain count — never of your request rate — so polling this cannot rate-limit us or you. **It is designed not to fail.** A chain whose refresh is failing keeps returning its last known good numbers with `stale: true` and an honest `age_seconds`; a chain that has never succeeded returns `status: "unavailable"` with an EMPTY `levels` array. It never returns a fabricated `0`, and it does not 5xx because a node is down. Check `degraded` / `last_error` if you need to decide whether to trust a row. **Every figure is ADVISORY** (`advisory` is always `true`). It is for display and planning. The fee actually deducted is decided by the node at broadcast time, and nothing on the settlement path reads these numbers. Filters combine with AND. An unparseable filter is a `400`; a filter that is understood but matches no chain is a `404`, so "no such chain" and "no fee right now" stay distinguishable. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `chain` | query | no | Exact chain id, e.g. `bitcoin`, `ethereum`, `base`, `solana`, `tron`. Unknown ids are a `400` listing the valid ones. | | `asset` | query | no | Asset symbol, e.g. `usdt`. Selects every chain that carries it. An asset on no chain is a `400`. | | `ticker` | query | no | A forwarding ticker (`btc`, `usdc_base`, `usdt_tron`, …), resolved by the same resolver `GET /api/v1/tickers` publishes, so the two endpoints cannot disagree about which chain a ticker means. | Responses: - `200` — One estimate per matching chain. - `400` — `bad_request` — an unknown `chain`, an unknown `asset`, or a `ticker` that does not resolve. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | NetworkFeeEstimate[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### GET `/api/v1/assets` **List invoiceable assets** — `listAssets` Public. The coins currently enabled for invoicing, driven by the admin panel. A finite catalogue returned as ONE page, so `has_more` is honestly `false`; `limit` and `cursor` are not read. **This response is display metadata, not machine data.** `min` and `network_fee` are human-facing strings — see their field descriptions before computing with them. Optionally authenticated: with a valid API key (Bearer) each asset also carries `payout_ready` and `payout_networks`, so a store can hide coins whose invoices would be refused with `409 payout_address_missing`. Anonymous responses are unchanged. `?expand=networks` (opt-in, additive) returns one `AssetPair` row per (asset, chain) instead — USDT is nine rows (Tron, Ethereum, BSC, ...), each with its own `decimals` — so a picker can send the `chain` an invoice needs. Same list the cart plugins ship. Without the parameter the response is exactly the per-symbol list above. **Fee Guard.** When the merchant has switched Fee Guard on (Settings), an authenticated response also carries `fee_guard`, naming the pairs hidden from their customers right now because their network fee is unusually high. With an API key and `?expand=networks`, those pairs are left out of `data`; add `fee_guard=off` for the full list. The per-symbol list and dashboard sessions are never shortened, and creating an invoice is never refused because of Fee Guard. Without the switch the response is unchanged. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `expand` | query | no | `networks` — one row per (asset, chain) pair (`AssetPair`). Any other value is ignored. | | `fee_guard` | query | no | `off` — with an API key and `expand=networks`, return the full list even while Fee Guard hides pairs. Any other value is ignored. | Responses: - `200` — The enabled-asset catalogue (or, with `expand=networks`, its pairs). - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | Asset \| AssetPair[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | | `fee_guard` | object | no | Present only for an authenticated merchant who has switched Fee Guard on. | ## Tickers ### GET `/api/v1/tickers/{ticker}/info` **Everything about one ticker** — `getTickerInfo` The reference card for a single ticker: whether it can settle RIGHT NOW, the minimum a payment must clear to be economical to forward, the current advisory network fee, and — opt-in via `prices=1` — exchange rates in every supported fiat. `GET /api/v1/tickers` answers "what can I use". This answers "what do I need to know before I ask a customer for money in it". NEVER CALLS A NODE OR A PRICE API. Minimums are computed locally, fee estimates come from the network-fee cache we keep up to date, and prices come from our latest rates snapshot, so serving this a million times costs what serving it once does. `live` is a real store-aware settlement probe, not a catalogue flag — the same source the invoice endpoint enforces with `asset_unavailable`. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `ticker` | path | yes | A ticker from `GET /api/v1/tickers`, e.g. `btc` or `usdc_base`. | | `prices` | query | no | Set to `1` to include exchange rates. Omitted by default — it is ~55 currencies of payload. | Responses: - `200` — The ticker. - `400` — `bad_ticker` — no such ticker on this deployment. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body — `TickerInfo`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ticker` | string | yes | | | `coin` | string | yes | Human-readable name. | | `symbol` | string | yes | | | `chain` | string \| null | yes | The settlement chain, or `null` for a single-chain coin like BTC. | | `network` | string \| null | no | | | `decimals` | integer | yes | | | `color` | string \| null | no | | | `live` | boolean | yes | Whether this asset can settle RIGHT NOW — a real store-aware probe, not a catalogue flag. When false, `POST /api/v1/invoices` rejects it with `asset_unavailable`. | | `status` | `live` \| `pending` \| `off` | yes | | | `minimum_transaction` | string \| null | yes | **Exact base units as a string.** Payments below this cost more to forward than they are worth and are ignored by the sweeper. `"0"` is a real answer for a native coin — there is no token-gas floor to clear. | | `minimum_transaction_coin` | string \| null | yes | **A decimal string** — the same figure for display. Never a JSON number. | | `minimum_note` | string | no | | | `network_fee_estimation` | string \| null | yes | A human line such as `~0.000001 BTC`. Advisory; the real fee is set by the node at broadcast. | | `network_fee_stale` | boolean \| null | no | True when the estimate is last-known-good because the chain refresh is failing. | | `fee_percent_from` | number | no | Our commission at the entry tier (1.0 = 1%). It falls with monthly volume — see `GET /api/v1/fees/tier`. | | `fee_percent_to` | number | no | Our commission at the top tier. | | `prices` | object \| null | yes | Present only when `prices=1`. Keys are ISO-4217 codes, values are the cost of ONE unit of this asset in that currency. Floating-point and DISPLAY ONLY — settlement uses a rate locked server-side, and the money path refuses a stale snapshot outright. | | `prices_updated` | string \| null | no | | | `prices_stale` | boolean \| null | no | | | `advisory` | boolean | yes | Always true. Nothing in this response is a quote. | ### GET `/api/v1/tickers/{ticker}/qrcode` **Payment QR code for an address** — `getTickerQrCode` A base64 PNG QR code for a payment address, plus the URI it encodes. Render it with `` — the prefix is NOT included, by convention. `payment_uri` is a BIP-21-style URI only for the coins that actually have one (BTC, LTC, DOGE, BCH, ZEC, XMR). On EVM, Solana and Tron it is `null` and the code encodes the BARE ADDRESS; the amount cannot be expressed and must be shown separately. Check `value_encoded` rather than assuming. Even where an amount IS encoded, not every wallet reads it — some take the address and ignore the rest. A checkout should keep displaying the figure in text regardless. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `ticker` | path | yes | | | `address` | query | yes | The payment address to encode. | | `value` | query | no | A DECIMAL coin amount, e.g. `0.0025`. Rejected rather than rounded if it does not parse — a code encoding the wrong amount is worse than one encoding none. Omit for an address-only code. | | `size` | query | no | Image width in pixels. Clamped to 64–1024; defaults to 512. | Responses: - `200` — The QR code. - `400` — `bad_ticker` — no such ticker. `bad_request` — missing/invalid `address`, or an unparseable `value`. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body — `TickerQrCode`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ticker` | string | yes | | | `qr_code` | string | yes | Base64 PNG WITHOUT the `data:image/png;base64,` prefix. | | `payment_uri` | string \| null | yes | The BIP-21 URI encoded in the image, or `null` when the code carries only the bare address — which is the case on EVM, Solana and Tron, and whenever `value` is omitted. | | `address` | string | yes | | | `value` | string \| null | yes | The decimal amount echoed back, or `null` if none was given. | | `value_encoded` | boolean | yes | Whether the amount actually made it into the code. False means the customer must be shown the figure separately — always do this anyway, since some wallets ignore the URI amount. | | `size` | integer | yes | | ## Payouts ### GET `/api/v1/payouts/batch` **List mass payout batches** — `listPayoutBatches` Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | Responses: - `200` — Your batches, newest first. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | PayoutBatch[] | yes | | | `has_more` | boolean | yes | | | `next_cursor` | string \| null | yes | | ### POST `/api/v1/payouts/batch` **Pay many destinations in one request** — `createPayoutBatch` One request, many destinations — affiliates, contractors, marketplace sellers, payroll. **THIS ENDPOINT DOES NOT BROADCAST.** It validates, prices and RECORDS the batch; the worker sends, behind the same `*_SWEEP_ENABLED` gates as every other outbound movement. **Dashboard sessions** follow the account's two-factor step-up policy ('withdrawals'; not for `dry_run`): `401 totp_required` unless the session holds a step-up grant or the body carries `totp` / `telegram_code` / `recovery_code`. API-key callers are unaffected. **ALL-OR-NOTHING VALIDATION.** Every item is checked before anything is written. One invalid address, one amount below the spendable floor, or one duplicated destination rejects the WHOLE request, naming the failing index. Accepting 199 of 200 and quietly dropping one is the failure nobody notices until reconciliation. **SAFE TO RETRY, TWO WAYS.** `Idempotency-Key` replays the original response. `reference` is additionally a business key, unique per merchant: resubmitting one that already exists returns the EXISTING batch with a **200** rather than paying everyone a second time. A genuine create is a **201**, so a caller can always tell the two apart. Amounts are decimal strings in the coin's own units, and are converted to exact base units and summed as integers — a batch is precisely where a float rounding error compounds. Send `?dry_run=1` to validate a batch and see its totals without writing anything. **LIMITS.** 20 requests per 10 minutes per account (dry runs included), and at most 5 unfunded batches waiting at once. A batch whose funding address is still EMPTY 14 days after creation is closed as `expired` (see `status_reason` and `funding_expires_at`); nothing is ever sent from an expired batch. A batch holding any funds is never expired. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | | `dry_run` | query | no | Set to `1` to validate and total the batch without creating it. | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `asset` | string | yes | The coin every item is paid in. One asset per batch. | | `chain` | string \| null | no | EVM assets only: the chain the batch is funded and sent on. Required when the asset exists on more than one network; see `GET /api/v1/payouts/batch/chains` for the chains your account may use. | | `reference` | string | no | Your business key. Unique per merchant, and what makes a retry idempotent. | | `items` | object[] | yes | At most 500 destinations. Split a larger run. | Responses: - `200` — A batch with this `reference` already existed and is returned unchanged. Nothing was created. - `201` — The batch was created. - `400` — `bad_request` — an invalid address, an unparseable or non-positive amount, an amount below the spendable floor, a duplicated destination, an empty or oversized `items`, or an unknown asset. The detail names the failing index. `chain_required` — the asset exists on more than one network and no `chain` was given. The detail lists the networks and says whether the asset is the native coin or a token on each. `asset_unavailable` — the asset cannot be paid out in a batch on this deployment (or on that chain), or no current network-fee estimate exists to price it. Retry later. `limit_exceeded` — the account already has its maximum number of unfunded (`pending`) batches waiting (default 5). Fund one, or wait for an empty one to expire, then retry. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `reference_conflict` — this `reference` was already used for a batch with different details (asset, network, items or total). Nothing was created; use a new reference. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body — `PayoutBatch`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `asset` | string | yes | | | `reference` | string \| null | yes | | | `status` | string | yes | The batch roll-up. Individual rows carry their own status. One of `pending` (waiting for funds), `funded`, `sending`, `sent`, `partial`, `failed`, `cancelled`, or `expired` (not fully funded within the funding window; nothing was sent to the destinations). | | `status_reason` | string \| null | no | Why the batch is in its status, when that needs saying — e.g. why it expired. Null otherwise. | | `refund` | boolean | no | Present (and true) only on a `cancelled` or `expired` EVM batch whose funding address is being emptied back to your payout address for that coin. | | `funding_address` | string \| null | no | Where to send the funds for this batch. Send `funding_required` of the batch asset (plus `funding_gas_required` of the chain's gas coin, for a token batch) here; the worker sends once it is funded. | | `funding_required` | string \| null | no | Amount to fund, in base units, as an integer string: the item total plus the network-fee margin. | | `funding_required_decimal` | string \| null | no | `funding_required` in the coin's own units, as a decimal string. | | `funding_gas_required` | string \| null | no | Token batches only: native gas coin needed on top, in base units. `null` when none is needed. | | `funding_gas_asset` | string \| null | no | The coin `funding_gas_required` is paid in (the network's native coin). `null` when none is needed. | | `funding_gas_required_decimal` | string \| null | no | `funding_gas_required` in that coin's own units, as a decimal string. | | `funds_on_other_network` | object | no | Present only while `pending`: the batch asset was found at the funding address on a DIFFERENT network. Nothing is lost; move the batch with `POST /api/v1/payouts/batch/{id}/network` or send the rest on the batch network. | | `funding_received_decimal` | string \| null | no | What the last funding check confirmed at the funding address, in the batch asset. Null before the first check. | | `funding_shortfall_decimal` | string \| null | no | What is still needed in the batch asset (never negative). Null before the first check. | | `funding_gas_received_decimal` | string \| null | no | Token batches: gas coin confirmed so far. Null when not applicable or not yet checked. | | `funding_gas_shortfall_decimal` | string \| null | no | Token batches: gas coin still needed (never negative). | | `network` | object \| null | no | EVM batches: the network spelled out. Send funds on this network only. `null` for other providers. | | `funded_at` | string \| null | no | | | `txid` | string \| null | no | A single broadcast transaction id, for providers that pay the whole batch in one transaction. EVM batches carry one `txid` per item instead. | | `leftover` | object | no | Present once a `sent` batch (EVM chains) has had its leftover handled: whatever remained at the funding address after every payment was mined (the fee margin, fees charged below the estimate, any over-funding) is sent back to YOUR payout address for that coin. A token batch returns the leftover token first, then the leftover gas coin. `status`: `waiting`, `verifying`, `returned`, `no_destination` (set a payout address for that coin and it is retried), or `dust` (too small to pay for its own transfer). | | `funding_expires_at` | string \| null | no | While `pending`: when the batch expires if its funding address is still empty. Null otherwise. | | `chain` | string \| null | no | The EVM chain the batch is funded and sent on. Null for non-EVM assets. | | `testnet` | boolean | no | Present (and true) only on a batch on a test network. It moves test coins only. | | `count` | integer | yes | | | `total` | string | yes | **Exact base units as a string** — the sum of every item. | | `total_decimal` | string | yes | **A decimal string** — the same total for display. | | `tally` | object | yes | Item counts by status, e.g. `{ "pending": 198, "sent": 2 }`. | | `items` | object[] | yes | | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | ### POST `/api/v1/payouts/batch/{id}/cancel` **Cancel a batch that has not been sent** — `cancelPayoutBatch` Only a `pending` batch (not yet fully funded) can be cancelled. On an EVM chain, anything that already reached the funding address is returned to your payout address for that coin (`refund: true` on the batch; the return shows under `leftover`). A Bitcoin batch that already holds funds cannot be cancelled here (`409 not_allowed`) — finish funding it, or contact support. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | | Responses: - `200` — The cancelled batch. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `409` — `not_allowed` — the batch is no longer `pending` (it is being sent or is closed), or it is a Bitcoin batch that already received funds. The detail says which. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PayoutBatch`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `asset` | string | yes | | | `reference` | string \| null | yes | | | `status` | string | yes | The batch roll-up. Individual rows carry their own status. One of `pending` (waiting for funds), `funded`, `sending`, `sent`, `partial`, `failed`, `cancelled`, or `expired` (not fully funded within the funding window; nothing was sent to the destinations). | | `status_reason` | string \| null | no | Why the batch is in its status, when that needs saying — e.g. why it expired. Null otherwise. | | `refund` | boolean | no | Present (and true) only on a `cancelled` or `expired` EVM batch whose funding address is being emptied back to your payout address for that coin. | | `funding_address` | string \| null | no | Where to send the funds for this batch. Send `funding_required` of the batch asset (plus `funding_gas_required` of the chain's gas coin, for a token batch) here; the worker sends once it is funded. | | `funding_required` | string \| null | no | Amount to fund, in base units, as an integer string: the item total plus the network-fee margin. | | `funding_required_decimal` | string \| null | no | `funding_required` in the coin's own units, as a decimal string. | | `funding_gas_required` | string \| null | no | Token batches only: native gas coin needed on top, in base units. `null` when none is needed. | | `funding_gas_asset` | string \| null | no | The coin `funding_gas_required` is paid in (the network's native coin). `null` when none is needed. | | `funding_gas_required_decimal` | string \| null | no | `funding_gas_required` in that coin's own units, as a decimal string. | | `funds_on_other_network` | object | no | Present only while `pending`: the batch asset was found at the funding address on a DIFFERENT network. Nothing is lost; move the batch with `POST /api/v1/payouts/batch/{id}/network` or send the rest on the batch network. | | `funding_received_decimal` | string \| null | no | What the last funding check confirmed at the funding address, in the batch asset. Null before the first check. | | `funding_shortfall_decimal` | string \| null | no | What is still needed in the batch asset (never negative). Null before the first check. | | `funding_gas_received_decimal` | string \| null | no | Token batches: gas coin confirmed so far. Null when not applicable or not yet checked. | | `funding_gas_shortfall_decimal` | string \| null | no | Token batches: gas coin still needed (never negative). | | `network` | object \| null | no | EVM batches: the network spelled out. Send funds on this network only. `null` for other providers. | | `funded_at` | string \| null | no | | | `txid` | string \| null | no | A single broadcast transaction id, for providers that pay the whole batch in one transaction. EVM batches carry one `txid` per item instead. | | `leftover` | object | no | Present once a `sent` batch (EVM chains) has had its leftover handled: whatever remained at the funding address after every payment was mined (the fee margin, fees charged below the estimate, any over-funding) is sent back to YOUR payout address for that coin. A token batch returns the leftover token first, then the leftover gas coin. `status`: `waiting`, `verifying`, `returned`, `no_destination` (set a payout address for that coin and it is retried), or `dust` (too small to pay for its own transfer). | | `funding_expires_at` | string \| null | no | While `pending`: when the batch expires if its funding address is still empty. Null otherwise. | | `chain` | string \| null | no | The EVM chain the batch is funded and sent on. Null for non-EVM assets. | | `testnet` | boolean | no | Present (and true) only on a batch on a test network. It moves test coins only. | | `count` | integer | yes | | | `total` | string | yes | **Exact base units as a string** — the sum of every item. | | `total_decimal` | string | yes | **A decimal string** — the same total for display. | | `tally` | object | yes | Item counts by status, e.g. `{ "pending": 198, "sent": 2 }`. | | `items` | object[] | yes | | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | ### POST `/api/v1/payouts/batch/{id}/network` **Move an unsent batch to another network** — `movePayoutBatchNetwork` For a batch whose funding address was paid on a different network than the one it was created for (the same address exists on every EVM network). When `funds_on_other_network` is present on the batch, this re-prices the batch for that network and counts what is already there. Only a `pending` batch whose payments have not been prepared can move; the write is conditional, so a batch that starts sending first is left alone. The target must carry the batch's asset with the same decimals. Asking again for the network the batch already moved to returns it unchanged. Never automatic. The response is the batch plus `move` (`held_decimal`, `required_decimal`, `shortfall_decimal`: what to top up, `"0"` when covered). Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `chain` | string | yes | The network to move to, for example `polygon`. | Responses: - `200` — The batch on its new network, plus `move`. - `400` — `bad_request` (no `chain`) or `asset_unavailable` (the network does not carry this asset, is a test network, or counts it differently, or no fee estimate is available yet). - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `409` — `not_allowed` — the batch is no longer movable (not `pending`, a payment was already prepared, or it changed while moving). The detail says which. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `asset` | string | yes | | | `reference` | string \| null | yes | | | `status` | string | yes | The batch roll-up. Individual rows carry their own status. One of `pending` (waiting for funds), `funded`, `sending`, `sent`, `partial`, `failed`, `cancelled`, or `expired` (not fully funded within the funding window; nothing was sent to the destinations). | | `status_reason` | string \| null | no | Why the batch is in its status, when that needs saying — e.g. why it expired. Null otherwise. | | `refund` | boolean | no | Present (and true) only on a `cancelled` or `expired` EVM batch whose funding address is being emptied back to your payout address for that coin. | | `funding_address` | string \| null | no | Where to send the funds for this batch. Send `funding_required` of the batch asset (plus `funding_gas_required` of the chain's gas coin, for a token batch) here; the worker sends once it is funded. | | `funding_required` | string \| null | no | Amount to fund, in base units, as an integer string: the item total plus the network-fee margin. | | `funding_required_decimal` | string \| null | no | `funding_required` in the coin's own units, as a decimal string. | | `funding_gas_required` | string \| null | no | Token batches only: native gas coin needed on top, in base units. `null` when none is needed. | | `funding_gas_asset` | string \| null | no | The coin `funding_gas_required` is paid in (the network's native coin). `null` when none is needed. | | `funding_gas_required_decimal` | string \| null | no | `funding_gas_required` in that coin's own units, as a decimal string. | | `funds_on_other_network` | object | no | Present only while `pending`: the batch asset was found at the funding address on a DIFFERENT network. Nothing is lost; move the batch with `POST /api/v1/payouts/batch/{id}/network` or send the rest on the batch network. | | `funding_received_decimal` | string \| null | no | What the last funding check confirmed at the funding address, in the batch asset. Null before the first check. | | `funding_shortfall_decimal` | string \| null | no | What is still needed in the batch asset (never negative). Null before the first check. | | `funding_gas_received_decimal` | string \| null | no | Token batches: gas coin confirmed so far. Null when not applicable or not yet checked. | | `funding_gas_shortfall_decimal` | string \| null | no | Token batches: gas coin still needed (never negative). | | `network` | object \| null | no | EVM batches: the network spelled out. Send funds on this network only. `null` for other providers. | | `funded_at` | string \| null | no | | | `txid` | string \| null | no | A single broadcast transaction id, for providers that pay the whole batch in one transaction. EVM batches carry one `txid` per item instead. | | `leftover` | object | no | Present once a `sent` batch (EVM chains) has had its leftover handled: whatever remained at the funding address after every payment was mined (the fee margin, fees charged below the estimate, any over-funding) is sent back to YOUR payout address for that coin. A token batch returns the leftover token first, then the leftover gas coin. `status`: `waiting`, `verifying`, `returned`, `no_destination` (set a payout address for that coin and it is retried), or `dust` (too small to pay for its own transfer). | | `funding_expires_at` | string \| null | no | While `pending`: when the batch expires if its funding address is still empty. Null otherwise. | | `chain` | string \| null | no | The EVM chain the batch is funded and sent on. Null for non-EVM assets. | | `testnet` | boolean | no | Present (and true) only on a batch on a test network. It moves test coins only. | | `count` | integer | yes | | | `total` | string | yes | **Exact base units as a string** — the sum of every item. | | `total_decimal` | string | yes | **A decimal string** — the same total for display. | | `tally` | object | yes | Item counts by status, e.g. `{ "pending": 198, "sent": 2 }`. | | `items` | object[] | yes | | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | | `move` | object | no | | ### GET `/api/v1/payouts/batch/chains` **EVM chains your account may send a mass payout on** — `listPayoutBatchChains` Every EVM chain this account may name as a batch's `chain`, with the assets it carries. A complete, finite list — always one page. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — The chains, in a stable order. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | object[] | yes | | | `has_more` | boolean | yes | | | `next_cursor` | string \| null | yes | | ### GET `/api/v1/payouts` **Read the live payout map and any staged changes** — `getPayouts` `pending` is an ordinary array with NO list envelope and NO bound — it is every open change, however many there are. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — The live payout addresses plus open changes. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PayoutState`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `payout_addresses` | object | yes | The LIVE map the sweeper reads, payout key to address — the asset symbol for its home network, or `@solana` / `@tron` (see `PATCH /api/v1/payouts`). Staged changes are not in here until they go live. | | `pending` | PayoutChange[] | yes | Every open change. NOT a list envelope and NOT bounded — there is no `has_more` and no cursor. | | `timelock_hours` | number | yes | THIS merchant's waiting period (hours) between a change and it going live — their payout-change protection setting, or the platform default if they never chose. | | `email_confirmation` | boolean | yes | Historical name for confirm_with_code: whether THIS merchant asks for a code (authenticator / Telegram, else email) before a payout change is accepted. | | `confirm_with_code` | boolean | no | Whether THIS merchant asks for a code (authenticator / Telegram if set up, otherwise email) before a payout change is accepted. Same value as email_confirmation. | | `instant` | boolean | yes | True only when the timelock is zero AND code confirmation is off — the one configuration in which a change applies with nothing asked. | ### PATCH `/api/v1/payouts` **Stage payout-address changes** — `stagePayoutChanges` Nothing is applied inline. A change is staged, may require email confirmation, and then waits out a timelock before the sweeper will send to it. An address whose value equals the live one is a no-op and appears in neither `staged` nor `applied`. A superseded open change for the same asset is cancelled first. `applied` is non-empty only when the deployment runs with the timelock at zero AND email confirmation off. Does not accept `Idempotency-Key`. **Dashboard session only — an API key gets `401 unauthorized`.** An API key lives on the store's server; if it could set a payout address, whoever stole it could redirect the merchant's money. Keys can READ payouts (`GET /api/v1/payouts`, `GET /api/v1/payout-status`) but there is deliberately no endpoint through which a key can change one. **A code first** — asked for before anything is staged, bound to this exact set of changes — when the merchant's payout protection says "confirm with a code" (`confirm_with_code`; every change, a first address for a network included), and always when **replacing or clearing an address that is already live**: - account with two-factor: `401 totp_required` with `fresh: true` — a step-up grant never stands in for it — unless the body carries `totp` / `telegram_code` / `recovery_code` (a code spent on this change alone; it does not unlock the session). Replacing a live address with code confirmation off is the exception: it follows the account's step-up policy ('payouts' — a live grant is enough). For a Telegram-only account the first `401` already sent the code (and `telegram: "sent"` says so; a live code for the same change is reused, not sent again). Add `request_telegram_code: true` to ask for a new one explicitly: that is the call answered `429 rate_limited` when codes were requested too often; an automatic send that is throttled stays `401 totp_required` with `telegram: "throttled"`; - no two-factor, Telegram linked: `401 telegram_code_required` (a 6-digit code was just sent to Telegram — never emailed) — resend the same body with `telegram_code`; - no two-factor, no Telegram: `401 email_code_required` (a 6-digit code was just emailed) — resend the same body with `email_code`. A wrong or expired code is `401 *_code_invalid`. Then the waiting period applies (`timelock_hours`), the same for a first address as for a replacement. Auth: `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `addresses` | object | no | Payout key to destination address. An empty string CLEARS that key. Defaults to `{}` when omitted, which is a no-op. A key is the asset symbol (`btc`, `eth`, `usdt`, `sol`, `trx` …) for the asset's HOME network — EVM for `usdt` / `usdc` / `pyusd` — or `@solana` / `@tron` for a token that also settles on that chain: `usdt@solana`, `usdc@solana`, `pyusd@solana`, `usdt@tron`. A payment is forwarded to the key for the network it ARRIVED on, so USDT on Tron goes to `usdt@tron`, never to the EVM `usdt` address. (A Tron address saved under the bare `usdt` key before `usdt@tron` existed is still honoured for Tron payments.) Each new address must be valid on its key's network — a 0x address under `usdt@tron` is refused with `bad_request` and a message saying what is needed. Values left unchanged are not re-validated. | | `totp` | string | no | Second factor when asked (`totp_required`). Alternatives — `telegram_code`, `recovery_code`. | | `telegram_code` | string | no | | | `recovery_code` | string | no | | | `email_code` | string | no | The 6-digit code from the email, when asked (`email_code_required`). | Responses: - `200` — What was staged, what went live immediately, and everything still open. - `400` — `bad_request` — body is not JSON, a key is not a payout key (unknown symbol, or `@solana`/`@tron` on a coin that does not settle there), or an address is not valid on its key's network (e.g. "That is not a Tron address. USDT on Tron needs an address starting with T."). Every throw from `requestPayoutChanges` becomes this code. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PayoutStageAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `staged` | PayoutChange[] | yes | Changes created by THIS call. An address equal to the live one is a no-op and appears nowhere. | | `applied` | PayoutChange[] | yes | Changes that went live during this call. Non-empty only on an `instant` deployment. | | `pending` | PayoutChange[] | yes | Every open change after the call. | | `timelock_hours` | integer | yes | | | `email_confirmation` | boolean | yes | | | `message` | string | yes | A human sentence describing what happens next. Do not branch on it. | ### POST `/api/v1/payouts/changes/{id}/cancel` **Cancel a staged payout-address change** — `cancelPayoutChange` Returns an ACK, not the resource. A change that is already applied or cancelled is `409 not_allowed` — indistinguishable from an id that never existed. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | | Responses: - `200` — The change was cancelled. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `not_allowed` — no open change with that id belongs to the caller. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `CancelledAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `cancelled` | string | yes | The id that was cancelled — echoed from the path, not re-read from the database. | ### GET `/api/v1/payout-status` **Which networks can be paid out (read-only)** — `getPayoutStatus` For every network the account can be paid on (from the coins currently offered): `set` — an ACTIVE payout address exists; `missing` — none, so invoices on that network are refused with `409 payout_address_missing`; `pending_change` — a staged change is still waiting on its email confirmation / timelock (`pending_activates_at`). While a change is pending, the CURRENT address (if any) keeps taking payments — `payout_ready` says whether one exists. A network is split into several entries only when its coins are in different states or go to different addresses. Addresses are masked: first 6 + `…` + last 6. **Read-only, by design.** There is no write endpoint for payout addresses that accepts an API key: a key lives on the store's server, and a key that could repoint payouts would let whoever stole it redirect the money. Send the merchant to `dashboard_url` instead. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — Payout readiness per network. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PayoutStatus`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `networks` | object[] | yes | | | `dashboard_url` | string | yes | Absolute URL of Dashboard → Payouts, where the merchant sets addresses. | ## Telegram ### GET `/api/v1/telegram/link` **How many chats are linked** — `getTelegramLinkStatus` Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — Link status. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `linked_chats` | integer | yes | | | `configured` | boolean | yes | Whether a chat can be linked at all (this deployment's bot, or your own bot). | | `receivify_bot` | string \| null | no | The Receivify bot's username, or null when this deployment has none. | | `own_bot` | string \| null | no | Your own connected bot's username, or null. | ### POST `/api/v1/telegram/link` **Mint a code to link a Telegram chat** — `createTelegramLinkCode` Returns a short, single-use code. Send `/link CODE` to the bot on Telegram and that chat is bound to this account. **This is the bot's identity gate.** The Telegram webhook can prove a message came from a given chat id, but nothing about who owns that chat — so ownership is established here, by a caller signed in to this account's DASHBOARD (an API key alone cannot link a chat). The bot only ever answers chats bound this way. The bot allows five `/link` attempts per chat per 15 minutes. **A code first** when the account has two-factor: `401 totp_required` with `fresh: true` (a step-up grant never stands in for it) unless the JSON body carries `totp` / `telegram_code` / `recovery_code`, bound to this change alone. A Telegram-only account is sent the code by the first `401` (`telegram: "sent"`; a live one is reused); `request_telegram_code: true` asks for a new one and is the call answered `429 rate_limited` when requested too often (an automatic send that is throttled stays `401` with `telegram: "throttled"`). An account without two-factor gets `telegram_code_required` / `email_code_required` as for payouts. The code is stored HASHED, expires in ten minutes, and is deleted atomically on use so it cannot be replayed. The plaintext is returned once and cannot be re-read; mint another if it is lost. Minting invalidates any previous code for this account. Auth: `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `bot` | `receivify` \| `own` | no | Which bot `start_url` opens. `own` needs your own bot connected (Dashboard → Telegram). Default: the Receivify bot, or your own bot when the deployment has no shared bot. | Responses: - `201` — The code. - `400` — `not_enabled` — Telegram is not configured on this deployment. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. `201` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `code` | string | yes | Plaintext, returned ONCE. Uses an unambiguous alphabet — no O/0 or I/1/L. | | `expires_at` | string | yes | | | `instructions` | string | yes | | | `start_url` | string \| null | no | One-tap link, `https://t.me/?start=link_`. Opening it sends `/start link_`, which the bot redeems exactly like `/link CODE`. Null when the bot username is not configured. | | `bot` | `receivify` \| `own` | no | The bot `start_url` opens; messages to the linked chat are sent through it. | ### DELETE `/api/v1/telegram/link` **Unlink every chat** — `unlinkTelegramChats` When Telegram codes are one of the account's second factors, unlinking is a two-factor change: dashboard session only (`401 unauthorized` with an API key) and a second factor is required (`401 totp_required` unless the session holds a step-up grant or the JSON body carries `totp` / `recovery_code`). Otherwise unchanged. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — How many were unlinked. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `unlinked` | integer | yes | | ## Storefront ### GET `/api/v1/storefront` **Your storefront settings and products** — `getStorefront` Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — Settings plus every product, active or not. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body — `Storefront`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `handle` | string \| null | yes | | | `title` | string \| null | yes | | | `tagline` | string \| null | yes | | | `published` | boolean | yes | False unless explicitly set AND a handle exists. | | `products` | Product[] | yes | | ### POST `/api/v1/storefront` **Create or replace a product** — `upsertProduct` The slug identifies a product within a shop; posting the same slug replaces it. `price` is a decimal STRING and is stored as an integer of minor units. A price with more decimal places than the currency has is REJECTED rather than rounded — silently turning `19.999` into `20.00` changes the merchant's price without telling them. Auth: `bearerAuth` or `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `name` | string | yes | | | `slug` | string | no | Derived from `name` when omitted. | | `description` | string | no | | | `image_url` | string | no | Must be `https`. Anything else is dropped — it is rendered on a public page. | | `price` | string | yes | **A decimal string**, e.g. `"19.99"`. Never a JSON number. | | `currency` | string | no | ISO-4217. Defaults to USD. | | `active` | boolean | no | | | `sort_order` | integer | no | Lower lists first. Defaults to 0; ties list newest first. | | `stock` | integer \| null | no | Units left. `null` or omitted = unlimited. Decremented atomically when an order is PAID; 0 = sold out. | | `max_qty` | integer | no | Most a buyer may take in one order. Defaults to 1. | Responses: - `201` — The saved product. - `400` — `bad_request` — missing name, unsupported currency, or an unparseable price. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `201` body — `Product`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `slug` | string | yes | | | `name` | string | yes | | | `description` | string \| null | yes | | | `image_url` | string \| null | yes | | | `price` | string | yes | **A decimal string**, e.g. `"19.99"`. Stored as integer minor units. | | `currency` | string | yes | | | `active` | boolean | no | Present on the merchant view only; the public view never exposes it. | | `sort_order` | integer | no | Merchant view only. | | `stock` | integer \| null | no | Merchant view only. Units left; `null` = unlimited. | | `max_qty` | integer | no | Most per order. On the public view, present only when above 1 (and already capped by the remaining stock). | | `sold_out` | boolean | no | Public view: present (true) only when the product has no stock left. | ### PATCH `/api/v1/storefront` **Update settings, or publish** — `updateStorefront` `published` defaults to false and is only ever set by asking for it — a shop must never appear on the internet as a side effect of saving a title. Publishing requires a `handle`, because the handle IS the URL. Auth: `bearerAuth` or `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `handle` | string | no | 3–40 characters of a-z, 0-9 and hyphens. Globally unique, and becomes `/shop/{handle}`. | | `title` | string | no | | | `tagline` | string | no | | | `published` | boolean | no | | Responses: - `200` — The updated settings. - `400` — `bad_request` — an invalid or reserved handle, or publishing without one. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `already_exists` — that handle is taken. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body — `StorefrontSettings`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `handle` | string \| null | yes | | | `title` | string \| null | yes | | | `tagline` | string \| null | yes | | | `published` | boolean | yes | False unless explicitly set AND a handle exists. | ### DELETE `/api/v1/storefront` **Delete a product** — `deleteProduct` Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `slug` | query | yes | | Responses: - `200` — Deleted. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | ### GET `/api/v1/storefront/handle` **Check whether a shop handle is valid and free** — `checkStorefrontHandle` Advisory, for a live check while typing. `PATCH /api/v1/storefront` and a unique index are the real guard. Your own current handle counts as available. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `handle` | query | yes | | Responses: - `200` — The normalised handle and whether it can be used. - `400` — `bad_request` — no handle given. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `handle` | string | yes | | | `available` | boolean | yes | | | `reason` | string \| null | yes | | ### GET `/api/public/shop/{handle}` **A public storefront and its products** — `getPublicShop` Unauthenticated — this backs the public shop page. Returns only public product fields; nothing merchant-scoped. An UNPUBLISHED shop is a **404**, not a 403: telling an anonymous caller that a handle exists but is hidden is exactly what handle-squatting reconnaissance wants to know. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `handle` | path | yes | | Responses: - `200` — The shop. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `handle` | string | yes | | | `title` | string | yes | | | `tagline` | string \| null | yes | | | `products` | Product[] | yes | | ### POST `/api/public/shop/{handle}/checkout` **Buy one product** — `buyFromShop` Creates an invoice for one product and returns the checkout. **THE PRICE COMES FROM THE DATABASE, NEVER FROM THE REQUEST.** The body names a product slug and a coin and nothing else — a body that could carry an amount would let anyone buy anything for a penny, and that is a mistake only discovered after the goods have shipped. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `handle` | path | yes | | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `slug` | string | yes | | | `asset` | string | no | Defaults to `btc`. Must be settleable right now. | | `customer_email` | string | no | Optional buyer email, used for payment emails only when the shop owner has customer emails unlocked; otherwise ignored. | | `quantity` | integer | no | Defaults to 1. At most the product's `max_qty`, and no more than its remaining stock. The invoice is priced at quantity × price. | Responses: - `201` — The invoice. - `400` — `asset_unavailable` — that coin cannot settle right now. `bad_request` — also a quantity above the product's `max_qty`. `limit_exceeded` — the shop owner has too many unpaid invoices open right now; try again later. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `409` — `not_allowed` — the product is sold out, or fewer are left than the quantity asked for. Stock is taken when an invoice is paid, not reserved at checkout. `payout_address_missing` — the shop owner has no active payout address for that coin on its network, so the invoice is refused. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. `201` body — `Invoice`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `reference` | string \| null | yes | Your own business key. It is ALSO a de-duplication key: creating a second invoice with a reference this merchant has already used returns the EXISTING invoice with a 201. | | `asset` | string | yes | Lower-case symbol, e.g. `btc`, `usdc`. | | `amount_expected` | string | yes | **Exact-integer base units, as a STRING** — satoshis for BTC, wei for ETH, the coin's smallest unit otherwise. Never a JSON number: a 256-bit wei value does not survive a double. | | `amount_received` | string | yes | Exact-integer base units, as a string. `"0"` until something arrives. | | `amount_fiat` | string \| null | yes | **A DECIMAL string** (e.g. `"25.00"`), not base units and not a JSON number. It is the fiat price captured at create time and is display information only; the authoritative amount is `amount_expected`. Never settle against it. Always carries at least two fraction digits, and never fewer digits than the stored value needs — padding only ever adds zeros, so the value round-trips exactly. | | `fiat_currency` | string \| null | yes | ISO-4217 code that `amount_fiat` is denominated in. | | `chain` | string \| null | yes | The EVM chain for EVM assets, the literal `solana` or `tron` for those providers, and `null` for BTC and every other `utxo`-provider coin. The `chain` you SEND at create time defaults to `ethereum` regardless of asset; it is only consulted for EVM assets. | | `provider` | string \| null | yes | The settlement backend that derived the address. `utxo` is the BTC/LTC/DOGE/BCH/ZEC/XMR family settled on our own nodes. | | `address` | string | yes | The deposit address. Send exactly this asset on exactly this chain. | | `status` | InvoiceStatus | yes | The invoice lifecycle, mirrored by the strict Mongo validator. Treat it as an OPEN enum and keep a default branch: a new value is an additive change. `pending` is the creation state. `confirming` means seen on-chain but not yet final; `partial` means less than expected arrived; `swept` means the funds left the deposit address for the payout wallet; `partial_expired` means the window closed on an under-payment. | | `expires_at` | string | yes | | | `paid_at` | string \| null | yes | | | `created_at` | string | yes | | | `metadata` | object | yes | Whatever you stored. Always an object, never null — an omitted `metadata` comes back as `{}`. | | `checkout_url` | string | yes | The hosted checkout page for this invoice. Redirecting here is the fast path, but it is OPTIONAL — `address`, `amount_expected`, `decimals`, `payment_uri`, `expires_at` and `status` are everything needed to render your own checkout instead. Poll `GET /api/public/invoices/{id}` (no API key, browser-safe) for live status. | | `return_url` | string \| null | no | Where the hosted checkout sends the payer after the invoice is `paid` (a "Back to store" button plus an automatic redirect after a short, cancellable countdown). `null` when not set at create time. Your query string is preserved exactly as given. | | `cancel_url` | string \| null | no | Where the hosted checkout sends the payer when the invoice has expired or was cancelled (and a quiet "cancel and return" link while it is still open). `null` when not set. | | `return_redirect_seconds` | integer \| null | no | Seconds the paid screen waits before sending the payer to `return_url`. `0` shows the "Back to store" button only. `null` = the default (3). | | `decimals` | integer | no | Decimal places for this invoice's asset — the divisor for `amount_expected`, which is in BASE UNITS. Display amount is `amount_expected / 10 ** decimals`. Per-token on EVM (USDC 6, DAI 18), so it cannot be assumed from the chain. Returned so a custom checkout does not need a second call to `/api/v1/assets`. | | `amount_decimal` | string | no | `amount_expected` already divided by `10 ** decimals`, as a decimal STRING (never a float — see the money note at the top of this spec). Provided for display only; keep using `amount_expected` for any comparison or arithmetic. | | `payment_uri` | string \| null | no | A wallet-scannable payment URI to put in a QR code, or `null` when the chain has no safe one — in which case show the bare `address`. Non-obvious rules this saves you from re-deriving: Monero uses `tx_amount` rather than `amount`; Zcash uses ZIP-321 (`zcash:`); Solana invoices get a Solana Pay transfer request (`solana:
?amount=…`, plus `spl-token=` for tokens), on mainnet only; EVM and Tron get `null` because an EIP-681 URI encodes a chain id and, for tokens, a contract call — get it wrong and a wallet silently prefills the wrong asset on the wrong network. | | `add_fee_ontop` | boolean | no | Whether our commission was added ON TOP of the requested amount rather than taken out of it. `false` (the default) means `amount_expected` is what you asked for and you receive it minus the fee; `true` means the payer covers the fee and you receive the full `amount_net_requested`. Always present — invoices created before this existed report `false`, which is what they are. | | `amount_net_requested` | string | no | **Exact-integer base units, as a STRING.** What you asked to RECEIVE. Equal to `amount_expected` whenever `add_fee_ontop` is `false`; smaller than it when the fee was added on top. | | `fee_ontop` | string | no | **Exact-integer base units, as a STRING.** `amount_expected - amount_net_requested` — what the gross-up added to the payer's bill. Always `"0"` when `add_fee_ontop` is `false`, never `null`, so it can be displayed unconditionally. The gross-up is `net / (1 - fee_bps/10000)`, not `net * (1 + fee_bps/10000)`: the fee is charged on the GROSS, so the naive form would leave you short by `net * rate²`. | | `fiat_value` | FiatValue \| null | no | ADDITIVE. The fiat value of this invoice LOCKED at the time of the order — never today's rate. `null` on an older crypto-priced invoice created before rates were snapshotted. | | `fx_at_creation` | FxAtCreation \| null | no | ADDITIVE. On a crypto-priced invoice, the rate snapshot taken at creation in your display currency: `currency`, `rate` (fiat per WHOLE coin, exact decimal string), `decimals`, `at`. `null` on fiat-priced invoices (their price is the lock) and on older invoices. | | `partial_settlement` | PartialSettlement \| null | no | ADDITIVE. Only meaningful on a `partial_expired` invoice (part of the amount arrived before it expired); `null` on every other invoice. What arrived is forwarded to the merchant's payout address by itself once the late-payment window after expiry has passed (or when the merchant presses "Send it now"), minus the normal fee. The invoice stays `partial_expired` and `invoice.paid` is never sent for it. `sweep.sent` fires when the money leaves. | ## Settings ### GET `/api/v1/summary` **Dashboard summary** — `getSummary` An ad-hoc composite built for the merchant dashboard, not a resource. Per-asset volume and fees, a 30-day series, status counts, and an FX snapshot. Nothing here is paginated. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — The summary. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `Summary`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `merchant` | object | yes | | | `counts` | object | yes | `total` plus one key per status. The per-status keys are the SAME data as `by_status`, duplicated. | | `by_asset` | object[] | yes | | | `by_status` | object | yes | | | `series` | object[] | yes | Exactly 30 entries, oldest first, gap-filled — a day with no volume is present with an empty `assets`. | | `fx` | FxSnapshot | yes | **Advisory only.** Every rate here is a JSON floating-point NUMBER, not an exact value. Use it to render an approximate fiat figure; never to compute an amount you will settle against. The authoritative conversion happens server-side at invoice creation and is locked onto the invoice. These are the ONLY numbers left in the API that look monetary, and they stay numbers on purpose: a rate is not money. It is published as a double by the upstream feed, nothing is ever settled against it, and rounding a rate cannot lose value the way rounding an amount can. Every actual AMOUNT is a string — see "Money" in the top-level description. | | `currencies` | string[] | yes | The fiat currency codes this deployment supports. | | `fiat_locked` | object \| null | no | ADDITIVE. Paid volume in `merchant.display_currency`, each invoice counted at the fiat value LOCKED at the time of its order (not today's rate). Amounts are decimal strings. `estimated` counts invoices valued at today's rate because they predate rate snapshots or were priced in another fiat currency. `null` if it could not be computed. | ### GET `/api/v1/settings` **Read merchant settings** — `getSettings` Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — The settings. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `Settings`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `display_currency` | string | yes | ISO-4217 code used to render fiat values in the dashboard. | | `email` | string | yes | | | `fee_bps` | integer | yes | The account's default fee in basis points, as an INTEGER (not a string — it is a rate, not money). The rate charged on an individual invoice is resolved per-invoice through the key/domain/merchant/global override layers and snapshotted onto the invoice, so it may differ from this value. | | `add_fee_ontop` | boolean | yes | The ACCOUNT default for `InvoiceCreateRequest.add_fee_ontop` — whether the payer covers the commission. Invoices that do not state the flag inherit this; invoices that do state it override it. Accounts that predate the setting report `false`. | | `fee_guard` | object | no | Fee Guard (opt-in, off by default): hide a coin from your customers while its network fee is unusually high. `status` is `off`, `ok`, `learning` (still building each network's history, nothing hidden) or `no_data` (no current fee data, nothing hidden). | ### PATCH `/api/v1/settings` **Update merchant settings** — `updateSettings` Returns an ACK, not the resource — `{ok: true}` spread with the fields that were actually written. It does NOT return `email` or `fee_bps`, so it is not interchangeable with the GET. Does not accept `Idempotency-Key`. Auth: `bearerAuth` or `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `display_currency` | string | no | An ISO-4217 code from the supported set. Upper-cased before storage. | | `add_fee_ontop` | boolean | no | The account default for whether the payer covers our commission. Must be a real JSON boolean; a string is `400 bad_request`. | | `fee_guard` | object | no | Fee Guard, an opt-in switch (off by default). While it is on, a coin whose network fee is unusually high is left out of the coin lists your customers choose from, and returns by itself. `enabled` must be a real JSON boolean; anything else is `400 bad_request`. | Responses: - `200` — The ack, carrying only the fields that changed. - `400` — `bad_request` — body is not JSON, the currency is unsupported, or no updatable field was supplied. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `SettingsUpdateAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `display_currency` | string | no | Present only if it was in the request. | | `add_fee_ontop` | boolean | no | Present only if it was in the request. | | `fee_guard` | object | no | Present only if it was in the request. | ### GET `/api/v1/account` **Read what the account has unlocked, plus live account health** — `getAccount` One read-only call for plugins (WooCommerce, Magento, …) to show the merchant what their account has unlocked and how to unlock the rest, their fee position, payout readiness, held payments, webhook health and recent activity. Only the authenticated merchant's own data, nothing secret: no keys, hashes or tokens, and payout addresses only in masked form. USD amounts are decimal strings. Held-payment amounts are decimal strings in the COIN's own units. Every gate is answered by the same check the feature itself enforces, so a feature shown as unlocked is one the API will accept. Cached for about 60 seconds per API key: a change can take up to a minute to show here. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — The account overview. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `AccountOverview`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `account` | object | yes | | | `plan` | object | yes | | | `fees` | object | yes | | | `features` | object | yes | | | `payouts` | object | yes | | | `webhooks` | object | yes | | | `activity` | object | yes | | | `links` | object | yes | | | `generated_at` | string | yes | When this (possibly cached) view was built. | ### GET `/api/v1/fees/tier` **Read the account's current fee tier and month-to-date volume** — `getFeeTier` The merchant's fee position: the rate an invoice created RIGHT NOW would be quoted, the month-to-date volume that produced it, and the next tier with the distance to it. Fees fall automatically as monthly volume rises. Volume is aggregated PER MERCHANT (payment links, point-of-sale and recurring invoices all count, whether or not they carry a `callback_url`), measured in USD, and counted only when a payment actually SETTLES — a payment reversed by a chain reorganisation reduces it again. The period is a calendar month in **UTC** and resets at the first instant of the next one. Pricing is PROGRESSIVE and never retroactive: an invoice is charged at the tier the running volume had already reached when the invoice was created, that rate is snapshotted onto the invoice, and nothing re-prices it afterwards — not later volume, not a change to the ladder. Crossing a boundary therefore discounts your NEXT invoice, not the ones already issued. Band bounds are half-open, `[from_usd, to_usd)`: volume of exactly `5000.00` is in the band that STARTS at `5000.00`. `fee_bps` is the effective rate including any override that outranks the tier — `fee_source` says which layer decided it (`api_key`, `domain`, `merchant`, `volume_tier` or `global`). It is quoted for an invoice with no `callback_url`; an invoice whose callback host carries its own override can be charged differently, because that layer cannot be resolved without the URL. **White-label add-on.** `fee_bps` includes the optional white-label add-on when it is in force: `fee_bps = base_fee_bps + white_label.surcharge_bps`. The add-on is +50 basis points (0.5 percentage points) on top of the rate above, switched on by the merchant in the dashboard; it is 0 when the add-on is off, when white-label is already unlocked for free (admin grant, monthly volume or a prepaid plan — these always win), and when the deployment does not offer white-label. Like the rest of the rate it is snapshotted onto each invoice at creation, so switching the add-on never re-prices an invoice that already exists. Forwarding addresses are not surcharged. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — The account's fee position. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `FeeTier`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `period` | string | yes | The current accounting month, `YYYY-MM` in **UTC**. | | `volume_usd` | string | yes | Month-to-date SETTLED volume in USD, as a decimal string. Only confirmed payments count; pending, expired and cancelled invoices never do, and a payment reversed by a chain reorganisation is subtracted again. Each payment is valued in USD at the rate in force when it settled and is never revalued afterwards, so this figure does not move when exchange rates do. | | `fee_bps` | integer | yes | The effective rate, in basis points, for an invoice created now with no `callback_url`, INCLUDING the white-label add-on when it is in force (`base_fee_bps` + `white_label.surcharge_bps`). Invoices already issued keep the rate snapshotted on them at creation. | | `base_fee_bps` | integer | yes | The rate before the white-label add-on, in basis points. Volume-tier discounts apply here. | | `white_label` | WhiteLabelFee | yes | White-label access and the add-on's effect on the fee. Free routes (`admin`, `tier`, `plan`) always win over the paid add-on, so `surcharge_bps` is 0 whenever one applies. | | `fee_source` | `api_key` \| `domain` \| `merchant` \| `volume_tier` \| `global` | yes | Which layer decided `fee_bps`. Precedence is API key > domain > merchant > volume tier > global default: an explicitly negotiated rate always wins over the automatic ladder, in both directions. | | `tiers_enabled` | boolean | yes | Whether automatic volume tiers are switched on for this deployment. | | `current_tier` | FeeTierBand \| null | yes | The band the current volume falls in, or `null` when an override outranks the ladder or tiers are off. | | `next_tier` | FeeTierBand & object \| null | yes | The band above the current one and how much more volume reaches it. `null` on the top band. | | `tiers` | FeeTierBand[] | yes | The whole published ladder, lowest band first. | ## API keys ### GET `/api/v1/keys` **List API keys** — `listApiKeys` Prefixes only — the secret is never stored, so it can never be listed. Revoked keys are included, flagged by `revoked`. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | Responses: - `200` — One page of API keys, newest first. - `400` — `bad_request` — `limit` is not an integer in 1..200, or `cursor` is not a valid pagination cursor. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | ApiKey[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### POST `/api/v1/keys` **Issue an API key** — `createApiKey` The raw secret is returned ONCE, here only, and is never persisted anywhere. `id` is the key's real identifier — the one `POST /api/v1/keys/{id}/revoke` matches on. `prefix` and the legacy `api_key_prefix` both carry the prefix. **`Idempotency-Key` replay returns `api_key: null`.** The replay is still 201 with the same `id` and `prefix`, and `message` explains it, but the secret is deliberately not stored for 24 hours in order to be replayed. The bug this header fixes — a retry minting a SECOND live credential — is fixed regardless. A malformed or absent JSON body is tolerated: `label` simply defaults. **Dashboard session only — an API key cannot create keys** (`401 unauthorized`). A leaked key that could mint a spare would outlive its own revocation. When two-factor is on, a second factor is required (`401 totp_required` / `totp_invalid`, `429 totp_locked`): a current authenticator code in `totp` (or `telegram_code` / `recovery_code`). A good code also grants THIS session a 10-minute step-up, so the next sensitive action within that window does not ask again; each code still works only once. A session opened by signup whose email is unverified gets `403 email_unverified`. Auth: `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `label` | string | no | A human label. Defaults to `default`. | | `scope` | `api` \| `mcp` | no | `api` (default) or `mcp`: a key for an AI assistant, accepted only at `/api/mcp` and read-only until the merchant switches writing on. Any other value is `400 bad_request`. | | `totp` | string | no | A current six-digit authenticator code. Required only when two-factor is on; each code works once. | Responses: - `201` — The new key. Store `api_key` now. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `201` body — `ApiKeyCreated`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `scope` | `api` \| `mcp` | yes | | | `mcp_write` | boolean | yes | Always `false` on creation; writing is switched on separately, in the dashboard. | | `id` | string | yes | The key's real identifier — the one that revokes it. | | `api_key` | string \| null | yes | The raw `rcv_live_…` secret. Shown exactly once, here. **`null` on an `Idempotency-Key` replay**, because the secret is deliberately never persisted, not even for the 24-hour replay window. A replay still carries the same `id` and `prefix`, so the client can still identify and revoke what it created. | | `api_key_prefix` | string | yes | Legacy name for `prefix`. Both are emitted. | | `prefix` | string | yes | | | `label` | string \| null | yes | | | `created_at` | string \| null | yes | | | `message` | string | yes | Human note. Different text on a replay — informational only, do not branch on it. | ### POST `/api/v1/keys/{id}/revoke` **Revoke an API key** — `revokeApiKey` Returns an ACK, not the resource. Revoking an already-revoked or unknown key is `409 not_allowed`. Any dashboard session that was opened by signing in with this key is ended too. **Dashboard session only — an API key cannot revoke keys.** When two-factor is on, send a fresh authenticator code as `{"totp": "123456"}`. Auth: `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The `id` from `GET /api/v1/keys` or `POST /api/v1/keys` — NOT the prefix. | Responses: - `200` — The key was revoked. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `not_allowed` — no such active key belongs to the caller. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `RevokedAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `revoked` | string | yes | | ## Payment links ### GET `/api/v1/payment-links` **List payment links** — `listPaymentLinks` Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | | `active` | query | no | `true` also matches links created before the `active` field existed (an absent key means active). Any value other than `true`/`false` is a `400 bad_request`. | Responses: - `200` — One page of payment links, newest first. - `400` — `bad_request` — a bad `limit`/`cursor`, or `active` is neither `true` nor `false`. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | PaymentLink[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### POST `/api/v1/payment-links` **Create a payment link** — `createPaymentLink` Returns the FULL `PaymentLink` resource — the same object list, retrieve, update and deactivate return. It used to return only `{id, url, open_amount, active}`, which made one resource two types in an SDK and forced a follow-up GET to see `title`, `uses` or `created_at`. Amount in is BTC-denominated (`amount_btc`); amount out on the resource is satoshis (`amount_sats`). Omit `amount_btc` for an open-amount link the payer prices themselves. Send `callback_url` to have every invoice this link mints carry it — the invoice then delivers callbacks there, and the link's revenue becomes visible per domain instead of landing in the `unattributed` bucket. It is set at creation only; `PATCH` does not change it, because it is also the attribution snapshot for invoices already minted. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `title` | string | no | Truncated to 120 characters. An empty result is stored as null. | | `amount_btc` | string | no | A decimal BTC amount. Omit, or send an empty string, for an open-amount link. Prefer `amount_fiat` for new integrations: a BTC-priced link is converted at the moment of payment, so what the merchant receives drifts with the BTC rate. Mutually exclusive with `amount_fiat` — sending both is `400 bad_request`. | | `amount_fiat` | string | no | A decimal amount in `currency`, e.g. `"20.00"`. The link is priced in fiat and converted to whichever coin the payer chooses, at the rate in force when they pay; that conversion is locked onto the resulting invoice. Mutually exclusive with `amount_btc`. Omit both for an open-amount link. | | `currency` | string | no | ISO-4217 code for `amount_fiat`. Defaults to `USD`. An unsupported code is `400 bad_request`. | | `callback_url` | string | no | Optional. Where invoices minted from this link send their callbacks. Must parse as a URL, and must be `https` in production. Omit, or send an empty string, for a link whose invoices have no callback (the previous behaviour). | | `pricing` | `fiat` \| `crypto` \| `open` | no | Optional, inferred from the amount fields. When sent it must agree with them. | | `amount_crypto` | string | no | A FIXED coin amount (decimal string) in `asset` — the payer pays exactly this, in that coin, on one of the link's networks. Needs `asset` (+ `chain` for a multi-chain token) or `pairs` of that one coin. At most as many decimal places as the coin has on every listed network. Mutually exclusive with `amount_fiat` / `amount_btc`. | | `asset` | string | no | With `chain`: shorthand for a one-entry `pairs`. | | `chain` | string | no | The network for `asset` — required when the coin settles on several. | | `pairs` | object[] | no | Optional. The (asset, chain) pairs the payer may choose from (see `AssetPair`); `chain` is REQUIRED in each entry for a multi-chain token. Each must be enabled and have an active payout address (`409 payout_address_missing` otherwise). Omit for any payable coin (the previous behaviour). | | `amount_min` | string | no | Open-amount link with `currency`: the smallest amount (decimal string, currency precision) the customer may enter. | | `amount_max` | string | no | Open-amount link with `currency`: the largest amount the customer may enter (at most 1,000,000,000). | Responses: - `201` — The created link — the full `PaymentLink` resource. - `400` — `bad_request` — body is not JSON, `amount_btc` is unparseable or not positive, or `callback_url` is not a valid URL (and, in production, not https — plain http is accepted only for a .onion address, delivered over Tor). - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `201` body — `PaymentLink`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | 8 base64url characters. | | `title` | string \| null | yes | | | `amount_sats` | string | yes | Exact-integer base units as a string, for a fixed-amount link; `null` for an open-amount one. Note the asymmetry: you SET the amount with `amount_btc` (a decimal BTC string) and READ it as `amount_sats`. | | `amount_fiat` | string \| null | yes | **A decimal string** (e.g. `"20.00"`), for a link priced in fiat; `null` otherwise. Set with `amount_fiat` (+`currency`) at creation. A fiat-priced link is converted to the payer's chosen coin at the rate in force WHEN THEY PAY, and that conversion is locked onto the resulting invoice — so the merchant's price stays the fiat figure rather than a BTC quantity that drifts. Mutually exclusive with `amount_btc`/`amount_sats`. A link created before this field existed reads as `null`. | | `fiat_currency` | string \| null | yes | ISO-4217 code for `amount_fiat`, or `null`. | | `open_amount` | boolean | yes | True when the payer chooses the amount — i.e. none of `amount_sats`, `amount_fiat` or `amount_crypto` is set. | | `pricing` | `fiat` \| `crypto` \| `btc_value` \| `open` | no | Additive. How the link is priced; `btc_value` is a legacy `amount_btc` link. | | `amount_crypto` | string \| null | no | Additive. The fixed coin amount of a crypto-priced link (decimal string), else `null`. | | `crypto_asset` | string \| null | no | Additive. The coin `amount_crypto` is in. | | `amount_min` | string \| null | no | Additive. Lower bound of a customer-entered amount, in `fiat_currency`. | | `amount_max` | string \| null | no | Additive. Upper bound of a customer-entered amount, in `fiat_currency`. | | `pairs` | array \| null | no | Additive. The (asset, chain) pairs the payer may choose from; `null` = any payable coin. | | `active` | boolean | yes | A link created before this field existed has no stored value and reads as `true`. | | `uses` | integer | yes | How many invoices have been minted from this link. | | `callback_url` | string \| null | yes | Where invoices minted from this link send their callbacks, or `null`. Set at creation only. A link created before this field existed reads as `null`, which is also what a link created without one reads as — in both cases its invoices have no callback. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | | `url` | string | yes | | ### GET `/api/v1/payment-links/{id}` **Retrieve a payment link** — `getPaymentLink` The merchant-side read. Unlike `GET /api/public/links/{id}` it shows deactivated links too. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The payment-link id — 8 base64url characters, not a UUID. | Responses: - `200` — The payment link. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PaymentLink`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | 8 base64url characters. | | `title` | string \| null | yes | | | `amount_sats` | string | yes | Exact-integer base units as a string, for a fixed-amount link; `null` for an open-amount one. Note the asymmetry: you SET the amount with `amount_btc` (a decimal BTC string) and READ it as `amount_sats`. | | `amount_fiat` | string \| null | yes | **A decimal string** (e.g. `"20.00"`), for a link priced in fiat; `null` otherwise. Set with `amount_fiat` (+`currency`) at creation. A fiat-priced link is converted to the payer's chosen coin at the rate in force WHEN THEY PAY, and that conversion is locked onto the resulting invoice — so the merchant's price stays the fiat figure rather than a BTC quantity that drifts. Mutually exclusive with `amount_btc`/`amount_sats`. A link created before this field existed reads as `null`. | | `fiat_currency` | string \| null | yes | ISO-4217 code for `amount_fiat`, or `null`. | | `open_amount` | boolean | yes | True when the payer chooses the amount — i.e. none of `amount_sats`, `amount_fiat` or `amount_crypto` is set. | | `pricing` | `fiat` \| `crypto` \| `btc_value` \| `open` | no | Additive. How the link is priced; `btc_value` is a legacy `amount_btc` link. | | `amount_crypto` | string \| null | no | Additive. The fixed coin amount of a crypto-priced link (decimal string), else `null`. | | `crypto_asset` | string \| null | no | Additive. The coin `amount_crypto` is in. | | `amount_min` | string \| null | no | Additive. Lower bound of a customer-entered amount, in `fiat_currency`. | | `amount_max` | string \| null | no | Additive. Upper bound of a customer-entered amount, in `fiat_currency`. | | `pairs` | array \| null | no | Additive. The (asset, chain) pairs the payer may choose from; `null` = any payable coin. | | `active` | boolean | yes | A link created before this field existed has no stored value and reads as `true`. | | `uses` | integer | yes | How many invoices have been minted from this link. | | `callback_url` | string \| null | yes | Where invoices minted from this link send their callbacks, or `null`. Set at creation only. A link created before this field existed reads as `null`, which is also what a link created without one reads as — in both cases its invoices have no callback. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | | `url` | string | yes | | ### PATCH `/api/v1/payment-links/{id}` **Update a payment link** — `updatePaymentLink` Mutable: `active`, `title`, and the amount. Sending `amount_btc: null` (or an empty string) converts a fixed link into an open-amount one. Setting `active: false` stops `POST /api/public/links/{id}` minting further invoices. Invoices ALREADY created from the link are untouched and remain payable — deactivating a link is not a way to cancel money in flight. Does not accept `Idempotency-Key`. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The payment-link id — 8 base64url characters, not a UUID. | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `active` | boolean | no | Must be a real boolean — a string is a `400 bad_request`. | | `title` | string \| null | no | | | `amount_btc` | string \| null | no | Decimal BTC. `null` or an empty string makes the link open-amount. | Responses: - `200` — The updated link. - `400` — `bad_request` — body is not a JSON object, `active` is not a boolean, `amount_btc` is unparseable or not positive, or no mutable field was supplied. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PaymentLink`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | 8 base64url characters. | | `title` | string \| null | yes | | | `amount_sats` | string | yes | Exact-integer base units as a string, for a fixed-amount link; `null` for an open-amount one. Note the asymmetry: you SET the amount with `amount_btc` (a decimal BTC string) and READ it as `amount_sats`. | | `amount_fiat` | string \| null | yes | **A decimal string** (e.g. `"20.00"`), for a link priced in fiat; `null` otherwise. Set with `amount_fiat` (+`currency`) at creation. A fiat-priced link is converted to the payer's chosen coin at the rate in force WHEN THEY PAY, and that conversion is locked onto the resulting invoice — so the merchant's price stays the fiat figure rather than a BTC quantity that drifts. Mutually exclusive with `amount_btc`/`amount_sats`. A link created before this field existed reads as `null`. | | `fiat_currency` | string \| null | yes | ISO-4217 code for `amount_fiat`, or `null`. | | `open_amount` | boolean | yes | True when the payer chooses the amount — i.e. none of `amount_sats`, `amount_fiat` or `amount_crypto` is set. | | `pricing` | `fiat` \| `crypto` \| `btc_value` \| `open` | no | Additive. How the link is priced; `btc_value` is a legacy `amount_btc` link. | | `amount_crypto` | string \| null | no | Additive. The fixed coin amount of a crypto-priced link (decimal string), else `null`. | | `crypto_asset` | string \| null | no | Additive. The coin `amount_crypto` is in. | | `amount_min` | string \| null | no | Additive. Lower bound of a customer-entered amount, in `fiat_currency`. | | `amount_max` | string \| null | no | Additive. Upper bound of a customer-entered amount, in `fiat_currency`. | | `pairs` | array \| null | no | Additive. The (asset, chain) pairs the payer may choose from; `null` = any payable coin. | | `active` | boolean | yes | A link created before this field existed has no stored value and reads as `true`. | | `uses` | integer | yes | How many invoices have been minted from this link. | | `callback_url` | string \| null | yes | Where invoices minted from this link send their callbacks, or `null`. Set at creation only. A link created before this field existed reads as `null`, which is also what a link created without one reads as — in both cases its invoices have no callback. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | | `url` | string | yes | | ### DELETE `/api/v1/payment-links/{id}` **Deactivate a payment link** — `deactivatePaymentLink` Soft deactivate (`active: false`). The row is kept because the link id appears in `metadata.payment_link` on every invoice it ever created. Idempotent — deactivating an already-inactive link returns it unchanged. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The payment-link id — 8 base64url characters, not a UUID. | Responses: - `200` — The link, now inactive. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PaymentLink`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | 8 base64url characters. | | `title` | string \| null | yes | | | `amount_sats` | string | yes | Exact-integer base units as a string, for a fixed-amount link; `null` for an open-amount one. Note the asymmetry: you SET the amount with `amount_btc` (a decimal BTC string) and READ it as `amount_sats`. | | `amount_fiat` | string \| null | yes | **A decimal string** (e.g. `"20.00"`), for a link priced in fiat; `null` otherwise. Set with `amount_fiat` (+`currency`) at creation. A fiat-priced link is converted to the payer's chosen coin at the rate in force WHEN THEY PAY, and that conversion is locked onto the resulting invoice — so the merchant's price stays the fiat figure rather than a BTC quantity that drifts. Mutually exclusive with `amount_btc`/`amount_sats`. A link created before this field existed reads as `null`. | | `fiat_currency` | string \| null | yes | ISO-4217 code for `amount_fiat`, or `null`. | | `open_amount` | boolean | yes | True when the payer chooses the amount — i.e. none of `amount_sats`, `amount_fiat` or `amount_crypto` is set. | | `pricing` | `fiat` \| `crypto` \| `btc_value` \| `open` | no | Additive. How the link is priced; `btc_value` is a legacy `amount_btc` link. | | `amount_crypto` | string \| null | no | Additive. The fixed coin amount of a crypto-priced link (decimal string), else `null`. | | `crypto_asset` | string \| null | no | Additive. The coin `amount_crypto` is in. | | `amount_min` | string \| null | no | Additive. Lower bound of a customer-entered amount, in `fiat_currency`. | | `amount_max` | string \| null | no | Additive. Upper bound of a customer-entered amount, in `fiat_currency`. | | `pairs` | array \| null | no | Additive. The (asset, chain) pairs the payer may choose from; `null` = any payable coin. | | `active` | boolean | yes | A link created before this field existed has no stored value and reads as `true`. | | `uses` | integer | yes | How many invoices have been minted from this link. | | `callback_url` | string \| null | yes | Where invoices minted from this link send their callbacks, or `null`. Set at creation only. A link created before this field existed reads as `null`, which is also what a link created without one reads as — in both cases its invoices have no callback. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | | `url` | string | yes | | ## Recurring ### GET `/api/v1/recurring` **List recurring schedules** — `listRecurring` Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | Responses: - `200` — One page of schedules, newest first. - `400` — `bad_request` — `limit` is not an integer in 1..200, or `cursor` is not a valid pagination cursor. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | RecurringSchedule[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### POST `/api/v1/recurring` **Create a recurring schedule** — `createRecurring` Crypto has no pull mechanism, so this is scheduled billing, not auto-debit: each cycle GENERATES a fresh invoice and fires the merchant's webhook. The first invoice is generated on the next worker tick, because `next_run` is set to now. Send `callback_url` to have every invoice this schedule generates carry it — the invoice then delivers callbacks there, and the schedule's revenue becomes visible per domain instead of landing in the `unattributed` bucket. It is set at creation only. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | Request body — `RecurringCreateRequest`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `title` | string | no | | | `asset` | string | no | | | `amount_fiat` | number \| string | no | | | `currency` | string | no | | | `amount` | string | no | A decimal amount in the coin. | | `interval_days` | integer | yes | Floored to an integer and clamped to at least 1. A non-numeric value fails validation. | | `callback_url` | string | no | Optional. Copied onto every invoice this schedule generates. Must parse as a URL, and must be `https` in production — validated exactly like `POST /api/v1/invoices` and `POST /api/v1/payment-links`. Omit, or send an empty string, for a schedule whose invoices have no callback. | | `customer_email` | string | no | Optional. Your customer's email, for renewal reminders with a pay link. A malformed address is a `400 bad_request`. | | `customer_name` | string | no | Optional. Used to greet the customer in reminders. Longer names are cut to 80 characters. | | `reminders` | `pre3` \| `pre1` \| `due` \| `over1` \| `over3`[] | no | Optional. Which renewal reminders to send (default `["pre3","due","over1"]`). Sent only when customer emails are available on your plan. | Responses: - `201` — The schedule. - `400` — `bad_request` — body is not JSON, the asset is not enabled, `interval_days` is not a positive integer, neither `amount_fiat` nor `amount` was supplied, or `callback_url` is not a valid URL (and, in production, not https — plain http is accepted only for a .onion address, delivered over Tor). `asset_unavailable` — the asset is enabled but its settlement backend cannot take it. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `201` body — `RecurringSchedule`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `title` | string \| null | yes | | | `asset` | string | yes | | | `amount_fiat` | string \| null | yes | A DECIMAL string (e.g. `"25.00"`), exactly like `Invoice.amount_fiat`. Null when the schedule is priced in the coin. | | `currency` | string \| null | yes | ISO-4217 for `amount_fiat`. Null when the schedule is priced in the coin. | | `amount` | string \| null | yes | A DECIMAL amount in the coin — not base units — stored verbatim as a string. Null when the schedule is priced in fiat. | | `interval_days` | integer | yes | | | `active` | boolean | yes | | | `runs` | integer | yes | How many invoices this schedule has generated. | | `next_run` | string | yes | Set to the creation instant, so the first invoice is generated on the next worker tick. | | `last_invoice_id` | string \| null | yes | | | `callback_url` | string \| null | yes | Where every invoice this schedule generates sends its callbacks, or `null`. Set at creation only. A schedule created before this field existed reads as `null`, which is also what a schedule created without one reads as — in both cases its invoices have no callback. | | `created_at` | string | yes | | ### POST `/api/v1/recurring/{id}/cancel` **Cancel a recurring schedule** — `cancelRecurring` Returns an ACK, not the resource. Cancelling an already-cancelled schedule is `409 not_allowed`. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | | Responses: - `200` — The schedule was cancelled. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `not_allowed` — no such ACTIVE schedule belongs to the caller. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `CancelledAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `cancelled` | string | yes | The id that was cancelled — echoed from the path, not re-read from the database. | ## Webhooks ### GET `/api/v1/webhooks/endpoints` **List webhook endpoints** — `listWebhookEndpoints` Account-level endpoints receive every INVOICE event, in addition to an invoice's own `callback_url`. They deliberately do NOT receive `forward.*` events — those go only to the forward's own `callback_url`. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | Responses: - `200` — One page of endpoints, newest first. - `400` — `bad_request` — `limit` is not an integer in 1..200, or `cursor` is not a valid pagination cursor. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | WebhookEndpoint[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### POST `/api/v1/webhooks/endpoints` **Register a webhook endpoint** — `createWebhookEndpoint` Maximum 20 endpoints per account. The URL is normalised through the WHATWG URL parser, so what comes back may differ from what you sent (a trailing slash is added to a bare origin). **Dashboard sessions** follow the account's two-factor step-up policy ('webhooks'): `401 totp_required` unless the session holds a step-up grant or the body carries `totp` / `telegram_code` / `recovery_code`. API-key callers are unaffected. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `url` | string | yes | Must be https in production, or http to a .onion address (delivered over Tor). | Responses: - `201` — The registered endpoint. - `400` — `bad_request` — body is not JSON, or `url` is not a valid URL (and, in production, not https). `limit_exceeded` — the account already has 20 endpoints. Note this quota failure is a **400**, not a 409. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `201` body — `WebhookEndpoint`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `url` | string | yes | Normalised through the WHATWG URL parser, so it may differ from what you sent. | | `active` | boolean | yes | Inactive endpoints receive nothing. An endpoint stored before this field existed reads as `true`. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | ### PATCH `/api/v1/webhooks/endpoints/{id}` **Update a webhook endpoint** — `updateWebhookEndpoint` Mutable: `active` and `url`. `active: false` is the pause switch that the delivery filter (`active: {$ne: false}`) was always written for and that nothing could previously write. Returns the updated resource. Does not accept `Idempotency-Key`. Changing `url` from a dashboard session follows the account's two-factor step-up policy ('webhooks'): `401 totp_required` unless the session holds a step-up grant or the body carries `totp` / `telegram_code` / `recovery_code`. API-key callers are unaffected. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `active` | boolean | no | | | `url` | string | no | | Responses: - `200` — The updated endpoint. - `400` — `bad_request` — body is not a JSON object, `active` is not a boolean, `url` is invalid or not https in production, or no mutable field was supplied. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `WebhookEndpoint`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `url` | string | yes | Normalised through the WHATWG URL parser, so it may differ from what you sent. | | `active` | boolean | yes | Inactive endpoints receive nothing. An endpoint stored before this field existed reads as `true`. | | `created_at` | string | yes | | | `updated_at` | string \| null | yes | | ### DELETE `/api/v1/webhooks/endpoints/{id}` **Delete a webhook endpoint** — `deleteWebhookEndpoint` A HARD delete — the row is removed. Not idempotent: a second call is `404 not_found`. Prefer `PATCH {"active": false}` if you may want it back. Returns an ACK, not the resource. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | | Responses: - `200` — The endpoint was deleted. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `DeletedAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `deleted` | string | yes | | ### GET `/api/v1/webhooks/deliveries` **List webhook deliveries** — `listWebhookDeliveries` The delivery log for BOTH families. Every row carries BOTH `invoice_id` and `forward_id`, each nullable: an `invoice.*` / `sweep.sent` row fills the first, a `forward.*` row the second. A forward delivery used to come back with `invoice_id` absent and nothing naming the forward, so a failed forward callback was unattributable from this log alone. `?event=` and `?status=` narrow it. Both are validated against their registries, so a typo is a `400 bad_request` rather than a silently empty page. The delivered body itself is not returned here. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `limit` | query | no | Page size. An integer from 1 to 200; anything larger is silently clamped to 200. A non-integer, a zero or a negative value is a `400 bad_request`, never a silent fallback. An absent or empty value means the default. | | `cursor` | query | no | An opaque keyset cursor from a previous response's `next_cursor`. Base64url over `(created_at, _id)` descending, so a row inserted while you are paging can never shift a later page or hide a row. A malformed cursor is a `400 bad_request`, never a silent reset to page one — that would loop an auto-paginator forever. Treat the value as opaque: its encoding is part of the frozen contract only in the sense that it round-trips. | | `event` | query | no | Return only deliveries of this event. Must be a member of `EventName`; anything else is a `400 bad_request`. | | `status` | query | no | Return only deliveries in this delivery state. Anything else is a `400 bad_request`. | Responses: - `200` — One page of deliveries, newest first. - `400` — `bad_request` — a bad `limit`/`cursor`, an unknown `event`, or a `status` that is not `pending`/`delivered`/`failed`. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `data` | WebhookDelivery[] | yes | | | `has_more` | boolean | yes | A fact, not a guess: the query reads `limit + 1` rows. Never infer it from `data.length === limit`. | | `next_cursor` | string \| null | yes | Pass back as `?cursor=` to fetch the next page. `null` exactly when `has_more` is false. | ### POST `/api/v1/webhooks/deliveries/{id}/replay` **Re-queue a webhook delivery** — `replayWebhookDelivery` Resets the row to `pending` with `attempts: 0` so the worker sends it again. **The body is FROZEN.** The payload was built once at enqueue time and stored on the row; a replay re-sends that exact body, with the same `sequence` and the same `created_at`. It does NOT reflect current state — poll `GET /api/v1/invoices/{id}` or `GET /api/v1/address/{id}` for that. Returns an ACK, not the resource. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The `id` from `GET /api/v1/webhooks/deliveries` — a 24-character hex Mongo ObjectId, unlike every other id in this API. | Responses: - `200` — The delivery was re-queued. - `400` — `bad_request` — the id is not a valid ObjectId. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `ReplayedAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `replayed` | string | yes | | ### GET `/api/v1/webhooks/secret` **Read webhook-secret rotation state** — `getWebhookSecretState` Rotation METADATA only — the signing secret itself is never returned here, or by anything other than the rotate call that mints it. If you have lost it, rotate; there is no read-back path by design. The one thing a running integration needs from this endpoint is whether a previous secret is still acceptable and until when, so that is exactly what it answers. Auth: `bearerAuth` or `sessionCookie` Responses: - `200` — The account's rotation state. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `WebhookSecretState`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `rotated_at` | string \| null | yes | When the secret was last rotated. `null` on an account still using the secret it was issued at signup. | | `prev_expires_at` | string \| null | yes | When the previous secret stops being acceptable. `null` when there is no previous secret, and also once the grace window has passed — this field is the live answer to "should my receiver still be trying the old one?", not a historical record. | | `prev_active` | boolean | yes | True while a previous secret is still inside its grace window. When true, your receiver must accept EITHER secret. | ### POST `/api/v1/webhooks/secret/rotate` **Rotate the webhook signing secret** — `rotateWebhookSecret` Mints a new signing secret, moves the current one to the previous slot with a grace window (24 hours by default — `grace_seconds` states it), and returns the new secret **once**. **We keep signing with the CURRENT secret only.** The grace window is an instruction to YOUR receiver, not a change in our behaviour: until `prev_expires_at`, verify each delivery against the new secret and fall back to the previous one. This is why every official SDK's `verifyWebhook` accepts a LIST of secrets rather than a single one — during a rotation there are legitimately two. **Dashboard sessions** follow the account's two-factor step-up policy ('webhooks'): `401 totp_required` unless the session holds a step-up grant or the body carries `totp` / `telegram_code` / `recovery_code`. API-key callers are unaffected. A second rotation inside the window REPLACES the previous secret rather than chaining, so at most two secrets are ever valid and a receiver's fallback list is bounded at two. When that happens `replaced_previous` is `true`: a secret that was still inside its grace window has just been retired early, and any receiver still on it will start failing. Shown-once discipline matches `POST /api/v1/keys`: the secret is not stored in the idempotency record, so an `Idempotency-Key` replay returns the same `200` with the same `rotated_at` and `prev_expires_at` but **`secret: null`**. The bug the header exists to fix — a retry rotating TWICE and retiring the secret the first response handed back before it was ever deployed — is fixed regardless. Auth: `bearerAuth` or `sessionCookie` Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `Idempotency-Key` | header | no | A client-generated unique string, scoped to `(merchant, endpoint, key)` and retained for 24 hours. A replay returns the ORIGINAL body AND the ORIGINAL status code, plus `Idempotent-Replay: true`. Values longer than 255 characters are truncated to 255 rather than rejected, so two keys sharing a 255-character prefix collide. The record is written AFTER the resource exists, so a client retrying after a timeout — the case that burns HD indexes and mints duplicate credentials — is fully covered, but two genuinely simultaneous in-flight requests with the same key can still both create. | Responses: - `200` — The new secret. Store it now — it is shown only once. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `WebhookSecretRotated`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `secret` | string \| null | yes | The raw `whsec_…` signing secret. **`null` on an `Idempotency-Key` replay** — the same discipline as `ApiKeyCreated.api_key`. The replay still carries the same `rotated_at` and `prev_expires_at`, so a client that timed out can still tell what happened; if the secret itself was lost, rotate again. | | `rotated_at` | string | yes | | | `prev_expires_at` | string \| null | yes | Until this instant, verify incoming webhooks against the NEW secret and fall back to the previous one. `null` only when there was no previous secret to keep valid. | | `grace_seconds` | integer | yes | The length of the grace window, in seconds. 86400 (24h) by default. | | `replaced_previous` | boolean | yes | True when this rotation retired a previous secret that was STILL inside its grace window (i.e. you rotated twice in quick succession). At most two secrets are ever valid at once, so any receiver still on that older secret starts failing now. | | `message` | string | yes | Human note. Different text on a replay — informational only, do not branch on it. | ### POST `/api/v1/webhooks/test` **Send a signed test webhook** — `sendTestWebhook` Delivers a signed `test` event to the merchant's OWN registered, active endpoints so they can confirm their receiver verifies the signature and answers 2xx. SSRF-safe by construction: the only reachable URLs are ones already registered on the account. Naming a URL that is not one of them is `400 no_target`, never a fetch. The sample body is invoice-shaped — a forwarding-only merchant tests against a `data` shape they will never actually receive — and its `created_at` is the Unix epoch (`1970-01-01T00:00:00.000Z`) rather than the send time. `results[].ok` is the receiver's own outcome: this endpoint returns 200 even when every delivery failed. Check `delivered` against `total`. Auth: `bearerAuth` or `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `url` | string | no | Target exactly one registered active endpoint. Omit (or send no body at all) to hit every one. | Responses: - `200` — Per-target delivery outcomes. - `400` — `no_target` — the account has no registered active endpoint, or the named URL is not one of them. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `WebhookTestResult`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `event` | `test` | yes | | | `delivered` | integer | yes | How many targets answered 2xx. | | `total` | integer | yes | | | `results` | object[] | yes | | ## Two-factor ### POST `/api/v1/2fa/setup` **Begin TOTP enrolment** — `setupTwoFactor` Generates a secret, stores it un-enabled, and returns the `otpauth://` URI for a QR code. Call `/api/v1/2fa/enable` with a valid code to actually turn it on. Calling this again before enabling issues a NEW secret and discards the previous one. A dashboard flow. Most SDKs should not model it. Auth: `sessionCookie` Responses: - `200` — The enrolment secret. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `409` — `already_enabled` — two-factor is already on. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `TwoFactorSetup`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `secret` | string | yes | Base32 TOTP secret. Store it nowhere except the authenticator. | | `otpauth_uri` | string | yes | `otpauth://totp/…` — encode as a QR code. SHA-1, 6 digits, 30-second period. | ### POST `/api/v1/2fa/enable` **Finish TOTP enrolment** — `enableTwoFactor` Auth: `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `code` | string | yes | The current six-digit authenticator code. ±1 time step of drift is tolerated. | | `telegram_code` | string | no | Only when the account already has Telegram codes on (adding a second method is a 2FA change). | | `recovery_code` | string | no | Alternative to `telegram_code` in that case. | Responses: - `200` — Two-factor is now on. - `400` — `no_setup` — `/api/v1/2fa/setup` has not been called. `bad_request` — body is not JSON. `invalid_code` — the code does not verify. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `TwoFactorState`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `totp_enabled` | boolean | yes | | | `other_sessions_ended` | integer | no | How many OTHER dashboard sessions were signed out by the change. | | `recovery_codes` | string[] | no | Enable only, and only when the account had no unused recovery codes: ten one-time codes (`XXXX-XXXX-XXXX-XXXX`) returned HERE ONLY and stored as hashes. Each can stand in for an authenticator code once (`recovery_code`). | ### POST `/api/v1/2fa/disable` **Turn TOTP off** — `disableTwoFactor` Requires a FRESH second factor in the body — a current authenticator code (`code`), or, when the phone is lost, a one-time `recovery_code` (or a `telegram_code` when Telegram codes are on). A step-up grant alone is never enough, so a hijacked session cannot silently remove the second factor. The stored secret is cleared; every other session is signed out. Auth: `sessionCookie` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `code` | string | no | A current authenticator code. | | `recovery_code` | string | no | One of the account's recovery codes (spent on use). | | `telegram_code` | string | no | A code sent to the linked Telegram chat via the dashboard. | Responses: - `200` — Two-factor is now off. - `400` — `not_enabled` — two-factor is not on. `bad_request` — body is not JSON. `invalid_code` — the code does not verify. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `TwoFactorState`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `totp_enabled` | boolean | yes | | | `other_sessions_ended` | integer | no | How many OTHER dashboard sessions were signed out by the change. | | `recovery_codes` | string[] | no | Enable only, and only when the account had no unused recovery codes: ten one-time codes (`XXXX-XXXX-XXXX-XXXX`) returned HERE ONLY and stored as hashes. Each can stand in for an authenticator code once (`recovery_code`). | ## Public ### GET `/api/public/invoices/{id}` **Read an invoice from the checkout page** — `getPublicInvoice` Unauthenticated, for the hosted checkout page and for a merchant's own ON-SITE checkout. A deliberately minimal projection: no `reference`, no `metadata`, no merchant, no customer email. Anyone holding the invoice id can read it. Server-side SDKs should use `GET /api/v1/invoices/{id}`. **Browser-safe:** answers with `Access-Control-Allow-Origin: *` (no credentials), so a shop's checkout page can poll it from its own origin. A plain GET is a CORS simple request — no preflight. Rate-limited per IP (120 requests/minute); poll every 4–5 seconds and honour `Retry-After` on a 429. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The invoice id. Validated as a UUID before any database read. | Responses: - `200` — The public invoice view. - `400` — `bad_request` — the id is not a UUID. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PublicInvoice`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `status` | InvoiceStatus | yes | The invoice lifecycle, mirrored by the strict Mongo validator. Treat it as an OPEN enum and keep a default branch: a new value is an additive change. `pending` is the creation state. `confirming` means seen on-chain but not yet final; `partial` means less than expected arrived; `swept` means the funds left the deposit address for the payout wallet; `partial_expired` means the window closed on an under-payment. | | `address` | string | yes | | | `amount_expected` | string | yes | Exact-integer base units as a string. | | `amount_received` | string | yes | Exact-integer base units as a string. | | `expires_at` | string | yes | | | `asset` | string | no | Lower-cased asset symbol. | | `chain` | string \| null | no | The EVM chain, or `solana` / `tron`; `null` for UTXO coins. | | `decimals` | integer | no | Divisor exponent for `amount_expected`. | | `amount_decimal` | string | no | `amount_expected` divided by `10 ** decimals`, as a decimal string. Display only. | | `payment_uri` | string \| null | no | A wallet URI for a QR code or deep link, or `null` (show the bare `address`). Always `null` on account-model chains with no safe URI standard (EVM, Tron). | | `solana_pay_uri` | string \| null | no | The Solana Pay transfer request (`solana:
?amount=…[&spl-token=]`) for a Solana invoice on mainnet, else `null`. Same value as `payment_uri` on Solana; provided separately so a store need not sniff the scheme. | | `chain_id` | integer \| null | no | The EVM chain id (e.g. `1` Ethereum, `56` BNB Chain) for an EVM invoice, else `null`. | | `token_contract` | string \| null | no | The token being paid: ERC-20 contract (EVM), TRC-20 contract (Tron) or SPL mint (Solana). `null` for a native coin or a UTXO chain. Use it with `decimals` — e.g. USDT is 6 decimals on Ethereum and Tron but 18 on BNB Chain. | | `wallet_url` | string | no | Absolute URL of the wallet-only checkout popup (`/pay/{id}?mode=wallet`). Open it with `window.open(wallet_url + '&origin=' + encodeURIComponent(location.origin), …)` at about 420×640. It posts versioned `{ source: 'receivify', v: 1, type, invoice_id, … }` messages to the opener only when `origin` exactly matches the origin of the invoice's `return_url` or `callback_url` (https only). It cannot be framed. Treat messages as hints; confirm payment by polling this endpoint and via the webhook. | | `confirmations` | integer \| null | no | The lowest confirmation count across the payments seen so far, or `null` when none has been seen or the chain does not report it. | | `payments` | InvoicePayment[] | no | The incoming on-chain transfers seen for this invoice, oldest first (at most 10). Only real transaction ids are listed; an account-chain invoice credited from a balance read has none. A txid is public on chain anyway. | | `confirmations_required` | integer \| null | no | Confirmations the invoice needs to become `paid`, or `null` when the chain settles by finality instead of a count (see `finality`). | | `finality` | `confirmations` \| `finalized` | no | `confirmations`: paid after `confirmations_required` blocks. `finalized`: paid once the network finalises the block (Ethereum, Base, Solana, Tron, …). | | `amount_fiat` | string \| null | no | ADDITIVE. The fiat price the invoice was created for, as a DECIMAL string (e.g. `"25.00"`), or `null` on a crypto-priced invoice. Locked at creation; display only. | | `fiat_currency` | string \| null | no | ADDITIVE. ISO-4217 code of `amount_fiat`, or `null`. | | `fiat_value` | FiatValue \| null | no | ADDITIVE. The fiat value LOCKED at the time of the order (see `Invoice.fiat_value`), never today's rate. `null` when the invoice has no locked rate. | | `paid_at` | string \| null | no | ADDITIVE. When the invoice became paid, or `null`. | | `payment_seen` | object \| null | no | ADDITIVE, DISPLAY ONLY. On a `pending` EVM token invoice, set when a transfer to the deposit address was seen in a recent (not yet finalized) block: `{ seen_at, eta_minutes }`, where `eta_minutes` is a rough wait for finality. It never credits anything and can disappear (a block can be reorged out); `status` changes only once the transfer is final. `null` otherwise. | ### GET `/api/public/invoices/{id}/pdf` **Download an invoice or receipt as PDF, from the checkout page** — `getPublicInvoicePdf` Unauthenticated, like `GET /api/public/invoices/{id}`. Anyone holding the invoice id can download its PDF, which shows what that endpoint already shows (no reference, metadata, customer email or return URL). Rate-limited to 20 requests a minute per IP. The response carries an `ETag`; send it back in `If-None-Match` to get `304`. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The invoice id. Validated as a UUID before any database read. | | `locale` | query | no | The language of the labels. Defaults to the request's language, then English. | Responses: - `200` — The PDF (`application/pdf`, attachment). - `304` — Not modified. The `If-None-Match` value matches the current `ETag`. - `400` — `bad_request` — the id is not a UUID. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. - `503` — The PDF service is busy. Retry after the `Retry-After` seconds (5). ### GET `/api/public/links/{id}` **Read a payment link and its payable coins** — `getPublicPaymentLink` Unauthenticated. A deactivated link answers `404 not_found`, not 409 — telling an anonymous caller "that link exists but is off" would confirm the id is real. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The payment-link id — 8 base64url characters, not a UUID. | Responses: - `200` — The link plus the coins it can be paid in and an advisory FX snapshot. - `404` — `not_found` — no such resource, or it does not belong to the caller. The two cases are deliberately indistinguishable. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PublicPaymentLink`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `title` | string \| null | yes | | | `open_amount` | boolean | yes | | | `amount_btc` | string \| null | yes | **A decimal BTC string, not base units** — a reference value for a BTC-priced link. `null` for an open-amount or fiat-priced link. | | `amount_fiat` | string \| null | yes | **A decimal string** — the price for a fiat-priced link, converted to the chosen coin when the payer commits. `null` otherwise. | | `fiat_currency` | string \| null | yes | ISO-4217 code for `amount_fiat`, or `null`. | | `pricing` | `fiat` \| `crypto` \| `btc_value` \| `open` | no | Additive. How the link is priced. | | `amount_crypto` | string \| null | no | Additive. The fixed coin amount of a crypto-priced link. | | `crypto_asset` | string \| null | no | | | `amount_min` | string \| null | no | | | `amount_max` | string \| null | no | | | `options` | object[] | no | Additive. The (coin, network) pairs the payer may choose — the link's own `pairs`, or every payable pair the merchant can be paid out on. Send the chosen `symbol` as `asset` and `chain` as `chain`. | | `assets` | object[] | yes | The coins this link can actually be paid in — enabled AND settleable right now. | | `fx` | object | yes | An advisory rate snapshot, narrower than `FxSnapshot`: no `base`, `fetched_at`, `source` or `stale`. Floating-point numbers — display only. | ### POST `/api/public/links/{id}` **Mint an invoice from a payment link** — `createInvoiceFromPaymentLink` **Unauthenticated and it CREATES an invoice.** It belongs to the hosted checkout page, not to a server-side SDK — cart plugins should call `POST /api/v1/invoices` with a key. A fixed link stores a BTC-denominated value; paying it in another coin converts at the current advisory rate using floating-point arithmetic before rounding to the coin's precision, so the resulting `amount_expected` is approximate for non-BTC assets. An open-amount link takes `amount` in the chosen coin. Rate limited per LINK (`link:`), not per caller. Does not accept `Idempotency-Key`, so a retry mints a second invoice. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `id` | path | yes | The payment-link id — 8 base64url characters, not a UUID. | Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `asset` | string | no | Defaults to `btc`. Must be one of the link's payable assets. | | `chain` | string | no | The network (one of the link's `options` for this coin). Required when the link lists the coin on several networks. On an unrestricted link, omitting it keeps the previous behaviour: the asset's documented default chain. | | `amount` | string | no | Decimal amount for an open-amount link — in the link's `fiat_currency` when it has one (within `amount_min`/`amount_max`), otherwise in the chosen coin. Ignored for a fixed link. | | `customer_email` | string | no | Optional payer email. Used for payment emails only when the merchant has customer emails unlocked; otherwise ignored (never an error — the payer cannot unlock it). | Responses: - `201` — The newly minted invoice, in the same shape as `POST /api/v1/invoices`. - `400` — `asset_unavailable` — the chosen coin is not payable on this link. `bad_request` — an open-amount link was called without a valid `amount`. `suspended` / `amount_too_low` / `payout_address_mismatch` — raised by `createInvoice` and mapped through `failFromCode`. `limit_exceeded` — the link's owner has too many unpaid invoices open right now; try again later. - `404` — `not_found` — no such link, the link is deactivated, or the owning merchant no longer exists. - `409` — `payout_address_missing` — the link owner has no active payout address for the chosen coin on its network, so the invoice is refused (raised by `createInvoice`). - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. - `502` — `upstream_error` — deposit-address generation failed. Retryable. - `503` — `rate_unavailable` — a fixed link had to be converted to a non-BTC coin and no FX rate was available. Retryable. `201` body — `Invoice`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `reference` | string \| null | yes | Your own business key. It is ALSO a de-duplication key: creating a second invoice with a reference this merchant has already used returns the EXISTING invoice with a 201. | | `asset` | string | yes | Lower-case symbol, e.g. `btc`, `usdc`. | | `amount_expected` | string | yes | **Exact-integer base units, as a STRING** — satoshis for BTC, wei for ETH, the coin's smallest unit otherwise. Never a JSON number: a 256-bit wei value does not survive a double. | | `amount_received` | string | yes | Exact-integer base units, as a string. `"0"` until something arrives. | | `amount_fiat` | string \| null | yes | **A DECIMAL string** (e.g. `"25.00"`), not base units and not a JSON number. It is the fiat price captured at create time and is display information only; the authoritative amount is `amount_expected`. Never settle against it. Always carries at least two fraction digits, and never fewer digits than the stored value needs — padding only ever adds zeros, so the value round-trips exactly. | | `fiat_currency` | string \| null | yes | ISO-4217 code that `amount_fiat` is denominated in. | | `chain` | string \| null | yes | The EVM chain for EVM assets, the literal `solana` or `tron` for those providers, and `null` for BTC and every other `utxo`-provider coin. The `chain` you SEND at create time defaults to `ethereum` regardless of asset; it is only consulted for EVM assets. | | `provider` | string \| null | yes | The settlement backend that derived the address. `utxo` is the BTC/LTC/DOGE/BCH/ZEC/XMR family settled on our own nodes. | | `address` | string | yes | The deposit address. Send exactly this asset on exactly this chain. | | `status` | InvoiceStatus | yes | The invoice lifecycle, mirrored by the strict Mongo validator. Treat it as an OPEN enum and keep a default branch: a new value is an additive change. `pending` is the creation state. `confirming` means seen on-chain but not yet final; `partial` means less than expected arrived; `swept` means the funds left the deposit address for the payout wallet; `partial_expired` means the window closed on an under-payment. | | `expires_at` | string | yes | | | `paid_at` | string \| null | yes | | | `created_at` | string | yes | | | `metadata` | object | yes | Whatever you stored. Always an object, never null — an omitted `metadata` comes back as `{}`. | | `checkout_url` | string | yes | The hosted checkout page for this invoice. Redirecting here is the fast path, but it is OPTIONAL — `address`, `amount_expected`, `decimals`, `payment_uri`, `expires_at` and `status` are everything needed to render your own checkout instead. Poll `GET /api/public/invoices/{id}` (no API key, browser-safe) for live status. | | `return_url` | string \| null | no | Where the hosted checkout sends the payer after the invoice is `paid` (a "Back to store" button plus an automatic redirect after a short, cancellable countdown). `null` when not set at create time. Your query string is preserved exactly as given. | | `cancel_url` | string \| null | no | Where the hosted checkout sends the payer when the invoice has expired or was cancelled (and a quiet "cancel and return" link while it is still open). `null` when not set. | | `return_redirect_seconds` | integer \| null | no | Seconds the paid screen waits before sending the payer to `return_url`. `0` shows the "Back to store" button only. `null` = the default (3). | | `decimals` | integer | no | Decimal places for this invoice's asset — the divisor for `amount_expected`, which is in BASE UNITS. Display amount is `amount_expected / 10 ** decimals`. Per-token on EVM (USDC 6, DAI 18), so it cannot be assumed from the chain. Returned so a custom checkout does not need a second call to `/api/v1/assets`. | | `amount_decimal` | string | no | `amount_expected` already divided by `10 ** decimals`, as a decimal STRING (never a float — see the money note at the top of this spec). Provided for display only; keep using `amount_expected` for any comparison or arithmetic. | | `payment_uri` | string \| null | no | A wallet-scannable payment URI to put in a QR code, or `null` when the chain has no safe one — in which case show the bare `address`. Non-obvious rules this saves you from re-deriving: Monero uses `tx_amount` rather than `amount`; Zcash uses ZIP-321 (`zcash:`); Solana invoices get a Solana Pay transfer request (`solana:
?amount=…`, plus `spl-token=` for tokens), on mainnet only; EVM and Tron get `null` because an EIP-681 URI encodes a chain id and, for tokens, a contract call — get it wrong and a wallet silently prefills the wrong asset on the wrong network. | | `add_fee_ontop` | boolean | no | Whether our commission was added ON TOP of the requested amount rather than taken out of it. `false` (the default) means `amount_expected` is what you asked for and you receive it minus the fee; `true` means the payer covers the fee and you receive the full `amount_net_requested`. Always present — invoices created before this existed report `false`, which is what they are. | | `amount_net_requested` | string | no | **Exact-integer base units, as a STRING.** What you asked to RECEIVE. Equal to `amount_expected` whenever `add_fee_ontop` is `false`; smaller than it when the fee was added on top. | | `fee_ontop` | string | no | **Exact-integer base units, as a STRING.** `amount_expected - amount_net_requested` — what the gross-up added to the payer's bill. Always `"0"` when `add_fee_ontop` is `false`, never `null`, so it can be displayed unconditionally. The gross-up is `net / (1 - fee_bps/10000)`, not `net * (1 + fee_bps/10000)`: the fee is charged on the GROSS, so the naive form would leave you short by `net * rate²`. | | `fiat_value` | FiatValue \| null | no | ADDITIVE. The fiat value of this invoice LOCKED at the time of the order — never today's rate. `null` on an older crypto-priced invoice created before rates were snapshotted. | | `fx_at_creation` | FxAtCreation \| null | no | ADDITIVE. On a crypto-priced invoice, the rate snapshot taken at creation in your display currency: `currency`, `rate` (fiat per WHOLE coin, exact decimal string), `decimals`, `at`. `null` on fiat-priced invoices (their price is the lock) and on older invoices. | | `partial_settlement` | PartialSettlement \| null | no | ADDITIVE. Only meaningful on a `partial_expired` invoice (part of the amount arrived before it expired); `null` on every other invoice. What arrived is forwarded to the merchant's payout address by itself once the late-payment window after expiry has passed (or when the merchant presses "Send it now"), minus the normal fee. The invoice stays `partial_expired` and `invoice.paid` is never sent for it. `sweep.sent` fires when the money leaves. | ### POST `/api/public/security/confirm` **Apply a staged security-setting change** — `confirmSecurityChange` Consumes the single-use token from the confirmation email. Public because the TOKEN is the credential. A browser flow — do not model it in an SDK. Links from the old flow, which emailed every toggle request. Turning confirmation ON applies. Turning it OFF no longer applies at once: it becomes a pending weakening that waits out the current delay (`pending: true`, `effective_at`), and is refused on accounts with two-factor — use the dashboard, which asks for the second factor. Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `token` | string | yes | | Responses: - `200` — The applied change. - `400` — `bad_request` — body is not JSON. `invalid_token` — unknown, already spent, cancelled or superseded. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `change` | object | yes | | ### POST `/api/public/security/cancel` **Cancel a pending payout or protection change from its emailed link** — `cancelByLink` Consumes the single-use token from the one-click cancel link in a payout-change notice or a payout-protection notice. Cancels the pending payout-address change (the whole save) or the pending protection weakening. Public because the TOKEN is the credential, so an owner locked out of the dashboard can still stop a change; it can only ever cancel. The token expires when the change could have gone live. A browser flow — do not model it in an SDK. Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `token` | string | yes | | Responses: - `200` — What was cancelled. - `400` — `bad_request` — body is not JSON. `invalid_token` — unknown, already used, expired, or the change already went live or was cancelled. - `429` — `rate_limited` — too many attempts from this address. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `cancelled` | `payout` \| `protection` | yes | | | `count` | integer | yes | | ### POST `/api/public/payouts/confirm` **Confirm a staged payout-address change** — `confirmPayoutChange` Consumes the single-use token from the confirmation email. Public because the TOKEN is the credential. A browser flow — do not model it in an SDK. Confirming does not apply the change; it only starts (or completes) the timelock. Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `token` | string | yes | | Responses: - `200` — The confirmed change. - `400` — `bad_request` — body is not JSON. `invalid_token` — the token is unknown, expired or already spent. Deliberately a 400 and not a 404: nothing is missing, the token the caller supplied is bad. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PayoutConfirmAck`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `ok` | boolean | yes | | | `change` | PayoutChange | yes | A staged payout-address change. Secrets (the confirmation token hash) are never exposed. | ### GET `/api/public/promo-code` **Look up a promo code's public terms** — `getPromoCodeTerms` What a promo code (for example `PRODUCTHUNT`) offers, so a signup page can show it before an account exists. Never cached. Codes are applied with the `promo` field of `POST /api/public/signup`, or by a signed-in merchant in the dashboard. One promo code per account. Parameters: | Name | In | Required | Notes | | --- | --- | --- | --- | | `code` | query | yes | | Responses: - `200` — The code's terms. - `404` — `not_found` — no such code. - `429` — `rate_limited` — too many lookups from this address. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `terms` | object | yes | | ### POST `/api/public/signup` **Self-serve merchant signup** — `signup` Account bootstrap. Keep it OUT of an SDK so no SDK ever has a code path that mints credentials. **Two different 201 bodies.** When the deployment delivers keys by email, the response carries only `{delivered, merchant_id, message}` and the secret is emailed. When it does not, the response carries `{merchant_id, api_key, api_key_prefix, webhook_secret, message}` and `delivered` is absent. The schema below is the union. Unlike `POST /api/auth/register` this route is NOT rate limited. Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `email` | string | yes | | | `payout_address` | string | no | IGNORED (accepted for backward compatibility, never stored). Payout addresses are set with `PATCH /api/v1/payouts`, which applies the account's payout-change protection. | | `promo` | string | no | Optional promo code (for example `PRODUCTHUNT`). Applied as the account is created; a code that is unknown, ended or not allowed is simply not applied and never fails the signup. The 201 body then carries `promo`, with `applied` true plus `code` and `expires_at`, or `applied` false plus a `reason`. | | `payout_protection` | object | no | Optional payout-change protection for the new account. Omitted, the account gets the default — no code confirmation (opt-in) plus a 24-hour waiting period (or the platform's longer default) — and the dashboard asks the owner once, on first sign-in. A `delay_hours` below the platform minimum is raised to it. Changeable later in the dashboard (weakening needs a code). | Responses: - `201` — The new account. One of two shapes — see the description. - `400` — `bad_request` — body is not JSON, the email is missing/malformed, or `payout_protection` is invalid. - `403` — `signup_disabled` — self-serve signup is turned off on this deployment. - `409` — `already_exists` — an account with that email already exists. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `201` body — `SignupResult`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `merchant_id` | string | yes | | | `delivered` | `email` | no | Present only when the API key was emailed instead of returned. | | `api_key` | string | no | The raw secret. Shown once, and only on the non-email branch. | | `api_key_prefix` | string | no | | | `webhook_secret` | string | no | The HMAC key for verifying webhook signatures. Issued once here and NEVER shown again — there is no rotation endpoint. | | `message` | string | yes | | ## Security ### GET `/api/v1/security/payout-confirm` **Whether payout changes require an emailed confirmation** — `getPayoutConfirmSetting` The email half of the merchant's payout-change protection (the other half is the waiting period, `delay_hours`). `enabled` is the value actually in force; `default` is what an account that never chose would get (`PAYOUT_CONFIRM_EMAIL`), and `overridden` says which of the two you are looking at. `pending` lists requests that have not taken effect yet. Auth: `bearerAuth` Responses: - `200` — Current state and any request waiting on an email click. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body — `PayoutConfirmSetting`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `enabled` | boolean | yes | The value in force for this merchant. | | `default` | boolean | yes | What an account with no override gets (`PAYOUT_CONFIRM_EMAIL`). | | `overridden` | boolean | yes | True when the merchant has set this themselves rather than inheriting. | | `delay_hours` | number | no | The waiting period in force for payout changes (the other half of the protection). | | `email` | string | no | Where a confirmation link would be sent. Null means there is nowhere to send one. | | `pending` | object[] | yes | Requests that have not taken effect. Nothing about the live value has moved. | ### PATCH `/api/v1/security/payout-confirm` **Request a change to the payout-confirmation setting** — `requestPayoutConfirmSetting` Follows the payout-change protection rules. Turning it ON makes the account stronger and applies at once (`applied: true`). It needs a proved inbox: a session opened by signup whose email is unverified gets `403 email_unverified`, because a mistyped address would otherwise freeze every future payout change. Turning it OFF makes the account weaker. It is refused for API keys (`401 unauthorized` — only a signed-in dashboard session can do it), needs a step-up (`totp` / `telegram_code` / `recovery_code` when the account has two-factor, otherwise the 6-digit `email_code` sent on the first attempt) and is then STAGED (`staged: true`, `pending.effective_at`) until the waiting period currently in force has elapsed. The owner is notified by email (with a one-click cancel link) and Telegram, and payout changes keep needing confirmation until it takes effect. Auth: `bearerAuth` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `enabled` | boolean | yes | | Responses: - `200` — Staged, or a no-op when already in that state. - `400` — `bad_request` — body is not JSON, `enabled` is not a boolean, or there is no email address on file. - `401` — `unauthorized` — no valid credentials, or an API key tried to turn protection down. `totp_required` / `totp_invalid` — turning it off needs the account's second factor. `email_code_required` / `email_code_invalid` — turning it off needs the emailed code (no two-factor). - `403` — `email_unverified` — verify the account email before turning email confirmation on. - `429` — `rate_limited` — too many requests or codes. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `staged` | boolean | yes | A weakening was accepted and is waiting out the current delay. | | `applied` | boolean | no | The change is already in force (turning it on, or a weakening when the delay is 0). | | `reason` | `no_change` \| `null` | no | | | `pending` | object | no | The staged weakening, when `staged` is true. | | `message` | string | yes | | ### DELETE `/api/v1/security/payout-confirm` **Cancel a pending setting change** — `cancelPayoutConfirmSetting` The "I did not request that" path, usable without touching the mailbox. Auth: `bearerAuth` Request body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | Responses: - `200` — Cancelled. - `400` — `bad_request` — body is not JSON. - `401` — `unauthorized` — missing, malformed, revoked or unknown API key / session cookie. - `404` — `not_found` — no such pending change for this merchant. - `429` — `rate_limited` — back off using `Retry-After` or `X-RateLimit-Reset`. - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. `200` body: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `cancelled` | boolean | yes | | ## System ### GET `/api/health` **Service health for monitors and the status page** — `getHealth` Public, unauthenticated and safe to expose: an overall `status`, a one-line `message`, and a status word per component. It never contains provider names, versions, queue sizes or error text. **HTTP status is the signal for monitors:** 200 while payments can be taken (`operational` or `degraded`), 503 only during a `major_outage`. The 503 body has the same shape as the 200 and is NOT an `{error, detail}` object. The owner can add `?detail=1` with the admin token to receive a `detail` object (the full operator report). Without the token the parameter is ignored. Responses: - `200` — `operational`, or `degraded` (some components slow; payments still accepted). - `500` — `internal` — an unhandled server error, produced by the `handler()` catch-all. The `detail` is always the fixed string `Unexpected error.`: the stack, the driver message and any internal path stay server-side. Safe to retry. - `503` — `major_outage`. Same body shape as the 200; NOT an `{error, detail}`. `200` body — `Health`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `status` | `operational` \| `degraded` \| `major_outage` | yes | Worst of the component statuses. 503 only for `major_outage`. | | `message` | string | yes | One plain-English sentence describing the overall status. | | `updated_at` | string | yes | | | `components` | object | yes | | | `detail` | object | no | Owner only (`?detail=1` plus the admin token): the operator report. Shape may change without notice. | ## Webhooks Every webhook carries an `x-receivify-signature` header: HMAC-SHA256 over the timestamp and raw body, keyed with your webhook secret. Verify it in constant time. ### POST `receivifyEvent` **Every outbound Receivify event** — `receivifyEvent` ONE envelope for every family. Receivify POSTs this body to the merchant's registered endpoints (`invoice.*` and `sweep.sent`) or to a forward's own `callback_url` (`forward.*`), and expects a 2xx. A non-2xx is retried with exponential backoff (0s, 10s, 60s, 5m, 30m, 2h, 6h, 24h) and then marked `failed`. ## Signature Every delivery carries: ``` X-Receivify-Signature: t=,v1= ``` `v1` is `HMAC-SHA256(merchant.webhook_secret, "${t}.${rawBody}")`, hex-encoded. Verify it against the RAW request body before parsing — re-serialising the JSON first will not reproduce the same bytes. Compare in constant time, and reject a `t` outside your own tolerance window (no window is enforced server-side). **Verify against a LIST of secrets, not one.** `POST /api/v1/webhooks/secret/rotate` mints a new signing secret and keeps the previous one acceptable until its `prev_expires_at` (24h by default), so during a rotation two secrets are legitimately valid at the same time. We always SIGN with the current secret only — the grace window is an instruction to the receiver. Write `verifyWebhook(rawBody, header, secrets)` to take an array from day one and its signature never has to change; `GET /api/v1/webhooks/secret` tells a running process whether the fallback is still needed. ## Ordering, dedupe and replay `sequence` is a globally monotonic counter allocated at enqueue time, present on BOTH families. Use `(event, sequence)` to de-duplicate; there is no separate event id. The body is built ONCE and stored, so a retry and a `POST /api/v1/webhooks/deliveries/{id}/replay` re-send the SAME bytes with the SAME `created_at` and `sequence`. A webhook is a statement about a moment, never about now — poll `GET /api/v1/invoices/{id}` or `GET /api/v1/address/{id}` for current state. ## Compatibility Receivers MUST ignore unknown `event` values and unknown fields inside `data`: adding either is an additive change under the versioning policy. There is no `api_version` field today because there is only one version. Request body — `WebhookEvent`: | Field | Type | Required | Notes | | --- | --- | --- | --- | | `event` | EventName | yes | The complete, frozen set of event names Receivify can emit. It is checked against the server's own list on every release. `invoice.*` fires whenever an invoice's status genuinely ADVANCES; `invoice.pending` is deliberately absent because pending is the creation state, never a transition. `sweep.sent` fires when funds physically leave a deposit address. `forward.*` are the stateless forwarding API's callbacks, delivered ONLY to a forward's own `callback_url`, and they cover the WHOLE lifecycle of a payment, not just its happy path: \| event \| when \| \|---\|---\| \| `forward.detected` \| first sighting, not yet confirmed. The only event with `pending: true`. \| \| `forward.confirmed` \| credited to your ledger balance. \| \| `forward.deferred` \| credited but not forwardable right now. Carries `reason` + `detail`. \| \| `forward.sent` \| broadcast on-chain to your `destination`. \| \| `forward.reversed` \| the credit was UNDONE — a reorg, or a Replace-By-Fee replacement. \| \| `forward.failed` \| held for manual review; it will not move on its own. \| There is deliberately no `forward.partial`: a forwarding address has no expected amount, so it cannot be underpaid. An amount too small to forward economically surfaces as a `forward.deferred` with `reason: below_minimum` or `uneconomical`, never as a partial payment. `test` is emitted exclusively by `POST /api/v1/webhooks/test` and never by the money path. Adding a name is additive; renaming one is breaking. Receivers must ignore names they do not recognise. | | `sequence` | integer | yes | A globally monotonic counter allocated at enqueue time, present on BOTH families. It is not per-resource: consecutive events for one invoice are not necessarily consecutive numbers. `(event, sequence)` is the de-duplication key — there is no separate event id. | | `created_at` | string | yes | When the EVENT happened, not when this delivery was sent. Frozen: a retry and a replay carry the original value. `POST /api/v1/webhooks/test` is the exception — its sample body hard-codes the Unix epoch, `1970-01-01T00:00:00.000Z`. | | `data` | InvoiceEventData \| ForwardEventData | yes | The resource the event is about. `invoice.*`, `sweep.sent` and `test` carry the invoice payload; `forward.*` carries the forward-payment payload. | Responses: - `2XX` — Any 2xx marks the delivery `delivered`. Anything else is retried.