Skip to main content

Error Handling

The API uses standard HTTP status codes and returns structured JSON error responses.

HTTP status codes

CodeMeaning
200 OKRequest succeeded
201 CreatedResource created successfully
204 No ContentRequest succeeded, no body (e.g., DELETE)
400 Bad RequestInvalid request body or parameters
401 UnauthorizedMissing or invalid authentication
403 ForbiddenInsufficient permissions
404 Not FoundResource not found
422 Unprocessable EntityValidation errors
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorServer-side error

Error response format

Error responses include a JSON body with error details:

{
"error": "Resource not found"
}

Validation errors include field-specific details:

{
"errors": {
"name": ["can't be blank"],
"url": ["is invalid"]
}
}

Common errors

Authentication required

HTTP 401
{
"error": "Authentication required"
}

Fix: Include a valid API key in the Authorization: Bearer hklst_... header.

Resource not found

HTTP 404
{
"error": "Resource not found"
}

Fix: Verify the resource ID exists and belongs to your organization.

Validation error

HTTP 422
{
"errors": {
"name": ["can't be blank"],
"slug": ["has already been taken"]
}
}

Fix: Check the request body for missing or invalid fields.

Required parameter missing

HTTP 400
{
"error": "name is required"
}

Fix: Include all required parameters in the request body.