Core concepts

Errors

The error shape, HTTP statuses, and the stable codes your program can switch on.

A failed request answers with an HTTP status outside 2xx and one error object. The code never changes once published, so build your logic on it. The message is written for a person and is safe to show, but its wording may be improved over time.

The error shape

422 answer
{
  "error": {
    "code": "LINK_NOT_OPEN",
    "message": "This link can no longer be paid, so it was not sent."
  },
  "requestId": "5b0f0f6e-2c1d-4b63-a7de-0d9a51c2e7f4",
  "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
error.codestring
A stable, upper-case code. Switch on this.
error.messagestring
One sentence a person can read.
error.detailsobjectOptional
Extra facts for some codes. For VALIDATION_FAILED it holds fields: each bad field with the reasons it was refused.
requestIdstring
Quote this when asking for help with a request.
traceIdstring
A second identifier used when following a request across systems.

Validation errors

When the body or the query is wrong, nothing is carried out and details.fields tells you exactly which fields to fix. Nested fields use a dotted path, such as lines.0.quantity.

400 answer
{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "title must be longer than or equal to 3 characters",
    "details": {
      "fields": {
        "title": [
          "title must be longer than or equal to 3 characters"
        ],
        "colour": [
          "This field is not allowed"
        ]
      }
    }
  },
  "requestId": "5b0f0f6e-…"
}

HTTP statuses

StatusMeaningRetry?
200, 201, 202Done. The result is in data.No need
400The request is malformed. Code VALIDATION_FAILED.No. Fix the request.
401The API key is missing, wrong, revoked or expired.No. Fix the key.
403The key is not allowed to do this. PERMISSION_REQUIRED or API_KEY_NOT_ALLOWED.No. Change the key’s permissions.
404There is no such record in your organisation. Code NOT_FOUND.No
409It clashes with something that exists or is under way, for example IDEMPOTENCY_IN_PROGRESS or DUPLICATE.Sometimes. See the code.
422The request is well formed but a business rule refuses it. The code says which rule.No. The message says what to change.
429Too many requests. Code TOO_MANY_REQUESTS.Yes, after a pause.
500A fault on our side. Code INTERNAL.Yes, with the same Idempotency-Key.
502A bank or mobile money provider could not be reached.Yes, with the same Idempotency-Key.

Codes you will meet everywhere

CodeStatusMeaning
VALIDATION_FAILED400A field is missing, the wrong type, out of range, or not one the endpoint knows.
API_KEY_INVALID401The key is wrong, revoked or expired.
PERMISSION_REQUIRED403The key does not hold the permission the endpoint needs.
API_KEY_NOT_ALLOWED403The endpoint is for a signed-in person, not for keys.
NOT_FOUND404No such record, or it belongs to another organisation.
DUPLICATE409A record with the same unique value already exists.
IDEMPOTENCY_IN_PROGRESS409The same request is still running. Try again shortly.
IDEMPOTENCY_KEY_REUSED422The key was used before for a different request.
TOO_MANY_REQUESTS429Slow down. See Limits.
INTERNAL500Something went wrong on our side. It has been logged with your requestId.

Codes that belong to one feature, such as LINK_PAID or LINK_NOT_OPEN, are listed on that feature's page.

Handling errors well

  • Switch on the code, show the message. Never compare against message text.
  • Treat an unknown code by its status. New codes are added as features grow; a 4xx you do not recognise is still "do not retry, tell a person".
  • Retry only 409 in-progress, 429 and 5xx, with growing pauses and the same Idempotency-Key.
  • Log requestId with every failure.

© 2026 Rading Technologies Limited. RadiPay never asks for your M-Pesa PIN, by email, SMS or through the API. Terms · Privacy