/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"
}
}| Field | Type | Description |
|---|---|---|
error.code | string | A stable, machine-readable code from the table below. |
error.message | string | What went wrong, for a person to read. |
error.param | string | The parameter at fault, where there is one. |
error.hint | string | How to fix the request, where we can tell. |
Status Codes
| Status | Name | Description |
|---|---|---|
200 | OK | Request succeeded. |
400 | invalid_request | The request mixes the two v1 routes: the vnd.BNM.API Accept header on a path other than /public/..., or a /public/ path without it. |
400 | invalid_parameter | A path segment or query value is malformed or not one of the allowed values; a parameter is unknown, repeated or missing. param names it. |
401 | invalid_token | No API token, or one that is unknown or deleted. |
404 | not_found | No such endpoint, or no records for the request. A trailing slash gets a hint with the right path. |
404 | rate_unavailable | Currency converter: no rate for that date or currency. |
405 | method_not_allowed | Only GET and HEAD are supported. |
500 | internal_error | Something went wrong on our end. |
503 | service_unavailable | Currency 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
}