Skip to content

Errors

v2 error responses use a consistent JSON envelope with an error object.

Error Response

json
{
  "error": {
    "code": "PROVINCE_NOT_FOUND",
    "message": "Province not found.",
    "status": 404
  }
}
FieldTypeDescription
error.codestringStable machine-readable error code
error.messagestringHuman-readable error message
error.statusintegerHTTP status code

HTTP Status Codes

StatusMeaning
400Request validation failed
404Route or requested resource was not found
429Rate limit exceeded
500Unexpected server error

Cacheable GET /v2/* responses can return 304 Not Modified when the client sends a matching If-None-Match header. 304 responses do not use the error envelope.

Common Error Codes

CodeStatusWhen it happens
BAD_REQUEST400Query or path parameter validation fails
INVALID_FIELDS400fields contains an unknown field for the requested resource
INVALID_INCLUDE400include contains an unsupported relation
ROUTE_NOT_FOUND404The requested route does not exist
DATASET_NOT_FOUND404Dataset file or version does not exist
PROVINCE_NOT_FOUND404The requested province does not exist
DISTRICT_NOT_FOUND404The requested district does not exist
MUNICIPALITY_NOT_FOUND404The requested municipality does not exist
NEIGHBORHOOD_NOT_FOUND404The requested neighborhood does not exist
VILLAGE_NOT_FOUND404The requested village does not exist
INTERNAL_SERVER_ERROR500Unexpected server error

Validation Errors

Validation errors are returned as 400 Bad Request. They can occur when:

  • A path parameter is not a positive integer.
  • limit is lower than 1 or greater than 1000.
  • offset is lower than 0.
  • sort is not one of the supported sort values.
  • fields contains an unknown field.
  • include contains an unknown relation.
  • A typed query parameter does not match the OpenAPI schema.

Not Found Errors

Resource endpoints return resource-specific 404 codes:

json
{
  "error": {
    "code": "DISTRICT_NOT_FOUND",
    "message": "District not found.",
    "status": 404
  }
}

Unknown routes return:

json
{
  "error": {
    "code": "ROUTE_NOT_FOUND",
    "message": "Route not found.",
    "status": 404
  }
}