Get started

Authentication

API keys, scopes, and test and live mode.

Send your key as a bearer token:

curl https://api.inversepay.app/api/b/v1/charges \
  -H "Authorization: Bearer $INVERSEPAY_TEST_KEY"

Two kinds of credential

A dashboard session is a person acting in a role. An API key is your business's own authority, narrowed to a set of scopes.

They are not the same thing, and we do not pretend otherwise. A key has no seat on your team, so anything that needs a person accountable for it is closed to keys entirely — however the key is scoped.

Modes

A key carries a mode and it is in the key itself: sk_test_ is test, sk_live_ is live. Mode is never taken from the request — a header saying "treat this as test" would be a way to write test data with a live key and, far worse, a way to have a live payment treated as simulated.

A dashboard session carries no mode, and a credential with no mode is live. That is the only safe default for an unmarked credential, and it is worth knowing before you go looking for a payout somebody raised in the dashboard: it is a live row, and a test key cannot see it.

Scopes

ScopeGrants
payments:readread charges, checkout sessions, payment links, invoices, refunds, virtual accounts
payments:writecreate charges; create and expire checkout sessions; create, disable and enable payment links
payouts:readread payouts, the bank list (GET /payout-banks), and payout batches and schedules (GET /payout-batches, GET /payout-schedules)
payouts:writecreate payouts and run account lookups (POST /account-lookups)
balances:readbalances (GET /wallets), statements and FX rates
webhooks:managemanage endpoints and read deliveries
accounts:readlist and read your sub-accounts, their statements, and transfers between them
accounts:writeopen and rename sub-accounts, and move money between them (POST /transfers)

Scopes are per key, and a key belongs to your business, not to one account: there is no per-account key. Name the account in the request, as account on a charge or a payout. See Sub-accounts.

A missing scope is a 403, and the message names the scope you need.

payouts:write moves money. A live key holding it can create payouts and run account lookups, but only once your business has an IP allowlist (below); without one it is refused everywhere. A test key holding it works from anywhere.

IP allowlist

Your business can limit where its live API keys may be used from. Owners, admins and developers manage the list in the dashboard, under Settings → API & developer (single addresses or ranges, IPv4 and IPv6). Once it has entries, every request made with any of your live keys, on every endpoint, must come from a listed address; anything else gets 403 IP_NOT_ALLOWED, and the message names the address we saw. A live key holding payouts:write needs a list before it can be used at all. Test keys and dashboard sign-ins are not affected.

What a key can never do

Not "is not scoped for" — cannot, at all:

  • invite or manage members, or change roles
  • create, revoke or regenerate another API key
  • cancel, review or approve a payout (a key with payouts:write can create one)
  • issue a refund, or execute an FX conversion
  • freeze, unfreeze or close an account
  • submit KYB documents or change business settings

Two reasons. Governance is a person's act and needs a person accountable for it. And a key that can mint keys cannot be contained by revoking it — the first thing anybody who steals one does is issue another.

A key with payouts:write can create a payout, and the same approval policies, limits and screening apply to it as to one raised in the dashboard. Everything else about a payout — cancelling, reviewing, approving — is a person's act.

Beneficiaries, payroll, bill payments, batch and schedule management, report exports and card operations are closed to keys for the same reason — each one either moves money or decides who may be paid.

Idempotency, twice

Two separate mechanisms share a name, and knowing which is which saves an afternoon.

The Idempotency-Key header is honoured on every POST, PUT and PATCH under /api/b/v1. The first request's response is stored and replayed for 24 hours, with Idempotent-Replay: true on the replay. It is fingerprinted against the body, so reusing a key with a different body is a 422 (IDEMPOTENCY_KEY_REUSED), and repeating one while the first is still running is a 409 (IDEMPOTENCY_KEY_IN_FLIGHT). A 5xx releases the key rather than pinning it to a non-outcome, so the one request you never got an answer for is the one you can always retry.

The idempotency_key field in the body of a charge, a payout or a transfer is the domain's own. It deduplicates the object: send it again and you get the original charge, payout or transfer back. It is scoped to your business, and on a charge to your mode as well — so the order references you use while building cannot collide with the real ones later.

Send both. The header protects the request, the field protects the money.

Rotation

Regenerating a key returns a new secret and keeps the old one working for an overlap window, so you can deploy the new secret without a synchronised restart. Revoke the old one when your last instance has it.

On this page