Create a job
const url = 'http://127.0.0.1:9090/api/tenants/acme/jobs';const options = { method: 'POST', headers: { 'X-Request-Id': '4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f', 'Idempotency-Key': '0b6f1d3e-2c4a-4f8e-9a1b-7d5c3e2f1a09', Authorization: 'Basic <credentials>', 'Content-Type': 'application/json' }, body: '{"abort":{"after":5,"failed_percent":20},"action":"show_message","lane":"interactive","name":"Evening notice, north site","params":{"minutes":60,"text":"The clocks restart at 22:00"},"rollout":{"advance":"auto","max_concurrent":10,"waves":[1,"50%"]},"targets":{"endpoints":["office"],"select":"site = north"},"timeout":1800,"window":{"days":["mon","tue","wed","thu","fri"],"hours":"17:00-21:00"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:9090/api/tenants/acme/jobs \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 0b6f1d3e-2c4a-4f8e-9a1b-7d5c3e2f1a09' \ --header 'X-Request-Id: 4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f' \ --data '{ "abort": { "after": 5, "failed_percent": 20 }, "action": "show_message", "lane": "interactive", "name": "Evening notice, north site", "params": { "minutes": 60, "text": "The clocks restart at 22:00" }, "rollout": { "advance": "auto", "max_concurrent": 10, "waves": [ 1, "50%" ] }, "targets": { "endpoints": [ "office" ], "select": "site = north" }, "timeout": 1800, "window": { "days": [ "mon", "tue", "wed", "thu", "fri" ], "hours": "17:00-21:00" } }'Runs one action on many devices, in waves. The devices are found now:
the allowed devices of targets.endpoints (every endpoint when none is
named) that the selector targets.select picks by their labels, when
either is given, and the devices listed in targets.devices. A listed
device that is not known or not allowed is named in missing. A job
takes at most 100000 devices.
Each device gets its execution and its wave, and the job starts at
once: devices start as the rollout, max_concurrent and the window
allow, each running the action with the job’s parameters. With
advance auto, the next wave starts once every device of the current
one succeeded. A device’s action that does not finish within timeout
is taken back, and the device is timed_out. With abort, the job
pauses when too many devices fail.
The parameters may hold no value the package marks sensitive (a job
keeps them), and the action may not write data a device’s sync group
keeps. A job.started event is stored for each endpoint the job has
devices on, and the change is added to the audit trail. The job goes on
whichever instance takes it up, and every instance answers for it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The tenant’s id.
Example
acmeHeader Parameters
Section titled “Header Parameters”An id to follow the request by: answered back in X-Request-Id, and in the log, the audit trail and the events the request causes. 1 to 128 letters, digits, -, _, . or :; anything else is replaced by a new id.
Example
4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7fDoes the request once, however often it is sent with this key, for 24 hours: sent again with the same request, it is answered as it was the first time (Idempotent-Replayed: true); with another, 422; while the first runs still, 409.
Example
0b6f1d3e-2c4a-4f8e-9a1b-7d5c3e2f1a09Request Bodyrequired
Section titled “Request Bodyrequired”A job as asked for: the file hourctl job create reads, the body of
POST /api/tenants/{tenant}/jobs, kept as it was given.
object
When too many devices fail, the job pauses. Absent: it never pauses on its own.
object
How many devices must have finished (succeeded, failed or timed out) before the threshold is judged. 1 unless said.
The share of finished devices, 1 to 100 per cent, that failed or timed out at which the job pauses.
What each device runs: a standard action its package offers, or a package action or command (firmware upgrades are package actions).
The lane each device’s action queues in: interactive (the
default) or bulk.
A name for people to know it by (not unique).
The action’s parameters, by name. None may be one the package marks sensitive: a job keeps its parameters to start each device’s action.
object
How the devices are taken on. One wave of every device, advancing on its own, unless said.
object
auto (the default): the next wave starts once every device of the
current one succeeded. manual: only when told
(POST /api/tenants/{tenant}/jobs/{id}/advance).
Devices running at once, at most (1 or more). Absent: no limit beyond the wave.
The size of each wave, in order: a count (5) or a share of all the devices (“10%”, rounded up). Devices left over after the last make one more wave. Absent: one wave of every device.
Which devices it runs on.
object
Devices by “endpoint/device”.
The endpoints whose allowed devices it runs on (with select, those
it picks). Absent: every endpoint, when select is given.
A selector over the devices’ labels (docs/selectors.md):
site = north and floor in (1, 2).
How long each device has, from when its action is started, in
seconds (a file or body may also say “90s”, “30m”, “2h”, “1d”); any
positive duration. At that instant its action expires: its steps not
handed out are cancelled, those in the device’s hand are given up on
(unanswered, each with its event), and the device is timed_out.
Absent: no deadline. The device’s action waits until the device
answers, its commands are lost (by order, or a restart), or the
action is cancelled or given up on.
When devices may start. Absent: any time.
object
The days it opens on: “mon” .. “sun” (or the full names). Absent: every day.
“HH:MM-HH:MM”, local time; “22:00-05:00” runs past midnight into the next day (the day it opened on counts). Absent: the whole day. A window gives its days, its hours or both.
Example
{ "abort": { "after": 5, "failed_percent": 20 }, "action": "show_message", "lane": "interactive", "name": "Evening notice, north site", "params": { "minutes": 60, "text": "The clocks restart at 22:00" }, "rollout": { "advance": "auto", "max_concurrent": 10, "waves": [ 1, "50%" ] }, "targets": { "endpoints": [ "office" ], "select": "site = north" }, "timeout": 1800, "window": { "days": [ "mon", "tue", "wed", "thu", "fri" ], "hours": "17:00-21:00" }}Responses
Section titled “Responses”Created and started: the job, with every device it runs on.
A job as the API shows it: the job, how many of its devices are in each state, and, for one job, every device.
object
How many devices had failed when the abort threshold last paused it: once resumed, it pauses again only on a new failure.
When it was created.
Who created it: the admin login, token:<name> for an API token,
or local when no login is configured.
When it was completed, or cancelled with nothing left running.
The job’s id.
Devices the targets matched (each has an execution).
Devices listed in targets.devices that are not known or not allowed.
Why it is as it is, when that is worth saying: what paused it, what it waits for.
The job as it was asked for, defaults filled in.
object
When too many devices fail, the job pauses. Absent: it never pauses on its own.
object
How many devices must have finished (succeeded, failed or timed out) before the threshold is judged. 1 unless said.
The share of finished devices, 1 to 100 per cent, that failed or timed out at which the job pauses.
What each device runs: a standard action its package offers, or a package action or command (firmware upgrades are package actions).
The lane each device’s action queues in: interactive (the
default) or bulk.
A name for people to know it by (not unique).
The action’s parameters, by name. None may be one the package marks sensitive: a job keeps its parameters to start each device’s action.
object
How the devices are taken on. One wave of every device, advancing on its own, unless said.
object
auto (the default): the next wave starts once every device of the
current one succeeded. manual: only when told
(POST /api/tenants/{tenant}/jobs/{id}/advance).
Devices running at once, at most (1 or more). Absent: no limit beyond the wave.
The size of each wave, in order: a count (5) or a share of all the devices (“10%”, rounded up). Devices left over after the last make one more wave. Absent: one wave of every device.
Which devices it runs on.
object
Devices by “endpoint/device”.
The endpoints whose allowed devices it runs on (with select, those
it picks). Absent: every endpoint, when select is given.
A selector over the devices’ labels (docs/selectors.md):
site = north and floor in (1, 2).
How long each device has, from when its action is started, in
seconds (a file or body may also say “90s”, “30m”, “2h”, “1d”); any
positive duration. At that instant its action expires: its steps not
handed out are cancelled, those in the device’s hand are given up on
(unanswered, each with its event), and the device is timed_out.
Absent: no deadline. The device’s action waits until the device
answers, its commands are lost (by order, or a restart), or the
action is cancelled or given up on.
When devices may start. Absent: any time.
object
The days it opens on: “mon” .. “sun” (or the full names). Absent: every day.
“HH:MM-HH:MM”, local time; “22:00-05:00” runs past midnight into the next day (the day it opened on counts). Absent: the whole day. A window gives its days, its hours or both.
Where a job stands: running (devices are started as the rollout
allows), paused (no device is started; those running go on to their
end), cancelled (stopped for good: devices not started never will be)
or completed (every device has finished).
The tenant it is of: it runs on that tenant’s devices only.
When it last changed.
The current wave, from 0: devices of this wave and those before it may start.
How many waves it has.
How many of its devices are in each state.
object
Devices cancelled: with the job, or their action was cancelled.
Devices whose action failed or could not be started.
Devices whose wave has not started, or that wait for room.
Devices whose action is started.
Devices whose action succeeded.
Devices whose action did not finish within the job’s timeout.
Devices whose turn it is, waiting for their window to open.
Every device of the job, in seq order. Absent in the list of jobs.
One device’s part in a job.
object
The action started on it (the latest attempt’s).
1, then one more for each retry-failed that took it again.
What went wrong, for one that failed, timed out or was cancelled (the step its action stopped at, counted from 1); what it waits for, for one waiting for its window (“waiting for window (opens 2026-10-04 22:00 America/Chicago)”).
The device’s id.
The device’s endpoint.
When it finished (the latest attempt).
Shown, not kept: the device is held (a gate of an action did not pass, and its outgoing queue waits for a release).
Its place among the job’s devices, from 0.
When its action was started (the latest attempt’s).
Where one device stands in a job: queued (its wave has not started,
or there is no room yet under max_concurrent), waiting_window (its
turn, but the window is closed where it is), running (its action is
started), succeeded, failed (its action failed, a step went
unanswered, or it could not be started), timed_out (its action did
not finish within the job’s timeout) or cancelled (the job was
cancelled, or its action was).
Its wave, from 0.
The zone its window is read in: its endpoint’s timezone option,
else its sync group’s timezone setting. Absent: it has none, and UTC
is used.
How many of its devices have no zone of their own: their window is read in UTC. Always 0 in the list of jobs.
Example
{ "abort_seen": 0, "counts": { "cancelled": 0, "failed": 0, "queued": 2, "running": 0, "succeeded": 0, "timed_out": 0, "waiting_window": 0 }, "created_at": "2026-01-15T16:55:00Z", "created_by": "admin", "executions": [ { "attempt": 1, "device": "CG0001", "endpoint": "office", "seq": 0, "state": "queued", "wave": 0, "zone": "America/Chicago" }, { "attempt": 1, "device": "CG0002", "endpoint": "office", "seq": 1, "state": "queued", "wave": 1, "zone": "America/Chicago" } ], "id": 7, "matched": 2, "no_zone": 0, "spec": { "abort": { "after": 5, "failed_percent": 20 }, "action": "show_message", "lane": "interactive", "name": "Evening notice, north site", "params": { "minutes": 60, "text": "The clocks restart at 22:00" }, "rollout": { "advance": "auto", "max_concurrent": 10, "waves": [ 1, "50%" ] }, "targets": { "endpoints": [ "office" ], "select": "site = north" }, "timeout": 1800, "window": { "days": [ "mon", "tue", "wed", "thu", "fri" ], "hours": "17:00-21:00" } }, "state": "running", "updated_at": "2026-01-15T17:01:10Z", "wave": 0, "waves": 2}Not valid: a field that is not known or not of its type, no action, targets that select no device or match none, more than 100000 devices, an unknown endpoint, an action a device’s package does not offer, one that writes data a device’s sync group keeps, a sensitive parameter, a wave size, window, max_concurrent, timeout or abort.failed_percent out of range.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Example
{ "error": "the targets match no allowed device"}A login is configured and the request carries neither it nor an API token, or it carries a wrong login (WWW-Authenticate: Basic realm="Hour Advantage", no body). Or the request carries an API token that is not one (revoked, or never made), login or not (WWW-Authenticate: Bearer realm="Hour Advantage", error="invalid_token", the body the API token was refused).
Example
the API token was refusedHeaders
Section titled “Headers”The scheme to answer with: Basic realm="Hour Advantage", or for a refused token Bearer realm="Hour Advantage", error="invalid_token".
The Host header does not name a loopback address while one is required (no login configured, or the API listens on loopback), or the Origin header does not match the Host: {"error": ...} says which. Or no login is configured and the request carries Forwarded, X-Forwarded-For or X-Real-IP (a proxy forwarded it): the plain text body says so. Or an API token asks for a route its scope does not reach: the plain text body says so.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Example
{ "error": "the Host must name this machine (localhost or a loopback address); an API reached by other names needs the admin login"}Example
a forwarded request needs the admin login; none is setMore than 2 admin logins are being checked at once: send the request again after the Retry-After seconds. A request carrying the login that checked out last, or an API token, is not held up.
Example
too many logins at once; try againHeaders
Section titled “Headers”Seconds to wait: 1.
Something went wrong in the gateway that asking again will not put right by itself; error says what.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Example
{ "error": "db error: ERROR: permission denied for table settings"}The database cannot be used right now (not reachable, too busy, no connection free in time), or the instance is still starting: send the same request again shortly. An API token that cannot be checked for the same reason is answered 503 in plain text (the API token cannot be checked right now; try again shortly).
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Example
{ "error": "the gateway is starting; try again shortly"}