Error Handling

HTTP Status Codes

The API uses conventional HTTP status codes to indicate success or failure.

StatusMeaningWhat to do
200 OKThe request succeededParse the response body
400 Bad RequestInvalid request parametersCheck your query parameters for typos
404 Not FoundThe dataset or endpoint doesn't existVerify the category and config name in the URL
422 Unprocessable EntityRequest validation failedFix the parameter values and retry
500 Internal Server ErrorSomething went wrong on our endWait a moment and retry; report if it persists
502 Bad GatewayData source temporarily unavailableWait and retry with exponential backoff
504 Gateway TimeoutData source took too long to respondWait and retry with exponential backoff
Error Response Format

When an error occurs, the API returns a JSON body with details:

{
  "error": {
    "code": "not_found",
    "message": "Dataset 'tea' not found for source 'unknown'",
    "link": "https://plus254.co.ke/api-docs/errors#not_found"
  }
}

Error fields

FieldTypeDescription
error.codestringMachine-readable error identifier
error.messagestringHuman-readable description of what went wrong
error.linkstringURL to detailed documentation for this error code
Error Codes
CodeHTTP StatusMeaning
not_found404The requested dataset or source doesn't exist
invalid_parameter400, 422A query parameter has an invalid value
upstream_error502, 504The data source could not be reached or responded with an error
internal_error500An unexpected error occurred on the server
Back to Quickstart