Skip to content
FlatCryptoPay
Docs: Errors and rate limits

API

Errors and rate limits

Error object format, HTTP status codes, error codes and how to handle rate limits and retries safely.

Errors use conventional HTTP status codes and a consistent JSON body. Your code should branch on error.code, not on the human-readable message.

Error body
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_amount",
    "message": "amount must be a positive decimal with at most 2 decimals, e.g. \"25.00\"."
  }
}

Status codes

StatusMeaning
200 / 201Success / created.
400Invalid parameters or JSON.
401Missing, malformed or revoked API key.
403Account suspended, or action not allowed (for example simulating a live invoice).
404Object not found, or it belongs to the other mode (live vs test).
409Conflict with the current state (for example canceling a paid invoice).
413Request body too large (32 KB limit).
429Rate limited. Back off and retry.
500 / 502 / 503Temporary problem on our side or with an upstream data source. Safe to retry with the same Idempotency-Key.

Common error codes

CodeFix
invalid_api_keyCheck the Authorization header format and that the key is not revoked.
invalid_amountSend a positive decimal string with at most 2 decimals.
unsupported_currencyUse USD, EUR, GBP, CAD or AUD.
invalid_urlredirect_url and cancel_url must be public https URLs.
invalid_metadataMax 20 keys, key length 40, value length 500.
invalid_idempotency_key1-128 characters from [A-Za-z0-9._:-].
invoice_not_openThe invoice is already paid, expired or canceled.
rate_limitedWait a few seconds; use exponential backoff.
rates_unavailableExchange rates could not be fetched. Retry shortly.

Retrying safely

Network errors and 5xx responses can be retried. When creating invoices, always send the same Idempotency-Key on retries so you never create duplicates. Use exponential backoff starting at 1 second, capped at about 30 seconds.

Start free: no fees, no documents