Skip to main content

Error handling

The Lochting API uses standard HTTP status codes. Many error responses include a JSON body with a message field describing what went wrong. Some endpoints, including authentication failures, return a plain JSON string instead.

Common status codes

CodeMeaning
400Bad Request — invalid input or business rule violation
401Unauthorized — missing, invalid, or expired token, or insufficient API key scope
404Not Found — the requested resource does not exist or is not accessible for your branch
201Created — resource successfully created
202Accepted — request accepted for asynchronous processing (e.g. stock import)

Examples

Resource not found:

{
"message": "Order not found: order-c7d932c1-84e8-410c-a9b2-18bf739d6b8b"
}

Missing API key on token request:

400 Bad Request. `apiKey` not provided.

Invalid scope or token:

"Not authorized"

Business rule violation:

{
"message": "Invalid reservation"
}

Some endpoints document additional 400 error messages for specific business rules. See the endpoint description in the API Reference for details.