Skip to content

Queue an action

POST
/api/tenants/{tenant}/devices/{endpoint}/{device}/actions
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.

tenant
required
string

The tenant’s id.

Example
acme
endpoint
required
string

The device’s endpoint.

Example
office
device
required
string

The device’s id.

Example
CG0001
X-Request-Id
string
<= 128 characters /^[A-Za-z0-9._:-]+$/

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-3a6b8d0c1e7f
Idempotency-Key
string
>= 1 characters <= 255 characters

Does 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-7d5c3e2f1a09
Media typeapplication/json

An action to queue.

object
action

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.

string | null
expires_at

Steps not handed to the device by then (RFC 3339) never go: they are cancelled, and the action ends timed_out.

string | null format: date-time
key

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).

string | null
lane
One of:
null
params

Its parameters, by name, as the action or command declares them (the device’s catalog lists them, typed).

steps

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.

Array<object> | null

One of an action’s steps.

object
action
required

A standard action, a package action or one of the package’s commands, as action takes it.

string
params

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"
}
}

Queued (or queued before, under the same key): the action’s id, its status and its steps’ command ids, in order.

Media typeapplication/json

An action queued: its id, its status and its steps’ command ids, in order.

object
commands
required

The ids of the commands its steps queued, in the order they run.

Array<integer>
id
required

The action’s id.

integer format: int64
status
required

Where it stands.

string
Allowed values: queued in_progress done failed cancelled timed_out
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.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Example
{
"error": "'teleport' is neither a standard action nor an action of package [email protected]"
}

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).

Media typetext/plain
string
Example
the API token was refused
WWW-Authenticate
string

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.)

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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.

Media typetext/plain
string
Example
too many logins at once; try again
Retry-After
integer

Seconds to wait: 1.

Something went wrong in the gateway that asking again will not put right by itself; error says what.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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).

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Example
{
"error": "the gateway is starting; try again shortly"
}