This is the full contract between Formance Payments and the HTTP service you run. For how the connector calls it and on what schedule, see How it Works; for what the transactions you return do to the Formance payment model, see Payment lifecycle.
Your service implements the contract defined in generic-openapi.yaml (OpenAPI 3.0.3). That file is the source of truth for every request and response shape; the tables below summarize it, but the spec itself is authoritative if the two ever disagree.
Endpoints your service must expose#
Every endpoint is mounted at the root of the endpoint you configure at install time (do not include a trailing slash — it is not normalized, and produces a doubled // in the request URL) and authenticates via Authorization: Bearer <apiKey>.
| Method | Path | Purpose | Payments capability |
|---|---|---|---|
GET | /accounts | List internal accounts. | FETCH_ACCOUNTS |
GET | /accounts/{accountId}/balances | Return point-in-time balances for one account. | FETCH_BALANCES |
GET | /beneficiaries | List external accounts (beneficiaries). | FETCH_EXTERNAL_ACCOUNTS |
GET | /transactions | List transactions, filtered by updatedAtFrom. | FETCH_PAYMENTS |
POST | /payouts | Initiate a payout to a beneficiary. | CREATE_PAYOUT |
POST | /transfers | Initiate a transfer between two internal accounts. | CREATE_TRANSFER |
accountId is a required string path parameter, and the connector inserts it into the path without URL-escaping. The spec declares 200 as the success response of the four GET endpoints and 201 for the two POST endpoints, with the Error schema as the default response of all six.
/accounts/{accountId}/balances is a single-shot read: it takes no pagination or date-filter parameters, and every response is treated as complete.
Query parameters#
| Name | Used on | Type | Default | Notes |
|---|---|---|---|---|
pageSize | /accounts, /beneficiaries, /transactions | integer (int64, minimum 1) | 100 | The connector always requests 100, regardless of any pageSize value set in the connector's config — that config field is deprecated and has no effect on the request. |
page | same three | integer (int64, minimum 1) | 1 | Incremented until your service reports no more pages (see Pagination, below). |
sort | same three | string | — | The connector always sends sort=createdAt:asc for accounts and beneficiaries, and sort=updatedAt:asc for transactions. This is not optional in practice: the connector's incremental-sync watermark assumes your response is sorted ascending by that field, and an unsorted response will silently corrupt the watermark and cause the connector to skip data. |
createdAtFrom | /accounts, /beneficiaries | date-time | — | Sent once the connector has a non-zero watermark from a previous fetch, in UTC and truncated to whole seconds (RFC 3339, for example 2026-09-11T08:00:00Z). |
updatedAtFrom | /transactions | date-time | — | Same, keyed on the transactions watermark. |
Response shapes#
/accounts, /beneficiaries, and /transactions each return a bare JSON array — there is no {"data": [...]} envelope and no total-count field. /accounts/{id}/balances, POST /payouts, and POST /transfers each return a single object.
Account#
| Field | Type | Required |
|---|---|---|
id | string | yes |
accountName | string | yes |
createdAt | string, date-time | yes |
metadata | object with string values, nullable | no |
Balances#
| Field | Type | Required |
|---|---|---|
id | string | yes |
accountID | string | yes |
at | string, date-time | yes |
balances | array of Balance | yes |
Balance: amount (string, minor units) and currency (string, UMN format — see Amounts and assets below), both required.
An account can hold several Balance entries in different assets — a multi-currency wallet returns one entry per asset.
Beneficiary#
| Field | Type | Required |
|---|---|---|
id | string | yes |
createdAt | string, date-time | yes |
ownerName | string | yes |
metadata | object with string values, nullable | no |
Transaction#
| Field | Type | Required |
|---|---|---|
id | string | yes |
relatedTransactionID | string | no |
createdAt | string, date-time | yes |
updatedAt | string, date-time | yes |
currency | string, UMN format | yes |
scheme | string | no |
type | TransactionType (below) | yes |
status | TransactionStatus (below) | yes |
amount | string, minor units | yes |
sourceAccountID | string | no |
destinationAccountID | string | no |
metadata | object with string values, nullable | no |
The connector does not enforce the required flags when it decodes a response. A missing createdAt or updatedAt decodes as the zero time, so the row is never newer than the watermark and is skipped without an error. A metadata value that is not a string fails the decode of the whole page.
scheme is accepted but not used — every transaction is recorded with a generic scheme on the Formance side regardless of what you send. There is no need to populate it precisely.
TransactionType has four values:
| Value | Meaning |
|---|---|
PAYIN | Incoming payment (recorded in Formance as PAY-IN) |
PAYOUT | Outgoing payment to an external account |
TRANSFER | Internal transfer between accounts |
OTHER | Anything else — see below |
Use OTHER for standalone events that are not themselves a pay-in, payout, or transfer — a fee, say — and use the status field to carry the finer lifecycle detail.
Do not use OTHER for a transaction that sets relatedTransactionID. A related transaction must repeat its parent's type exactly. A payment is identified by the tuple (reference, type, connector), and a related transaction is matched to its parent by that whole tuple — so a refund of a PAYIN must itself be type: PAYIN. Sending type: OTHER does not fail or warn: it silently creates a separate OTHER payment that happens to share the parent's reference, and the original payment's amount is never adjusted.
TransactionStatus has fifteen values:
| Value | Meaning |
|---|---|
PENDING | Awaiting processing |
SUCCEEDED | Completed successfully |
FAILED | Failed |
CANCELLED | Cancelled |
EXPIRED | Expired |
REFUNDED | Refunded |
REFUNDED_FAILURE | A refund attempt failed |
REFUND_REVERSED | A refund was itself reversed |
DISPUTE | Under dispute |
DISPUTE_WON | Dispute resolved in the merchant's favor |
DISPUTE_LOST | Dispute resolved against the merchant |
AUTHORISATION | Authorized but not yet captured |
CAPTURE | Captured |
CAPTURE_FAILED | A capture attempt failed |
OTHER | Anything else |
The spelling is exact and validated: CANCELLED and AUTHORISATION use British spelling, and REFUNDED_FAILURE is not parallel to REFUND_REVERSED.
A value outside this list — in either status or type — does not degrade gracefully. It fails the JSON decode for the entire page of transactions, not just the offending row, and that failure is classified as retryable: the poll retries on the standard backoff, indefinitely, and its watermark never advances. A single malformed status value will stall payment ingestion until you correct it. Map any provider-specific status you cannot represent onto OTHER rather than passing it through.
A field-naming inconsistency to watch for. Transaction uses sourceAccountID / destinationAccountID (capital ID), and Balances uses accountID (also capital ID) — but Payout, Transfer, PayoutRequest, and TransferRequest all use sourceAccountId / destinationAccountId (lowercase d). This is a genuine inconsistency in the contract, not a typo in this page. Match each shape exactly.
Payouts and transfers#
PayoutRequest and TransferRequest share the same shape: idempotencyKey, amount, currency, sourceAccountId, and destinationAccountId are required; description and metadata are optional. The distinction is what the account IDs refer to: a payout's destinationAccountId is an external beneficiary, while a transfer's sourceAccountId and destinationAccountId are both internal accounts at the same payment service provider.
The idempotencyKey the connector sends is the Formance payment-initiation reference itself — if your service sees the same key twice, return the original response rather than creating a second payout or transfer.
Payout and Transfer responses require id, idempotencyKey, amount, currency, sourceAccountId, destinationAccountId, status (a TransactionStatus value), and createdAt. description, updatedAt (date-time), and metadata are optional. Unlike /transactions, a status outside the enum is not rejected here: it is recorded as OTHER.
The spec asks for a 201 on success, and we recommend sending one, but the connector accepts any status code below 400 — a 200 will not be rejected. createdAt must parse as RFC 3339. A value in another format is treated as a retryable error, so the connector sends the same request again, with the same idempotencyKey, until it gets a parseable response.
Error response#
The contract declares Title and Detail, capitalised, unlike the camelCase used everywhere else in the spec. The connector decodes the body case-insensitively, so title and detail are also accepted.
A response with a status code of 400 or above is treated as an error. Anything below 400 is treated as success, and its body is decoded as the success shape. The connector decodes the error body but does not use its contents: whether to retry depends on the status code alone (see Timeouts and retries, below). Returning Title and Detail still helps you debug from your own logs and request traces.
Amounts and assets#
Amounts are strings, in minor units: "10000" on a USD/2 balance is $100.00; "100000000" on a BTC/8 balance is 1.00000000 BTC.
Assets use Formance's Unified Metadata Notation (UMN): CURRENCY or CURRENCY/PRECISION, for example USD/2, EUR/2, BTC/8, or JPY (precision defaults to 0 when omitted). The code is not limited to fiat currencies. Tokens, points, or another proprietary unit are representable, within these rules:
- On balances and transactions your service returns, the asset must match
^[A-Z][A-Z0-9]{0,16}(_[A-Z]{1,16})?(\/\d{1,6})?$. That means an uppercase letter first, at most 17 uppercase letters or digits, an optional_SUFFIX, and a precision of at most six digits. Lowercase letters,-,., and a leading digit are rejected. A transaction with an invalid asset fails the fetch of its whole batch as a non-retryable error. - On payouts and transfers, the connector checks the asset before calling your service. The currency code must be non-empty and uppercase, and the precision, if given, a non-negative integer.
The connector parses amounts as base-10 integers and does not check their sign. An amount that is not an integer fails the whole page.
Pagination and incremental sync#
The connector walks pages starting at page=1, accumulating results, and treats a page as full — meaning there may be more — whenever it returns at least pageSize (always 100) items.
It does not, however, keep paging until it sees a short page. Once it has accumulated 100 rows newer than the watermark, it stops there and commits its watermark. Rows beyond the 100th on that page are dropped from the batch and fetched again. If there may be more, the next fetch runs immediately, not at the next polling interval, and starts again at page=1 with the new filter value. Pagination therefore only ever walks forward within a batch of 100; the batch boundary is where the watermark moves.
Incremental sync uses a single watermark timestamp per resource (createdAt for accounts and beneficiaries, updatedAt for transactions), set to the timestamp of the last row in the batch. Deduplication is a strict greater-than comparison against that watermark — an item whose timestamp is less than or equal to the stored watermark is skipped. Three consequences worth designing around:
- Re-sending the same boundary row on the next cycle is safe; it will simply be skipped. You do not need application-level idempotency keys on your list responses.
- Two rows sharing the exact same timestamp as the watermark will both be skipped if only one arrives per cycle — one for having been seen already, and the other because its timestamp is not strictly greater.
- The batch boundary makes this bite even on a single backfill. If rows 100 and 101 of a backlog share an
updatedAt, the connector stops after row 100, commits that timestamp, and restarts with a strictly-greater filter — so row 101 is skipped permanently, even though every row was available from the first request. Nothing errors; the row is simply never ingested.
Make updatedAt and createdAt unique per row, so no two rows can straddle a batch boundary on an equal timestamp. Sub-second precision alone is not enough: two rows can still share a sub-second timestamp. This matters most on the initial backfill, where large runs of rows often share a bulk-import timestamp.
Timeouts and retries#
Each request from the connector to your service has a 10-second timeout, and it is not configurable. The connector itself does not retry a failed request — retries happen one layer up, in the scheduler, and only for failures classified as retryable:
- A
4xxresponse other than408,421,423,425, or429is non-retryable: the connector gives up rather than trying again. Reserve these for input your service will never be able to process. - A connection failure that is not a timeout is also non-retryable. That covers connection refused, a DNS failure, and a TLS error.
- A
5xxresponse, a timeout, a408, or a421is retried on an exponential backoff that starts at 1 second and doubles up to a 100-second ceiling, with no limit on the number of attempts. Use5xxfor failures you expect to be transient. - A
429,423, or425is retried after a fixed delay, set by the Payments worker's--temporal-rate-limiting-retry-delayflag (5 seconds by default).
Your service can rely on the connector reusing keep-alive connections across requests.
See also#
generic-openapi.yaml— the contract itself; authoritative if this page and it ever disagree.