Reference

Authentication

Get OAuth2 bearer tokens for personal access or application client-credentials authentication.

Every request carries an OAuth2 bearer token. Tokens are scoped to one stack and expire; the SDKs refresh them for you, curl does not.

Get a token#

For a human on a laptop, fctl mints a personal token against your logged-in Cloud session. For a service, create an OAuth2 client in the stack and use the client-credentials grant. Personal tokens are for exploration — never ship one.

bash
curl -X POST "$FORMANCE_API_URL/api/auth/oauth/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=$FORMANCE_CLIENT_ID" \
  -d "client_secret=$FORMANCE_CLIENT_SECRET"

# => { "access_token": "eyJ…", "expires_in": 3600 }

Send it#

Set Authorization: Bearer on every call. A missing or expired token returns 401 with no body detail — that is deliberate. A valid token that lacks the scope for the operation returns 403 and names the scope it wanted.

HeaderRequiredNotes
AuthorizationyesBearer <access_token>. Tokens last one hour by default.
Content-Typewith a bodyapplication/json — including on the GET calls that take a filter body.
Idempotency-Keysome writesClient-generated. Where honored, replays the original response on retry. Coverage is per-endpoint, not per-module — Ledger v2 data-plane writes and Wallets writes accept it, Ledger admin operations and all of Ledger v1 do not, and Webhooks delivery replay requires it. See Conventions.
bash
curl "$FORMANCE_API_URL/api/ledger/v2" \
  -H "Authorization: Bearer $FORMANCE_TOKEN"

Scopes#

Scopes are granted per module and per verb. A client that only reads the ledger needs ledger:read; posting transactions needs ledger:write. Membership roles are separate and are managed from the Cloud console, not the stack.

ScopeGrants
ledger:readList and retrieve ledgers, transactions, accounts, balances and volumes.
ledger:writeCreate and revert transactions, write metadata, run bulk actions.
payments:readRead connectors, payments, bank accounts and payment service users.
payments:writeInstall connectors and initiate payments.
wallets:readList and retrieve wallets, balances and holds.
wallets:writeCreate wallets, debit, credit and manage holds.
orchestration:readRead workflow definitions and execution instances.
orchestration:writeCreate and trigger workflows.
webhooks:readList webhook configurations and delivery attempts.
webhooks:writeCreate, update and delete webhook configurations.
reconciliation:readRead reconciliation policies and reports.
reconciliation:writeCreate reconciliation policies and run reconciliations.
auth:readRead OAuth2 clients and their configuration.
auth:writeCreate and manage OAuth2 clients and secrets.
search:readQuery the full-text search index (Enterprise Edition).
search:writeIndex documents into the full-text search service (Enterprise Edition).