Skip to content

Error Handling

The Inshuwa API uses standard HTTP response status codes to indicate whether a request succeeded or failed.

Response Format

All error responses return a JSON body:

json
{
  "status": 400,
  "message": "Validation failed",
  "errors": {
    "firstName": ["The firstName field is required."],
    "phoneNumber": ["The phoneNumber field is required."]
  }
}

Client Error Responses (4xx)

CodeNameDescription
400Bad RequestThe request was malformed or missing required fields
401UnauthorizedMissing or invalid API key
403ForbiddenYou do not have permission to access this resource
404Not FoundThe requested resource does not exist
409ConflictThe request conflicts with existing data (e.g., duplicate registration number)
422Unprocessable EntityThe request was well-formed but contains semantic errors
429Too Many RequestsRate limit exceeded

Server Error Responses (5xx)

CodeNameDescription
500Internal Server ErrorAn unexpected error occurred on the server
502Bad GatewayThe server received an invalid response from an upstream service
503Service UnavailableThe server is temporarily unavailable
504Gateway TimeoutThe upstream service did not respond in time

Best Practices

  • Always check the HTTP status code before processing the response body
  • Implement retry logic with exponential backoff for 5xx errors
  • Log error responses including the message field for debugging
  • For 401 errors, verify your API key is correct and included in the header

Built with ❤️ by Hobbiton Technologies