Resources
API Status Codes - HTTP Error Handling Reference
Master Statum API status codes (200, 401, 500). Learn to troubleshoot errors and handle responses for M-Pesa, Airtime, and SMS integrations like a pro.
Mastering API status codes is essential for building resilient applications. Statum APIs leverage standard HTTP response codes (RFC 2616) to communicate the outcome of every transaction. This guide provides a detailed breakdown of success, client-side errors, and server-side issues to help you troubleshoot and optimize your integration.
HTTP Status Code Reference
Understanding these codes helps you debug integrations faster. We recommend logging the status_code
from every API response for audit trails.
| Status Code | Meaning & Context | Recommended Action |
|---|---|---|
| 200 OK | Request Successful | Proceed with processing the response payload. |
| 401 | Authentication Failed | Verify your Base64 encoded credentials in the header. |
| 402 | Insufficient Funds | Top up your wallet balance on the developer dashboard. |
| 422 | Validation Error | Check required fields (e.g., phone number format). |
| 429 | Too Many Requests | Ease off your request rate and implement backoff. |
| 500 | Server Error | Possible gateway issue. Retry after 5-10 seconds. |
Handling Errors: For production apps, we recommend using a
switch statement or
mapping table to provide user-friendly error messages based on these codes.