Peleza β€” Trust built on data
Technical References
On this page

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:

Sample dataEnvelope
{
  "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 succeeded
  • response_code β€” application code (usually mirrors HTTP)
  • message β€” human-readable status
  • errors β€” optional field-level validation map (400)
  • data β€” payload on success; usually null on error
  • request_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.

HTTP / response_codeWhenBilled?
200Request succeeded β€” details returnedYes*
400Validation β€” missing or invalid request fieldsNo
401Missing or invalid Bearer tokenNo
402Insufficient wallet balance or credit limitNo
403No active wallet or billing profile (or service not enabled)No
404Resource not found after verification completed β€” or unsupported countryYes (found path completed) / No (unsupported country)
408Upstream timeout / service errorNo
429Rate limitedNo
502Upstream bad or unreadable responseNo
503Upstream connection unavailableNo

* 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

HTTPWhen
400Invalid JSON body, or missing grant_type / client_id / client_secret
401Invalid client credentials on /oauth/token, or expired/invalid Bearer on protected routes

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 2xx and 404 when the verification path completed (aligned with Merchant wallet middleware).
  • Validation 400 and auth/wallet 401 / 402 / 403 are not billed.
  • Upstream 408 / 502 / 503 and rate limit 429 are not billed.
  • Unsupported-country 404 is 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

400Sample data400 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

401Sample data401 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

402Sample data402 Payment required
{
  "success": false,
  "response_code": 402,
  "message": "Insufficient wallet balance. Please top up.",
  "data": null,
  "request_id": "550e8400-e29b-41d4-a716-446655440012"
}

404 β€” not found

404Sample data404 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

408Sample data408 Timeout
{
  "success": false,
  "response_code": 408,
  "message": "Verification service temporarily unavailable",
  "country": "ke",
  "data": null,
  "request_id": "550e8400-e29b-41d4-a716-446655440014"
}