Skip to main content
All Lyel Pay API errors follow a consistent format. The code field is a stable string from the @lyelpay/errors package — it won’t change between versions, so it’s safe to key business logic on it.

Error response format

FieldTypeDescription
statusCodenumberHTTP status code
messagestringHuman-readable description
codestringStable error code — use this in your switch statements

Using typed error codes

Install the errors package to get autocompletion and type safety:
Then match errors by code:

Common errors by scenario

Authentication

CodeHTTPWhen it happens
E_INVALID_API_KEY401API key is wrong or revoked
E_UNAUTHORIZED401No valid token on a protected endpoint
E_JWT_EXPIRED401JWT has expired — re-authenticate
E_JWT_INVALID401JWT is malformed or tampered
E_FORBIDDEN403Valid token but insufficient permissions

Payments

CodeHTTPWhen it happens
E_INSUFFICIENT_FUNDS422Payer’s wallet balance too low
E_SELF_PAYMENT422Sender and recipient are the same account
E_INVALID_AMOUNT422Amount is zero, negative, or exceeds limits
E_MAX_AMOUNT_EXCEEDED422Above daily/transaction cap
E_MONTHLY_LIMIT_EXCEEDED422User’s monthly transfer limit reached
E_CREATE_PAYMENT_FAILED500Internal error creating the payment
E_INTENTION_NOT_FOUND404The intentionId doesn’t exist or has expired

OTP

CodeHTTPWhen it happens
E_INVALID_OTP422Wrong OTP code entered
E_OTP_EXPIRED422OTP has passed its validity window
E_OTP_BLOCKED429Too many failed OTP attempts
E_OTP_COOLDOWN429Too soon to request another OTP
E_MAX_DAILY_ATTEMPTS429Daily OTP request limit reached

Accounts

CodeHTTPWhen it happens
E_ACCOUNT_NOT_FOUND404User ID or phone number not found
E_ACCOUNT_BLOCKED403Account is temporarily suspended
E_ACCOUNT_PERMANENTLY_BLOCKED403Account is permanently disabled
E_ACCOUNT_NOT_ACTIVATED403Account created but not yet verified
E_KYC_LEVEL_INSUFFICIENT403Operation requires a higher KYC tier

Withdrawals

CodeHTTPWhen it happens
E_WITHDRAW_INSUFFICIENT_FUNDS422Not enough balance to withdraw
E_WITHDRAW_DAILY_LIMIT_REACHED422Daily withdrawal cap hit
E_WITHDRAW_NOT_FOUND404Withdrawal ID doesn’t exist
E_WITHDRAW_FORBIDDEN403Account not authorized to withdraw

Webhooks

CodeHTTPWhen it happens
E_INVALID_TOKEN401Webhook signature verification failed

HTTP status codes

StatusMeaning
200Success
201Created
400Bad request (malformed body, missing fields)
401Unauthenticated
403Authenticated but not authorized
404Resource not found
422Validation error or business rule violation
429Rate limit or cooldown
500Internal server error — contact support if persistent

Full error code list

All error codes are exported from @lyelpay/errors:
The package exports ErrorCodes (the object) and ErrorCode (the type). Error codes are stable API contracts — they will not be renamed or removed.