x-api-key request header. The key identifies your merchant account and determines which customers, wallets, checkouts, payouts, and transactions the request can access.
Before you begin
To generate an API key, your merchant account must have:- completed business verification;
- two-factor authentication enabled; and
- access to Dashboard → Settings → API Keys.
fk_production_ prefix.
Generate and store a key
- Sign in to the FossaPay Dashboard.
- Open Settings → API Keys.
- Generate a production API key and complete the two-factor authentication challenge.
- Copy the key into a secrets manager or protected server environment.
.env files, and avoid commands that leave real credentials in shell history.
Authenticate a request
Send the API key in thex-api-key header on every protected endpoint:
x-api-key consistently. Do not add Bearer or another authentication scheme to the value.
Request headers
Authentication and idempotency solve different problems. An API key establishes who is calling; an idempotency key identifies one logical write operation. Never use an API key as an idempotency key.
Server-side example
Merchant isolation
An API key is associated with one merchant. FossaPay uses that merchant association to scope protected resources:- customers created with the key belong to that merchant;
- customer and wallet lookups are restricted to that merchant’s records;
- checkout and single-payout references are evaluated within that merchant;
- bulk payout batch references are globally unique, while batch retrieval remains merchant-scoped; and
- a valid key does not grant access to another merchant’s resources.
403 or 404 during retrieval can indicate an incorrect ID or a resource that is not owned by the authenticated merchant.
Idempotency for financial writes
POST /checkouts, POST /payouts, and POST /payouts/batches require an idempotency header. Use X-Idempotency-Key for new integrations. The legacy Idempotency-Key header is also accepted for compatibility.
- generate one stable key for each logical checkout, payout, or payout batch;
- store it with your internal operation record before sending the request;
- retry an uncertain request with the same key and identical body;
- never reuse the key for a different request body;
- limit the value to 255 characters; and
- if both supported idempotency headers are sent, give them exactly the same value.
409. For multipart bulk payouts, the CSV bytes are part of the idempotency comparison. Missing, oversized, or conflicting idempotency headers return HTTP 400.
Idempotency requirements are endpoint-specific. Do not add
X-Idempotency-Key to wallet creation merely because it is a write request.Authentication failures
Errors use FossaPay’s standard response envelope. A missing key returns HTTP401:
401:
API key is required in the x-api-key header or API key is invalid or inactive.
Do not automatically retry
401, 403, or validation failures. Correct the credential, account state, ownership mapping, or request first.
Key rotation and revocation
Rotate credentials without interrupting service:- generate a new production key;
- store and deploy it through your secret-management process;
- verify authenticated reads and controlled writes with the new key;
- remove the previous key from every workload; and
- delete the previous key in the dashboard.
Operational security checklist
- Keep API calls on trusted server-side infrastructure.
- Inject keys at runtime from a secrets manager or protected environment variable.
- Redact
x-api-keyfrom application, proxy, error-tracking, and observability logs. - Restrict production-secret access to workloads and personnel that require it.
- Enable secret scanning for source repositories and deployment artifacts.
- Rotate keys after personnel, vendor, or infrastructure access changes.
- Monitor
401,403, and429rates for configuration errors or abuse. - Keep webhook signing secrets separate from API keys.
Troubleshooting
The API says the key is required
The API says the key is required
Confirm that
x-api-key reaches FossaPay. Review reverse-proxy and HTTP-client configuration for headers that may be removed before forwarding.The API says the key is invalid or inactive
The API says the key is invalid or inactive
Remove whitespace and quotation marks from the configured value, confirm that you deployed the complete production key, and check that the key still exists in the dashboard.
The request succeeds for one resource but not another
The request succeeds for one resource but not another
Confirm that the resource belongs to the merchant associated with the key. Customer, wallet, checkout, payout, and transaction access is merchant-scoped.
A write timed out after submission
A write timed out after submission
Do not assume the operation failed. For checkout and payout creation, retry the identical request with its original idempotency key or retrieve the resource using its ID or merchant reference.
Next steps
Quickstart
Authenticate and create your first customer and NGN wallet.
Customers
Understand customer validation and merchant ownership.
Checkouts
Create idempotent one-time NGN checkout sessions.
Payouts
Send funds safely from the merchant master wallet.

