RafikiSMSRafikiSMS API

Errors

The RafikiSMS API uses standard HTTP status codes. Error responses include a JSON body with details about what went wrong.

Error Response Format

{
  "status": "error",
  "message": "Error message description",
  "errors": {
    "field_name": ["Error message for this field"]
  }
}

HTTP Status Codes

Status CodeDescription
400Bad Request --- Invalid parameters or malformed request
401Unauthorized --- Missing or invalid API key / token
403Forbidden --- Insufficient permissions
404Not Found --- Resource does not exist
422Unprocessable Entity --- Validation errors
429Too Many Requests --- Rate limit exceeded
500Internal Server Error --- Server error occurred

Validation Errors (422)

When validation fails, the response includes an errors object with field-specific messages:

{
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "phone": ["The phone field is required."],
    "message": ["The message must not exceed 160 characters."]
  }
}

Always check the HTTP status code and handle errors gracefully. Implement retry logic with exponential backoff for transient errors (5xx) and rate limits (429).