Skip to content

API overview

The business API is a server-to-server interface for the merchant’s business system: it creates and reads orders and subscriptions, lists payees and plans, reads the event feed, and maintains the risk address list. Payers pay on the hosted checkout (checkout_url); the system confirms payments on chain and reports them through signed webhooks and GET /v1/events.

The API lives under the merchant’s own deployment address (the public_url setting), for example:

https://pay.example.com/v1/orders

This documentation writes $BASE for the deployment address and $KEY for the API key. Request bodies are JSON (Content-Type: application/json). Amounts are always decimal strings, never JSON numbers.

Terminal window
curl "$BASE/v1/plans" -H "Authorization: Bearer $KEY"
  • API keys are created in the console under “Developers → API keys” or with flowpayra-lite apikey create, and sent in the Authorization: Bearer header. A missing, malformed, unknown or revoked key answers 401 unauthorized.
  • Scopes: every key carries a set of scopes: orders:write, orders:read, subscriptions:write, subscriptions:read, events:read, risk:read, risk:write. A key created without naming its scopes gets all but risk:read and risk:write. A key that lacks an operation’s scope answers 403 insufficient_scope (checked after the path and query parameters are parsed, before the request body and the Idempotency-Key).
  • Modes: every key belongs to one mode, visible in its prefix: fpk_live_… (live) or fpk_test_… (test); fpk_… keys made before modes existed are live. A key creates and sees only its own mode’s orders, subscriptions and events, and another mode’s object answers 404. See Test mode.

The mapping of scopes to endpoints is given in the integration guide.

  • Paths are prefixed with /v1, and the info.version of the OpenAPI specification is "1".
  • GET /v1/openapi.yaml returns the specification of the deployed version. Check against it when generating a client or after upgrading the deployment.
  • New webhook event types and alert kinds may be added in later versions; receivers should acknowledge unknown types with 2xx.

Writes that create require an Idempotency-Key header (1–255 characters) and answer 400 invalid_request without it:

  • POST /v1/orders
  • POST /v1/subscriptions
  • POST /v1/subscriptions/{id}/change_plan
  • POST /v1/risk/addresses
  • POST /v1/risk/addresses/import

Rules:

  • Keys are scoped to the API key. The first answer (2xx or 4xx) is stored with a SHA-256 of the raw body: a retry with the same key and the same body bytes returns it again with the same status and body.
  • The same key with another body answers 422 idempotency_key_reused; a retry while the first request is still running answers 409 request_in_progress.
  • A server error (5xx) is not stored: retry with the same key. Stored keys do not expire.
  • The other writes (cancel, pause, resume, DELETE) take no key.

An error answer carries an HTTP status and the following body:

{ "error": { "code": "invalid_request", "message": "expires_in must be between 60 and 604800 seconds",
"params": { "field": "expires_in", "min": 60, "max": 604800 } } }
  • code is stable and suitable for program logic.
  • params (when present) carries the values behind the error: the field at fault, limits such as min / max, amounts and currencies, for wording the message in your own language.
  • message is English and intended for logs.

Every operation may also answer 500 internal (retry later), 408 (the request took over 30 seconds; empty body) and, for a path or method that does not exist, 404 / 405 with an empty body. Request bodies are limited to 64 KiB (4 MiB for the bulk import); larger bodies answer 413 payload_too_large. There is no rate limit on the business API.

Common error codes and when they occur are listed in the integration guide: Idempotency and errors. The code values each operation may return are listed with its responses in the OpenAPI specification.

Endpoint Method
GET /v1/events Position cursor: since (default 0) and limit (default 100; values outside 1–500 are clamped). The answer is {data, next_since}; pass next_since as the next since
GET /v1/risk/addresses ID cursor: limit (default 100; values outside 1–500 are clamped) and after. The answer is {data, has_more, next_after}; pass next_after as after for the next page. next_after is null on the last page
GET /v1/payees, GET /v1/plans Not paginated; the answer is {data}
Endpoint Scope Description
POST /v1/orders orders:write Creates an order; the answer carries the checkout_url for the payer. Idempotent
GET /v1/orders?merchant_order_no= orders:read Finds the mode’s order by your order number (exact match)
GET /v1/orders/{id} orders:read Returns the order as it stands: the source of truth for fulfilment
Endpoint Scope Description
GET /v1/payees orders:read Lists every payee registered in the console (active or not), for splits[].payee_ref / payee_id
GET /v1/plans subscriptions:read Lists the active subscription plans; pass a plan’s id as plan_id
Endpoint Scope Description
POST /v1/subscriptions subscriptions:write Creates a subscription on a plan and returns its checkout_url (/pay/sub/{id}); the status starts as incomplete. Idempotent
GET /v1/subscriptions/{id} subscriptions:read Returns a subscription
POST /v1/subscriptions/{id}/cancel subscriptions:write Cancels a subscription: charging stops at once and the system then cancels it on chain
POST /v1/subscriptions/{id}/pause subscriptions:write Pauses a subscription: no charges while paused, and paused periods are not charged later
POST /v1/subscriptions/{id}/resume subscriptions:write Resumes a paused subscription; charging resumes from the next period
POST /v1/subscriptions/{id}/change_plan subscriptions:write Changes the plan (upgrade or downgrade): returns a new incomplete subscription whose terms the payer confirms. Idempotent
Endpoint Scope Description
GET /v1/events events:read Reads every webhook event of the key’s mode in commit order, whether or not delivery succeeded
Endpoint Scope Description
GET /v1/risk/addresses risk:read Lists risk address entries of every source, newest first, with filters and pagination
POST /v1/risk/addresses risk:write Adds an entry to the merchant’s list or to a named list. Idempotent
POST /v1/risk/addresses/import risk:write Imports entries in bulk (up to 10,000 per request, all valid or none), in append or replace mode. Idempotent
DELETE /v1/risk/addresses/{address} risk:write Removes an address’s entries from the merchant’s list or a named list
Endpoint Scope Description
GET /v1/openapi.yaml No authentication The OpenAPI 3.1 document of the deployment’s version (YAML)

Webhooks (sent by the system to the merchant)

Section titled “Webhooks (sent by the system to the merchant)”

The webhooks section of the OpenAPI specification also defines two outbound requests:

Request Description
Event delivery Events POSTed to the webhook endpoint configured in the console, with the FlowPay-Signature header
Alert center notification Notifications of an alert center webhook channel, independent of business events and signed with the channel’s own secret

See Webhooks.

  • Integration docs in the console: “Developers → Integration docs” in the console opens the guides and the API reference in a new window. Each endpoint has an interactive console: after entering an API key, requests can be sent directly to the deployment and the equivalent curl command copied. A test key (fpk_test_…) is recommended for integration work.
  • Postman collection: import docs/developers/postman/flowpay.postman_collection.json from the repository and set the collection variables base_url (the deployment’s public_url) and api_key (fpk_test_… for integration, fpk_live_… for production). Write requests generate a new Idempotency-Key on every send.
  • Signature verification examples and test vectors: see Webhooks: signature verification.