Skip to Content

Errors

Errors are returned as JSON with a detail field (standard FastAPI shape):

{ "detail": "Insufficient balance. Need KES 25.00, have KES 10.00." }

The one exception is the generic 500 handler, which returns:

{ "error": "Internal server error", "status_code": 500 }

Status codes

CodeMeaning
400Bad request — validation failure, malformed input
401Missing/invalid credentials, or an expired/invalid token
402Insufficient wallet balance for the requested send
403Authenticated, but not permitted (e.g. non-admin calling an admin route, suspended account)
404Resource not found, or not owned by the authenticated user
409Conflict — duplicate email, phone number, or Sender ID request
429Too many incorrect verification-code attempts
500Unexpected server error

A 401 on a suspended account includes an X-Error-Code: account_suspended response header so clients can distinguish “suspended” from “session expired” and show the right message.

Last updated on