Skip to content

Get a device

GET
/api/tenants/{tenant}/devices/{endpoint}/{device}
curl --request GET \
--url http://127.0.0.1:9090/api/tenants/acme/devices/office/CG0001 \
--header 'Authorization: Basic <credentials>' \
--header 'X-Request-Id: 4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f'

One device, with its keys (the only place they are shown), the commands its package offers to be sent by name (available_commands: every command but those only the package’s own actions use) and the actions the device takes (available_actions: the package’s actions that, as the package judges from what the device reported, it takes).

When it was last seen, and what was counted of its messages (health), are as every running instance knows them (an instance that ended without answering is named in the X-Instances-Unanswered header). A device whose endpoint is not configured shows no commands or actions.

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

The device, its keys, what its package offers it, and what its commands add up to (commands: waiting, in its hand, and ended unanswered).

Media typeapplication/json

A device, its keys, and what its package offers it.

object
available_actions
required

The actions this device takes, by name, as the package judges from what the device reported (the package’s actions say how). Empty when its endpoint is not served.

Array<string>
available_commands
required

The commands its package offers to be sent by name: every one but those only the package’s own actions use. Empty when its endpoint is not served.

Array<object>

A command the package declares: what it does, the parameters it takes, and what it writes on the device.

object
description
required

What it does.

string
implements

The standard action this command is, if it is one: it takes the standard parameters (GET /api/tenants/{tenant}/actions).

string | null
internal

Only a step of the package’s own actions: never sent by name.

boolean
key
required

Its name: what an action names to send it.

string
params
required

The parameters it takes, typed.

Array<object>

One parameter: its name, type and what narrows it.

object
description

What it is. Absent when the package does not say.

string
items
One of:
null
max

integer: the largest value.

integer | null format: int64
max_bytes

binary: the most bytes, decoded.

integer | null
max_items

list, cards: the most items.

integer | null
max_length

string, secret: the most characters.

integer | null
min

integer: the smallest value.

integer | null format: int64
name
required

The parameter’s name, as a request gives it in params.

string
pattern

string, secret: a regular expression the whole value matches.

string | null
required

A request must give it. False unless said.

boolean
sensitive

A secret or personal data (a password, a card number, a template, a photo): it reaches the device in the payload and is kept and shown nowhere else, only as its size.

boolean
type
required

The kind of value it takes.

string
Allowed values: string integer boolean enum secret binary wall_time rfc3339 cards biometrics object list
values

enum: the values it may be.

Array<string>
quick
required

Worth a one-click button: a hint for user interfaces.

boolean
sensitive_result
required

What the device answers may be sensitive (a file holding every user, say): once the command.result event carrying it is stored, the command keeps only its size.

boolean
success
required

Which result codes mean the command succeeded, unless the package says so itself.

string
Allowed values: zero non_negative positive
title
required

A short name for people.

string
writes
required

The sync domains it writes on the device (people, access, lists, settings, punches); empty for reads and device operations. A command that implements a standard action writes what that action writes.

Array<string>
commands
required

What its commands add up to: waiting, in its hand, and ended unanswered.

object
in_hand
required

Commands offered to the device (written into a reply) that it has not answered and that no rule has ended (a later answer in order, the package’s restart rule, a give-up).

integer format: int64
unanswered
required

Commands that ended unanswered and are still kept (finished commands are kept for their retention). A result that arrives later still completes one.

integer format: int64
waiting
required

Commands queued for the device and not yet offered to it. An upper bound: one past its expiry waits here until the sweep cancels it.

integer format: int64
device
required

The device.

object
device
required

The id the package identifies the device by: a serial number, a MAC address, a cloud id.

string
endpoint
required

The endpoint it belongs to.

string
first_seen

None for a device that was registered and has not called in yet.

string | null format: date-time
health

How its messages have gone, counted by every instance that serves it.

object
errors
required

Of those, the ones that failed: the package failed, no route matched, or what it changed could not be stored.

integer format: int64
last_error
One of:
null
messages
required

Messages that got past its key: taken in, or refused for its status.

integer format: int64
held
One of:
null
id
required

The device’s number in the register.

integer format: int64
info
required

Facts the package reported: firmware, IP, user counts, capabilities.

object
key
required

Where it stands with its key.

string
Allowed values: none pending active
key_conflict_at

When the device, while held, last presented a key other than the one it was held with: someone else may be calling under its name. Adopting takes the key it was held with all the same; adopt_presented_key takes the latest instead. Cleared when its key is set, adopted or taken away.

string | null format: date-time
key_held

The device presented a key while it was held (waiting to be allowed, with no key of its own), and the first such key is kept: adopting its key takes that one, the key it was held with, not a later one.

boolean
key_presented
required

What its latest message carried for a key.

string
Allowed values: none registered unregistered
key_refused_at

When a message was last refused for carrying the wrong key, or none.

string | null format: date-time
last_seen

When its latest message came, as the instances that serve it know; null until it calls in.

string | null format: date-time
params
required

Values captured from the endpoint’s path or topic template on the latest message it was let in on (its first, until then); used to address replies (e.g. MQTT reply topics).

object
key
additional properties
string
remote_ip
required

The address its latest message came from, of those it was let in on (its first message, until it is let in; “” until it calls in). A message refused for the device’s status or rate moves nothing.

string
status
required

Whether a device may talk to the gateway: pending (known, waiting for someone to allow or block it; its messages are refused meanwhile), allowed (its messages are taken in) or blocked (its messages are refused until someone allows it).

string
Allowed values: pending allowed blocked
external_ids

What other systems know the device by: system name to id.

object
key
additional properties
string
labels

The device’s own labels, by name: what a sync group’s placement rules pick members by, together with its endpoint’s labels (the device’s own win where both name one).

object
metadata

Free-form data from other systems, kept as given.

object
keys
One of:
null
Example
{
"available_actions": [
"get_info",
"open_door",
"reboot",
"sync_time",
"upsert_user"
],
"available_commands": [
{
"description": "Unlocks the door for a moment.",
"implements": "open_door",
"key": "open_door",
"params": [
{
"description": "Which door, as the device numbers them; default: its only one.",
"name": "door",
"required": false,
"sensitive": false,
"type": "string"
},
{
"description": "How long; default: the device's own unlock time.",
"max": 60,
"min": 1,
"name": "seconds",
"required": false,
"sensitive": false,
"type": "integer"
}
],
"quick": true,
"sensitive_result": false,
"success": "zero",
"title": "Open door",
"writes": []
}
],
"commands": {
"in_hand": 2,
"unanswered": 0,
"waiting": 0
},
"device": {
"device": "CG0001",
"endpoint": "office",
"first_seen": "2026-01-15T08:00:00Z",
"health": {
"errors": 1,
"last_error": {
"at": "2026-01-15T07:58:00Z",
"reason": "line 3: '2026-13-01 08:00:00' is not a time",
"route": "attlog"
},
"messages": 1520
},
"id": 42,
"info": {
"firmware": "3.4.0",
"punches": 1830,
"users": 25
},
"key": "active",
"key_presented": "registered",
"key_refused_at": null,
"labels": {
"site": "north"
},
"last_seen": "2026-01-15T08:05:00Z",
"params": {},
"remote_ip": "192.0.2.10",
"status": "allowed"
},
"keys": {
"pending": null,
"presented": "example-key-1",
"registered": "example-key-1"
}
}

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

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
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 Host must name this machine (localhost or a loopback address); an API reached by other names needs the admin login"
}

The endpoint has no such device.

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": "device not found"
}

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