Skip to content

Overview

Runs and changes the gateway while it runs: listeners, endpoints, sinks, sync groups, packages, devices and their commands, and what happened.

Access. With an admin login configured (HOURADVANTAGE_ADMIN_USERNAME, HOURADVANTAGE_ADMIN_PASSWORD_HASH), every request needs it (HTTP Basic) or a named API token (Authorization: Bearer hadv_...). Without a login, the API answers only requests whose Host header names a loopback address, and refuses requests a proxy forwarded. A request whose Origin header differs from its Host is refused either way. The probes (/livez, /api/health, /api/ready) need no login; /metrics needs it, or an install token, as the install’s routes do. POST /api/attendance/tenants/{tenant}/deliveries takes neither: only a signature by one of the tenant’s delivery keys.

Bodies. Requests and answers are JSON: send Content-Type: application/json with a body. A body that cannot be read is refused before the route sees it: 400 when it is not JSON, 415 without the content type, 422 when it is not the shape asked for (an unknown field, a value of the wrong type). Every refusal is {"error": "..."}, but for a path or query parameter that cannot be read (a number that is not one, a time that is not RFC 3339), which is refused with a plain-text reason. A 422 for parameters that do not fit what a command or action declares also lists what is wrong with each field in fields.

Changes. Every change that succeeds is added to the audit trail (GET /api/audit), with passwords, keys and secrets taken out of the request. A change that moves the config version answers with a houradvantage-config-version header: the version every instance is to reach (GET /api/peers shows how far each one has got). A change that leaves something for you to do elsewhere says so in a Warning header (code 299) for each thing.

Request ids. Every answer carries an X-Request-Id header: the one the request was sent with when it is 1 to 128 letters, digits, -, _, . or :, a new one otherwise (an odd or oversized one is replaced, never cleaned up). The same id is in an {"error"} body’s request_id, on the gateway’s log lines about the request, in the audit trail entry of the change it made, and in the request of every event made while it ran. It is a correlation id only: nothing is allowed or deduplicated by it.

Retries. A POST or PATCH sent with an Idempotency-Key header (1 to 255 visible ASCII characters, a UUID say) is done once, however often it is sent, for 24 hours from when it was first sent. Sent again with the same key and the same method, path, query and body, it is answered as it was the first time, refusals too, with Idempotent-Replayed: true and the first request’s id in Original-Request. The same key with another request is refused 422; the same key while its first request runs still, 409. Keys are kept per scope: the install’s (the login, an install token) and each tenant token’s apart. An answer that says to try again (429) or is a server failure (5xx), and one streamed as it is made (an export), is not kept: the retry runs. The import of a tenant takes no key.

Information

  • License: Proprietary: all rights reserved
  • OpenAPI version: 3.1.0

The admin login: the user name in HOURADVANTAGE_ADMIN_USERNAME and the password whose argon2 hash is in HOURADVANTAGE_ADMIN_PASSWORD_HASH. Without a login configured, none is asked for, and only requests whose Host header names a loopback address are answered.

Security scheme type: http

A named API token, hadv_ and 43 more characters, made with POST /api/tokens (hourctl token create). It is taken whether or not a login is configured. A token revoked through one instance is refused there at once, and by the other instances when each is told (a note), with no time to wait. A token scoped to one tenant (connect:<tenant> or attend:<tenant>) reaches only that tenant’s routes of that engine, never an install-level route nor the tenant’s own record, suspend, resume, stop, delete, export or import; elsewhere it is answered 403.

Security scheme type: http

A delivery’s signature, as a Connect webhook sink signs: v1= and the HMAC-SHA256, hex, of <x-houradvantage-timestamp>.<body>, keyed with one of the tenant’s delivery keys (POST /api/attendance/tenants/{tenant}/delivery-keys). Only the deliveries route takes it, and it takes nothing else: no login, no API token.

Security scheme type: apiKey

Header parameter name: x-houradvantage-signature