Skip to content

Response Format

Every hzel API response uses one of two JSON shapes.

{
"data": <payload>
}

data is the resource or value returned by the endpoint. Its type varies per endpoint and is documented on each endpoint’s page.

Example — single resource:

{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"hostname": "my-container",
"state": "running"
}
}

Example — list:

{
"data": [
{ "id": "", "hostname": "box-a", "state": "running" },
{ "id": "", "hostname": "box-b", "state": "stopped" }
]
}

Exception: the OAuth token endpoint (POST /api/v1/oauth/token) does not use this envelope — it returns the token response directly, following the OAuth 2.0 RFC.

{
"error": {
"code": "SCREAMING_SNAKE_CASE",
"message": "Human-readable description"
}
}

The HTTP status code and error.code together give you everything you need to handle the failure programmatically. The message is for display only and may change between releases — do not parse it.

HTTPerror.codeWhen it occurs
401UNAUTHORIZEDNo valid credentials provided
403FORBIDDENAuthenticated but not allowed
403CSRF_REJECTEDSession-cookie request missing a valid x-csrf-token
400VALIDATION_FAILEDRequest body or query param failed validation
400BAD_REQUESTMalformed request
404NOT_FOUNDResource not found
404CONTAINER_NOT_FOUNDSpecific container ID not found
404COMMAND_NOT_FOUNDSpecific command job ID not found
501NOT_IMPLEMENTEDEndpoint exists but feature is not enabled
500INTERNAL_ERRORUnexpected server error