Documentation

Error Handling

ZopNight uses standard HTTP status codes and returns structured error responses.

Error Response Format

When an error occurs, the API returns a JSON response with an error field:

{
  "error": {
    "message": "schedule not found"
  }
}

HTTP Status Codes

CodeMeaningCommon Causes
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request body, missing required fields, validation errors
401UnauthorizedMissing, invalid, or expired JWT token
403ForbiddenInsufficient permissions or accessing another organization's resources
404Not FoundResource, schedule, or endpoint does not exist
409ConflictDuplicate resource, schedule name already exists
429Too Many RequestsRate limit exceeded — see Rate Limiting
500Internal Server ErrorUnexpected server error — retry with backoff
502Bad GatewayGateway could not reach the backend service
503Service UnavailableService is temporarily unavailable

Retry Strategy

StatusAction
4xx (except 429)Do not retry. Fix the request and try again.
429Back off and retry after the period indicated in the response.
500Retry with exponential backoff (1s, 2s, 4s, 8s).
502/503Retry with exponential backoff. The service may be restarting.

Idempotent Operations

POST endpoints for actions (start/stop) are idempotent. It is safe to retry these operations without risk of double-execution.

Common Error Scenarios

Expired Token

HTTP 401
{
  "error": {
    "message": "token has expired"
  }
}

Use the /auth/refresh endpoint to get a new access token.

Invalid Request Body

HTTP 400
{
  "error": {
    "message": "invalid cron expression: '0 25 * * *'"
  }
}

Resource Not Found

HTTP 404
{
  "error": {
    "message": "resource not found"
  }
}

Rate Limited

HTTP 429
{
  "error": {
    "message": "rate limit exceeded"
  }
}