Skip to main content
FossaPay authenticates API requests with a secret API key sent in the x-api-key request header. The key identifies your merchant account and determines which customers, wallets, checkouts, payouts, and transactions the request can access.
FossaPay currently provides production access only. There is no staging or sandbox environment. Every authenticated request reaches production and can create or affect live financial resources.

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.
Production API keys use the fk_production_ prefix.

Generate and store a key

  1. Sign in to the FossaPay Dashboard.
  2. Open Settings → API Keys.
  3. Generate a production API key and complete the two-factor authentication challenge.
  4. Copy the key into a secrets manager or protected server environment.
Treat an API key like a password. Never place it in browser code, a mobile application, a public repository, a screenshot, an analytics event, or a support message.
For local server-side development, load the base URL and key from environment variables:
Do not commit .env files, and avoid commands that leave real credentials in shell history.

Authenticate a request

Send the API key in the x-api-key header on every protected endpoint:
Header names are case-insensitive, but the documentation uses x-api-key consistently. Do not add Bearer or another authentication scheme to the value.
An authenticated request returns the normal endpoint response. For example:
The returned customer data depends on the resources already owned by your merchant account.

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

The example must run on infrastructure you control. Your frontend should call your backend, and your backend should authenticate with FossaPay.

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.
Persist the FossaPay resource IDs returned to your merchant. A 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.
Apply these rules:
  • 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.
The same key and request return the original resource without creating another operation. Reusing the key with a different request returns HTTP 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 HTTP 401:
An unrecognized key also returns HTTP 401:
Some protected endpoint groups use a more specific equivalent message, such as 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:
  1. generate a new production key;
  2. store and deploy it through your secret-management process;
  3. verify authenticated reads and controlled writes with the new key;
  4. remove the previous key from every workload; and
  5. delete the previous key in the dashboard.
If a key may have been exposed, stop using it immediately, delete it in the dashboard, deploy a replacement, and review request and transaction activity for unexpected operations.

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-key from 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, and 429 rates for configuration errors or abuse.
  • Keep webhook signing secrets separate from API keys.

Troubleshooting

Confirm that x-api-key reaches FossaPay. Review reverse-proxy and HTTP-client configuration for headers that may be removed before forwarding.
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.
Confirm that the resource belongs to the merchant associated with the key. Customer, wallet, checkout, payout, and transaction access is merchant-scoped.
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.