Skip to main content
All errors from the Swisstools API return a JSON body with a single error field containing a human-readable message. The HTTP status code tells you the category of the problem. There are no nested error objects or machine-readable error codes beyond the status code itself.

Error Response Shape

Every error response looks like this:
The Content-Type header is always application/json, even for error responses.

HTTP Status Codes

Example Error Responses

400 — missing required field:
401 — unauthenticated request:
404 — resource not found:
405 — wrong HTTP method:

Handling Errors in Code

Check res.ok before reading the response body. When res.ok is false, parse the JSON and surface the error string to your users or logs.