Response Envelope
Success — single resource
{
"success": true,
"status": 200,
"message": "Card retrieved",
"data": {
"cardId": "crd_01HXYZ5555ABCDEF1111",
"status": "ACTIVE"
},
"meta": {
"requestId": "req_01HXY123456ABCDEF",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
Success — paginated list
{
"success": true,
"status": 200,
"message": "Cards retrieved",
"data": [ ... ],
"pagination": {
"total": 47,
"limit": 20,
"offset": 0,
"hasMore": true
},
"meta": {
"requestId": "req_01HXY123456ABCDEF",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
Error
{
"success": false,
"status": 422,
"message": "Amount must be greater than zero",
"error": {
"code": "INVALID_AMOUNT",
"detail": "The amount field must be a positive integer representing cents"
},
"meta": {
"requestId": "req_01HXY123456ABCDEF",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
Validation error (multiple fields)
When a request fails validation, theerror object includes a fields array:
{
"success": false,
"status": 422,
"message": "Validation failed",
"error": {
"code": "VALIDATION_ERROR",
"detail": "One or more request fields are invalid",
"fields": [
{
"field": "dateOfBirth",
"message": "dateOfBirth must be in YYYY-MM-DD format"
},
{
"field": "email",
"message": "email must be a valid email address"
}
]
},
"meta": {
"requestId": "req_01HXY123456ABCDEF",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
Envelope Fields
| Field | Always present | Description |
|---|---|---|
success | Yes | true for 2xx responses, false for 4xx/5xx |
status | Yes | HTTP status code, mirrored in the body for convenience |
message | Yes | Human-readable summary of the result or error |
data | On success | The resource or array of resources |
pagination | On list success | total, limit, offset, hasMore |
error | On failure | code (machine-readable) + detail (human-readable) + optional fields array |
meta | Yes | requestId, platform, timestamp |
Use
error.code in your switch statements for programmatic handling. Use message for displaying to end-users. Use meta.requestId when contacting support.HTTP Status Codes
| Status | When it is returned |
|---|---|
200 OK | Request succeeded. Resource returned or operation applied. |
201 Created | Resource created successfully. |
400 Bad Request | Invalid JSON body or a structurally malformed request. |
401 Unauthorized | API key missing, invalid, revoked, or expired. |
403 Forbidden | IP not in allowlist, business suspended or closed, key lacks the required scope, or an unpaid invoice made the API read-only. |
404 Not Found | Resource does not exist or does not belong to your business/environment. |
409 Conflict | Resource state conflict (e.g. card already frozen, or a request with the same idempotency key still being processed). |
422 Unprocessable Entity | Request was understood but failed business validation rules. |
429 Too Many Requests | Rate limit exceeded. |
500 Internal Server Error | Unexpected error on FYATU’s end. |
502 Bad Gateway | The card issuer returned something we could not use. Retry. |
503 Service Unavailable | A dependency, usually the card issuer, is briefly unavailable, or the operation is paused. Nothing was executed; retry. |
Error Code Catalogue
Every code below is one the API returns today. Branch onerror.code, never on message: messages
are written for people and may be reworded.
Authentication and access
| Code | HTTP | Meaning |
|---|---|---|
AUTH_TOKEN_MISSING | 401 | No key in Authorization: Bearer or X-API-Key |
AUTH_TOKEN_INVALID | 401 | The key does not exist |
KEY_REVOKED | 401 | The key was revoked |
KEY_EXPIRED | 401 | The key passed its expiry date |
IP_NOT_ALLOWED | 403 | The request came from an address outside the key’s allowlist |
INSUFFICIENT_SCOPE | 403 | The key lacks the scope this endpoint needs; detail names it |
BUSINESS_SUSPENDED | 403 | Your business account is suspended |
BUSINESS_CLOSED | 403 | Your business account is closed |
BUSINESS_KYB_REQUIRED | 403 | Cards cannot be issued until your company verification is approved |
PROGRAM_BILLING_SUSPENDED | 403 | An unpaid invoice has made the API read-only until it is settled |
RATE_LIMIT_EXCEEDED | 429 | Your business sent more requests in one second than its limit. Retry after Retry-After seconds |
Request
| Code | HTTP | Meaning |
|---|---|---|
INVALID_BODY | 400 | The body is not valid JSON |
INVALID_REQUEST | 400 | A required field is missing or the request is malformed; message says which |
VALIDATION_ERROR | 400 / 422 | One or more fields failed validation; see error.fields |
INVALID_AMOUNT | 400 | The amount is zero, negative, or above your account’s load cap |
CONFIRMATION_REQUIRED | 400 | Termination needs "confirm": "TERMINATE_CARD" in the body |
DATE_RANGE_TOO_WIDE | 422 | A date range longer than 92 days |
IDEMPOTENCY_KEY_TOO_LONG | 422 | Idempotency-Key is longer than 255 characters |
IDEMPOTENCY_KEY_REUSED | 422 | This Idempotency-Key was used for a different request. Nothing was executed; use a new key |
IDEMPOTENCY_IN_PROGRESS | 409 | A request with this Idempotency-Key is still running. Nothing was executed; retry after Retry-After seconds to get its result |
DUPLICATE_OPERATION | 409 | The same operation is already in progress; wait before retrying |
Your account and BINs
| Code | HTTP | Meaning |
|---|---|---|
PROGRAM_NOT_FOUND | 404 | Your account has no active program for this request |
PROGRAM_INACTIVE | 422 | Your account is not active for issuing |
PRODUCT_NOT_FOUND | 404 | The productId sent is not on your account (integrations that issue by productId) |
PRODUCT_INACTIVE | 422 | Issuing on this BIN is not active on your account |
BIN_NOT_FOUND | 404 | No such BIN |
BIN_NOT_AVAILABLE | 404 / 422 | The BIN is not available on your account. Copy the BIN ID from the BIN’s page in your dashboard |
BIN_NOT_ISSUABLE | 409 | The BIN is not open for issuing |
Cardholders and verification
| Code | HTTP | Meaning |
|---|---|---|
CARDHOLDER_NOT_FOUND | 404 | No such cardholder on your account |
CARDHOLDER_EMAIL_EXISTS | 409 | Another cardholder in this environment has this email |
CARDHOLDER_UNDER_AGE | 422 | Cardholders must be at least 18 |
CARDHOLDER_INVALID_GENDER | 422 | gender must be MALE or FEMALE |
CARDHOLDER_INACTIVE | 422 | The cardholder is not active |
CARDHOLDER_TERMINATED | 409 / 422 | The cardholder is terminated and cannot be changed |
ALREADY_SUSPENDED | 409 | The cardholder is already suspended |
ALREADY_ACTIVE | 409 | The cardholder is already active |
KYC_FIELD_LOCKED | 409 | The field cannot change after KYC approval; message names it |
KYC_ALREADY_APPROVED | 409 | The cardholder is already approved |
KYC_DOCUMENT_INVALID | 422 | The identity document was refused; message says why |
KYC_NOT_APPROVED | 409 | The cardholder has not completed verification here yet |
KYC_IMPORT_ALREADY_REDEEMED | 409 | This verification has already been imported |
DELEGATED_KYC_USE_DOCUMENTS | 403 | On Delegated KYC you verify your own cardholders: submit their documents instead of a verification link |
CARDHOLDER_COUNTRY_RESTRICTED | 422 | The cardholder’s document country is not eligible for this BIN; message names it |
CARDHOLDER_CARD_LIMIT_EXCEEDED | 409 | The cardholder already holds the most active cards this BIN allows per cardholder |
Cards
| Code | HTTP | Meaning |
|---|---|---|
CARD_ID_INVALID | 400 | The id in the path is not a card id (a number, null, undefined). Use the id returned when the card was created |
CARD_NOT_FOUND | 404 | No such card on your account |
CARDHOLDER_KYC_NOT_APPROVED | 422 | A card can only be issued to a cardholder whose kycStatus is APPROVED |
KYC_DOCUMENT_REQUIRED | 422 | The cardholder holds no identity document; submit one before issuing |
CARD_AMOUNT_REQUIRED | 400 | amount, the card’s opening load, is required |
CARD_PROVISIONING / CARD_PROVISIONING_PENDING | 409 | The card is still being created; retry shortly |
CARD_NOT_PROVISIONED | 409 | The card was never provisioned at the issuer |
CARD_ALREADY_FROZEN | 409 | The card is already frozen |
CARD_NOT_FROZEN | 409 | The card is not frozen, so it cannot be unfrozen |
CARD_FROZEN_CANNOT_FUND | 422 | A frozen card cannot be funded |
CARD_NOT_RELOADABLE | 422 | The card’s BIN does not allow reloading |
CARD_EXPIRED | 422 | The card has expired |
CARD_TERMINATED | 422 | The card is already terminated |
CARD_TOO_NEW_TO_TERMINATE | 422 | A card cannot be terminated in the first hour after it was created |
CARD_HAS_PENDING_TRANSACTIONS | 409 | Pending authorisations must clear before termination |
CARD_STATE_CHANGE_REFUSED | 422 / 503 | The issuer refused a freeze or unfreeze. The card is unchanged; on 503, retry shortly |
CARD_TERMINATION_REFUSED | 422 / 503 | The issuer refused to close the card. The card is unchanged and still active; on 503, retry shortly |
CARD_STATUS_CONFLICT | 409 | Another status change is in progress; retry |
CARD_LIMITS_UNSUPPORTED | 422 | Spending limits cannot be set on this card |
NO_LIMITS_PROVIDED | 400 | Provide at least one of daily, monthly or perTransaction above 0 |
CARD_DETAILS_UNAVAILABLE | 503 | The card details could not be fetched right now; retry |
REFERENCE_ALREADY_FAILED | 409 | A fund or unload reference already resolved to FAILED. References are single-use: send a new one to retry |
CARD_CREATION_UNAVAILABLE | 503 | Card creation is paused or briefly unavailable. Nothing was charged; retry later |
CARD_FUNDING_UNAVAILABLE | 503 | Card funding is paused or briefly unavailable. Nothing was moved; retry later |
CARD_WITHDRAWAL_UNAVAILABLE | 503 | Unloading is paused or briefly unavailable. Nothing was moved; retry later |
PROVIDER_CREATE_FAILED | 422 / 503 | The issuer could not create the card; message says why. Nothing was charged |
PROVIDER_FUND_FAILED | 422 | The issuer refused the funding; message says why |
PROVIDER_LIMITS_UPDATE_FAILED | 422 | The issuer refused the limit change |
PROVIDER_UNAVAILABLE | 503 | The issuer is briefly unreachable; retry |
PROVIDER_ERROR | 500 / 502 | The issuer’s transaction data could not be read; retry |
RESTRICTION_LIST_UNAVAILABLE | 503 | The merchant category restrictions could not be read |
Balances and transactions
| Code | HTTP | Meaning |
|---|---|---|
INSUFFICIENT_PROGRAM_BALANCE | 422 | Your balance is too low to fund the card |
INSUFFICIENT_CARD_BALANCE | 422 | The card holds less than the amount to unload |
TRANSACTION_NOT_FOUND | 404 | No such transaction on your account |
Webhooks
| Code | HTTP | Meaning |
|---|---|---|
WEBHOOK_NOT_FOUND | 404 | No such webhook on your account |
WEBHOOK_LIMIT_REACHED | 422 | 10 webhook endpoints per business, at most |
WEBHOOK_HTTPS_REQUIRED | 422 | A live webhook URL must use HTTPS |
WEBHOOK_URL_BLOCKED | 422 | The URL resolves to a private or internal address |
INVALID_URL | 422 | The URL is not a valid https:// URL with a host |
INVALID_EVENT_TYPE | 422 | An entry in events is not an event we send |
Server
| Code | HTTP | Meaning |
|---|---|---|
SERVICE_UNAVAILABLE | 503 | A dependency is briefly unavailable; retry |
INTERNAL_ERROR | 500 | Something failed on our side. Contact support with meta.requestId |
Retry Strategy
Retry429, 5xx, and the 409s that mean “not yet”. Every other 4xx is a problem with the
request: retrying it unchanged will fail the same way.
| Response | Retry? | What to do |
|---|---|---|
200 / 201 | — | Done |
429 RATE_LIMIT_EXCEEDED | Yes | Wait Retry-After seconds |
409 IDEMPOTENCY_IN_PROGRESS, CARD_PROVISIONING, CARD_PROVISIONING_PENDING, CARD_STATUS_CONFLICT, DUPLICATE_OPERATION | Yes | Wait a moment (Retry-After when present) and retry |
5xx | Yes | Exponential backoff, up to 4 attempts |
Any other 4xx | No | Fix the request |
Retry a
POST with the same Idempotency-Key it was first sent with. That is what makes a
retry after a timeout or a 5xx safe: if the first attempt did go through, you get its result
back instead of a second card, a second funding or a second charge.Node.js — retry helper
async function withRetry(fn, maxAttempts = 4) {
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
const res = await fn();
const body = await res.clone().json();
if (res.ok) return body;
const notYet = ['IDEMPOTENCY_IN_PROGRESS', 'CARD_PROVISIONING', 'CARD_PROVISIONING_PENDING',
'CARD_STATUS_CONFLICT', 'DUPLICATE_OPERATION'].includes(body.error?.code);
const isRetryable = res.status === 429 || res.status >= 500 || notYet;
if (!isRetryable || attempt === maxAttempts) {
throw Object.assign(new Error(body.message), {
code: body.error?.code,
requestId: body.meta?.requestId,
status: res.status,
});
}
// Retry-After (seconds) when the API sends one, exponential backoff otherwise
const retryAfter = Number(res.headers.get('Retry-After'));
const waitMs = retryAfter > 0 ? retryAfter * 1000 : Math.min(2 ** attempt * 500, 30000);
await new Promise(r => setTimeout(r, waitMs));
}
}
Python — retry helper
import time, os, requests
def with_retry(fn, max_attempts=4):
for attempt in range(1, max_attempts + 1):
resp = fn()
body = resp.json()
if resp.ok:
return body
not_yet = body.get('error', {}).get('code') in (
'IDEMPOTENCY_IN_PROGRESS', 'CARD_PROVISIONING', 'CARD_PROVISIONING_PENDING',
'CARD_STATUS_CONFLICT', 'DUPLICATE_OPERATION')
retryable = resp.status_code == 429 or resp.status_code >= 500 or not_yet
if not retryable or attempt == max_attempts:
raise RuntimeError(
f"[{body.get('error', {}).get('code', 'UNKNOWN')}] "
f"{body.get('message')} "
f"(requestId: {body.get('meta', {}).get('requestId')})"
)
retry_after = resp.headers.get('Retry-After')
wait = int(retry_after) if retry_after else min(2 ** attempt * 0.5, 30)
time.sleep(wait)
Error Handling Patterns
Inspect error.code for programmatic handling
Node.js
async function issueCard(payload) {
const res = await fetch('https://api.fyatu.com/api/v3.20/cards', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.FYATU_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
});
const body = await res.json();
if (!body.success) {
switch (body.error?.code) {
case 'CARDHOLDER_KYC_NOT_APPROVED':
throw new Error('Cardholder KYC is still pending — wait for CARDHOLDER_KYC_APPROVED webhook');
case 'INSUFFICIENT_PROGRAM_BALANCE':
throw new Error('Top up your balance before issuing cards');
case 'INSUFFICIENT_SCOPE':
throw new Error('API key is missing the cards:write scope');
case 'RATE_LIMIT_EXCEEDED':
throw Object.assign(new Error('Rate limited'), { retryAfter: Number(res.headers.get('Retry-After')) });
default:
throw new Error(`${body.error?.code}: ${body.message} (requestId: ${body.meta?.requestId})`);
}
}
return body.data;
}
Python
def issue_card(payload):
resp = requests.post(
'https://api.fyatu.com/api/v3.20/cards',
headers={'Authorization': f'Bearer {os.environ["FYATU_API_KEY"]}'},
json=payload,
)
body = resp.json()
if not body['success']:
code = body.get('error', {}).get('code', 'UNKNOWN')
message = body.get('message', '')
requestId = body.get('meta', {}).get('requestId', '')
raise RuntimeError(f'{code}: {message} (requestId: {requestId})')
return body['data']
Using meta.requestId for Support
Every response — success or error — includes a meta.requestId. This ID uniquely identifies the request in FYATU’s systems and allows the support team to trace exactly what happened.
When contacting support about an unexpected error, always include:
- The
meta.requestIdfrom the failing response - The HTTP status code
- The
error.codevalue
Hi FYATU support,
I'm getting an unexpected 500 INTERNAL_ERROR on POST /cards.
requestId: req_01HXY123456ABCDEF
Common Errors by Scenario
Issuing a card — cardholder KYC not yet approved
Error
{
"success": false,
"status": 422,
"message": "Cardholder KYC is not approved",
"error": {
"code": "CARDHOLDER_KYC_NOT_APPROVED",
"detail": "Cardholder KYC is not approved"
},
"meta": {
"requestId": "req_01HXY...",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
CARDHOLDER_KYC_APPROVED webhook. Issue the card only after the event fires.
Funding a card with an insufficient balance
Error
{
"success": false,
"status": 422,
"message": "Insufficient program balance",
"error": {
"code": "INSUFFICIENT_PROGRAM_BALANCE",
"detail": "Insufficient program balance"
},
"meta": {
"requestId": "req_01HXY...",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
Terminating a card with pending transactions
Error
{
"success": false,
"status": 409,
"message": "Card has pending transactions and cannot be terminated",
"error": {
"code": "CARD_HAS_PENDING_TRANSACTIONS",
"detail": "Card has pending transactions and cannot be terminated"
},
"meta": {
"requestId": "req_01HXY...",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
Missing termination confirmation
Error
{
"success": false,
"status": 400,
"message": "confirm must be \"TERMINATE_CARD\"",
"error": {
"code": "CONFIRMATION_REQUIRED",
"detail": "confirm must be \"TERMINATE_CARD\""
},
"meta": {
"requestId": "req_01HXY...",
"platform": "Fyatu CaaS",
"timestamp": "2026-05-22T10:00:00Z"
}
}
"confirm": "TERMINATE_CARD" in the request body.
