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
| Field | Type | Description |
|---|---|---|
statusCode | number | HTTP status code |
message | string | Human-readable description |
code | string | Stable error code — use this in your switch statements |
Using typed error codes
Install the errors package to get autocompletion and type safety:Common errors by scenario
Authentication
| Code | HTTP | When it happens |
|---|---|---|
E_INVALID_API_KEY | 401 | API key is wrong or revoked |
E_UNAUTHORIZED | 401 | No valid token on a protected endpoint |
E_JWT_EXPIRED | 401 | JWT has expired — re-authenticate |
E_JWT_INVALID | 401 | JWT is malformed or tampered |
E_FORBIDDEN | 403 | Valid token but insufficient permissions |
Payments
| Code | HTTP | When it happens |
|---|---|---|
E_INSUFFICIENT_FUNDS | 422 | Payer’s wallet balance too low |
E_SELF_PAYMENT | 422 | Sender and recipient are the same account |
E_INVALID_AMOUNT | 422 | Amount is zero, negative, or exceeds limits |
E_MAX_AMOUNT_EXCEEDED | 422 | Above daily/transaction cap |
E_MONTHLY_LIMIT_EXCEEDED | 422 | User’s monthly transfer limit reached |
E_CREATE_PAYMENT_FAILED | 500 | Internal error creating the payment |
E_INTENTION_NOT_FOUND | 404 | The intentionId doesn’t exist or has expired |
OTP
| Code | HTTP | When it happens |
|---|---|---|
E_INVALID_OTP | 422 | Wrong OTP code entered |
E_OTP_EXPIRED | 422 | OTP has passed its validity window |
E_OTP_BLOCKED | 429 | Too many failed OTP attempts |
E_OTP_COOLDOWN | 429 | Too soon to request another OTP |
E_MAX_DAILY_ATTEMPTS | 429 | Daily OTP request limit reached |
Accounts
| Code | HTTP | When it happens |
|---|---|---|
E_ACCOUNT_NOT_FOUND | 404 | User ID or phone number not found |
E_ACCOUNT_BLOCKED | 403 | Account is temporarily suspended |
E_ACCOUNT_PERMANENTLY_BLOCKED | 403 | Account is permanently disabled |
E_ACCOUNT_NOT_ACTIVATED | 403 | Account created but not yet verified |
E_KYC_LEVEL_INSUFFICIENT | 403 | Operation requires a higher KYC tier |
Withdrawals
| Code | HTTP | When it happens |
|---|---|---|
E_WITHDRAW_INSUFFICIENT_FUNDS | 422 | Not enough balance to withdraw |
E_WITHDRAW_DAILY_LIMIT_REACHED | 422 | Daily withdrawal cap hit |
E_WITHDRAW_NOT_FOUND | 404 | Withdrawal ID doesn’t exist |
E_WITHDRAW_FORBIDDEN | 403 | Account not authorized to withdraw |
Webhooks
| Code | HTTP | When it happens |
|---|---|---|
E_INVALID_TOKEN | 401 | Webhook signature verification failed |
HTTP status codes
| Status | Meaning |
|---|---|
200 | Success |
201 | Created |
400 | Bad request (malformed body, missing fields) |
401 | Unauthenticated |
403 | Authenticated but not authorized |
404 | Resource not found |
422 | Validation error or business rule violation |
429 | Rate limit or cooldown |
500 | Internal server error — contact support if persistent |
Full error code list
All error codes are exported from@lyelpay/errors:
ErrorCodes (the object) and ErrorCode (the type). Error codes are stable API contracts — they will not be renamed or removed.
View all error codes
View all error codes