Skip to main content

Errors

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

Error response shape​

Most errors return a single human-readable message:

{
"detail": "Machine not found."
}

Some errors return a structured body with a machine-readable error_code:

{
"error_code": "VALIDATION_ERROR",
"message": "Request validation failed.",
"details": {
"errors": [
{
"loc": ["body", "readings", 0, "value"],
"msg": "Value error, Sensor value must be a finite number (not NaN or Infinity).",
"type": "value_error"
}
]
}
}

Read detail first and fall back to message. Branch on error_code where one is present rather than on the message text, which may change.

HTTP status codes​

Success​

CodeMeaningWhen
200 OKSuccessStandard successful response
201 CreatedResource createdA request that creates a resource
204 No ContentSuccess, no bodyDeletes, logout, and similar
207 Multi-StatusPartial successBatch ingestion with mixed results

Client errors​

CodeMeaningCommon causes
400 Bad RequestThe request cannot be doneAn expired or used link, an unsupported combination, a wrong confirmation code. Missing fields and malformed JSON return 422
401 UnauthorizedAuthentication failedMissing, expired, or revoked token or API key
402 Payment RequiredCompany suspendedEdge-agent API key used while your company's account is suspended (see below)
403 ForbiddenNot permittedYour role cannot perform this operation, your email is not verified yet, your password has expired (see below), the portal's security check did not pass (error_code TURNSTILE_FAILED), or a Haltless administrator is impersonating you and the action would change credentials, access or the AI provider
404 Not FoundResource not foundUnknown ID, or a resource you cannot access
409 ConflictConflicting stateDuplicate identifier, already acknowledged
413 Content Too LargeRequest too largeA request body over 10 MB
422 Unprocessable EntityValidation errorThe request body fails schema validation
423 LockedCompany suspendedSigning in while your company's account is suspended
429 Too Many RequestsRate limitedSee Rate Limiting. Also returned while an account is locked after repeated failed sign-ins

Server errors​

CodeMeaningAction
500 Internal Server ErrorUnexpected errorRetry; contact support if it persists
502 Bad GatewayUpstream dependency unavailableRetry after a short delay
503 Service UnavailableTemporarily unavailableRetry after a short delay
504 Gateway TimeoutThe request took longer than 110 secondsRetry; narrow the request (for example a shorter time range) if it keeps happening

Validation errors​

A 422 response lists each field that failed validation under details.errors. Each entry names the field location (loc), a message (msg), and an error type. Fix the flagged fields and resubmit.

For POST /api/v1/ingest, one invalid reading (a non-finite value, a missing unit, a timestamp out of range) fails the whole request with 422, and nothing in it is stored. loc gives the reading's position in the readings array. A reading that is valid but names a System Haltless does not know is different: the rest of the batch is stored, and that reading is reported in the 207 response. See Sensor Data.

Company suspended​

While a platform administrator has suspended your company's account:

  • Signing in returns 423 Locked.
  • Requests with an existing access token or a service-account key return 403 Forbidden.
  • Edge-agent API keys get 402 Payment Required on /api/v1/ingest and /api/v1/agent/heartbeat. The body tells the agent when to check again; the Edge Agent pauses collection and resumes by itself once the account is reinstated.
{
"detail": {
"error_code": "TENANT_SUSPENDED",
"message": "This company account has been suspended. Contact your administrator for help.",
"next_check_seconds": 300
}
}

Password expired​

Passwords expire after 90 days. Until the user sets a new one, requests made with their access token return 403 with this body (changing the password is still allowed):

{
"error_code": "AUTH_PASSWORD_EXPIRED",
"message": "Your password has expired. Please set a new one to continue.",
"change_password_url": "/settings#change-password"
}

Timeouts​

A request that runs past 110 seconds returns 504 with {"error_code": "GATEWAY_TIMEOUT", "message": "The server took too long to process the request. Please try again."}.

Request IDs​

Every response carries an X-Request-ID header. You can send your own: up to 128 letters, digits, ., _, : and -. Anything else is replaced by an ID Haltless generates, and the request still goes through. Quote the ID when you contact support.

Handling errors in code​

import requests

response = requests.get(
"https://api.haltless.io/api/v1/machines",
headers={"Authorization": f"Bearer {token}"},
)

if response.ok:
machines = response.json()
elif response.status_code == 401:
token = refresh_token()
# retry with the new token
elif response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", "5"))
time.sleep(retry_after)
# retry the request
else:
error = response.json()
message = error.get("detail") or error.get("message")
print(f"Error {response.status_code}: {message}")