Skip to content
Alpha — Headcode is currently in alpha. APIs and data may change without notice.

API errors

Headcode APIs return errors using RFC 9457 Problem Details for HTTP APIs.

Error responses use the application/problem+json media type and include a stable Headcode error code extension.

{
"type": "https://docs.headcode.dev/errors/stations/not-found",
"title": "Station Not Found",
"status": 404,
"detail": "No station found for identifier 'XYZ'.",
"code": "HEADCODE.STATIONS.NOT_FOUND"
}
FieldRequiredDescription
typeYesURI identifying the problem type. Headcode-specific problem types resolve to pages in this catalogue.
titleYesShort human-readable summary of the problem type.
statusYesHTTP status code for this occurrence.
detailUsuallyHuman-readable detail specific to this occurrence.
instanceNoURI identifying this specific occurrence, if available.
codeYesStable Headcode error code intended for logging, support, and client handling.
errorsNoAdditional granular error details, usually for invalid parameters, headers, or request bodies.

Some problems include an errors array to identify specific request parts.

{
"type": "https://docs.headcode.dev/errors/general/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "One or more request parameters are invalid.",
"code": "HEADCODE.GENERAL.BAD_REQUEST",
"errors": [
{
"detail": "Both 'lat' and 'lng' must be provided together.",
"parameter": "lat",
"code": "HEADCODE.STATIONS.SEARCH.COORDINATE_PAIR_REQUIRED"
}
]
}
FieldRequiredDescription
detailYesGranular description of the specific issue.
pointerNoJSON Pointer to a request body property.
parameterNoQuery or path parameter that caused the issue.
headerNoHeader that caused the issue.
codeNoAdditional provider-specific code for the error context.