Error Codes
These HTTP / response_code values apply to all Peleza API calls, not a single endpoint. Use status together with message and request_id when handling errors.
Response envelope
Typical shape:
{
"success": false,
"response_code": 400,
"message": "Human-readable status message",
"errors": {
"field_name": "Validation message for this field"
},
"data": null,
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}successβ whether the call succeededresponse_codeβ application code (usually mirrors HTTP)messageβ human-readable statuserrorsβ optional field-level validation map (400)dataβ payload on success; usuallynullon errorrequest_idβ UUID for support and audit (always log this)countryβ present on country-scoped routes (e.g./id/ke)
Status codes (all APIs)
Expected codes for every Peleza API request. Validation field names and message text vary by endpoint; the codes and billing rules do not.
* 200 is billed only on paid verification / lookup routes (e.g. National ID). Free routes such as OAuth token, token validate, and wallet balance are not billed on success.
OAuth / authentication errors
Token lifetime is TOKEN_TTL_SECONDS (currently 360 seconds). On 401 from a protected route, request a new token from POST /api/v1/oauth/token.
Billing behaviour
- Debit runs after the response for HTTP
2xxand404when the verification path completed (aligned with Merchant wallet middleware). - Validation
400and auth/wallet401/402/403are not billed. - Upstream
408/502/503and rate limit429are not billed. - Unsupported-country
404is not billed. - KES wallets on VAT-enabled tenants may include VAT in the debit total; non-KES currencies skip VAT.
Sample error payloads
Illustrative payloads (field names / messages differ by endpoint):
400 β validation
{
"success": false,
"response_code": 400,
"message": "The scope field is required",
"country": "ke",
"errors": {
"scope": "The scope field is required"
},
"data": null,
"request_id": "550e8400-e29b-41d4-a716-446655440010"
}401 β unauthorized
{
"success": false,
"response_code": 401,
"message": "Unauthorized. Please provide a valid access token.",
"data": null,
"request_id": "550e8400-e29b-41d4-a716-446655440011"
}402 β insufficient funds
{
"success": false,
"response_code": 402,
"message": "Insufficient wallet balance. Please top up.",
"data": null,
"request_id": "550e8400-e29b-41d4-a716-446655440012"
}404 β not found
{
"success": false,
"response_code": 404,
"message": "Kenya ID not found",
"description": "There is no information for requested search parameters",
"country": "ke",
"data": null,
"request_id": "550e8400-e29b-41d4-a716-446655440013"
}408 β upstream timeout
{
"success": false,
"response_code": 408,
"message": "Verification service temporarily unavailable",
"country": "ke",
"data": null,
"request_id": "550e8400-e29b-41d4-a716-446655440014"
}