Queue an action
const url = 'http://127.0.0.1:9090/api/tenants/acme/devices/office/CG0001/actions';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: '{"action":"show_message","expires_at":"2026-01-15T09:00:00Z","key":"welcome-CG0001-2026-01-15","lane":"interactive","params":{"minutes":10,"text":"Welcome back"}}'};
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/devices/office/CG0001/actions \ --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 '{ "action": "show_message", "expires_at": "2026-01-15T09:00:00Z", "key": "welcome-CG0001-2026-01-15", "lane": "interactive", "params": { "minutes": 10, "text": "Welcome back" } }'Queues an action for a device: a standard action or a package action that the device’s package offers, or one of its commands sent by name (an action of one step). The parameters are checked against what the action or command declares before anything is queued; the package then builds the steps, and they are queued all or none.
The steps go to the device in order, after what already waits in their
lane, several actions to a batch. A step that fails fails the action,
and its steps not yet handed out are skipped. A step the package marks
as a gate goes out on its own and the steps after it wait for it to
pass; a gate that does not pass holds the device
(POST /api/tenants/{tenant}/devices/{endpoint}/{device}/release).
Send key to make the request safe to repeat: the same key for the
same device returns the action the first request queued, as it is now.
A device may have at most 10000 commands waiting. Follow the action
with GET /api/tenants/{tenant}/devices/{endpoint}/{device}/actions/{id} or its
action.result event. The change is added to the audit trail.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The tenant’s id.
Example
acmeThe device’s endpoint.
Example
officeThe device’s id.
Example
CG0001Header 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”An action to queue.
object
What to do: a standard action or a package action the device’s
package offers (available_actions on the device), or one of its
commands (available_commands), which is an action of one step.
Not given when steps is.
Steps not handed to the device by then (RFC 3339) never go: they are
cancelled, and the action ends timed_out.
The caller’s own id for this request, to make it safe to send again:
the same key for the same device returns the action it queued the
first time, and queues nothing. At most 255 characters, as an
Idempotency-Key: it is indexed, and a longer one is refused (400).
Its parameters, by name, as the action or command declares them (the device’s catalog lists them, typed).
The steps of the action, listed by the caller instead of named: each is { "action", "params" } as action
and params would be on their own, and is judged as it would be alone. They are queued in order as one
action, with one status and one result; if any is refused, nothing is queued. Not given with action.
One of an action’s steps.
object
A standard action, a package action or one of the package’s commands, as action takes it.
Its parameters, as params takes them.
Example
{ "action": "show_message", "expires_at": "2026-01-15T09:00:00Z", "key": "welcome-CG0001-2026-01-15", "lane": "interactive", "params": { "minutes": 10, "text": "Welcome back" }}Responses
Section titled “Responses”Queued (or queued before, under the same key): the action’s id, its status and its steps’ command ids, in order.
An action queued: its id, its status and its steps’ command ids, in order.
object
The ids of the commands its steps queued, in the order they run.
The action’s id.
Where it stands.
Example
{ "commands": [ 9002 ], "id": 513, "status": "queued"}Not valid: the endpoint or the device is not known, the package offers no such action or command, the device does not take the action, the command is one only the package’s own actions use. A body that is not JSON is refused with 400.
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
{}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".
It carries (or enrols) templates or photos of a person whose sync group does not allow them biometrics. (A request refused for its Host or Origin header gets 403 without a body.)
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": "'set_biometric' carries biometric data of person '1001': the person is not allowed biometrics (allow_biometrics is false in their group)"}It writes data the device’s sync group keeps: write it through the sync API (the message names the route), take the domain out of the group, or move the device to an endpoint without one.
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": "office/CG0001 is a member of sync group 'hq', which keeps its people: 'upsert_user' would write them behind the group's back. Write them through /api/tenants/default/sync/hq/people/{user_id} instead; or take 'people' out of the group, or move the device to an endpoint without it, to manage them by hand"}The parameters do not fit what the action or command declares: fields says what is wrong with each. Nothing was queued. A body with an unknown field, a value of the wrong type or a lane other than interactive or bulk is refused with 422.
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": "action 'show_message': parameter 'text' is required", "fields": [ { "field": "text", "message": "is required" } ]}More 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"}