/General

Errors

Error Response Format

Every error from v2 and /v1 has the same shape: the HTTP status code, and a JSON body with an error object. param and hint appear only where they apply.

{ "error": { "code": "invalid_parameter", "message": "'date' must be a valid date in YYYY-MM-DD format.", "param": "date" } }
FieldTypeDescription
error.codestringA stable, machine-readable code from the table below.
error.messagestringWhat went wrong, for a person to read.
error.paramstringThe parameter at fault, where there is one.
error.hintstringHow to fix the request, where we can tell.

Status Codes

StatusNameDescription
200OKRequest succeeded.
400invalid_requestThe request mixes the two v1 routes: the vnd.BNM.API Accept header on a path other than /public/..., or a /public/ path without it.
400invalid_parameterA path segment or query value is malformed or not one of the allowed values; a parameter is unknown, repeated or missing. param names it.
401invalid_tokenNo API token, or one that is unknown or deleted.
404not_foundNo such endpoint, or no records for the request. A trailing slash gets a hint with the right path.
404rate_unavailableCurrency converter: no rate for that date or currency.
405method_not_allowedOnly GET and HEAD are supported.
500internal_errorSomething went wrong on our end.
503service_unavailableCurrency converter: rates could not be loaded. Retry shortly.

The Legacy Route

Requests on v1’s legacy route (/public/... with the vnd.BNM.API header) are answered as that API always has. A request for something without records gets a 404 with this body:

{ "message": "No records found.", "code": 404 }