Authentication
A connection authenticates with a realtime ticket issued by the HTTP
server. Once it has one, the gateway knows who you are from the ticket, and
every userId you put in a message is ignored.
:::note Where tickets work Only a gateway configured with the HTTP server's signing-key URL can verify tickets. Dev is configured from its next deploy (2026-11-03); staging and production are not yet. See Known gaps. :::
1. Get a ticket
Ask the HTTP server for one (POST /v1/realtime/tickets, documented in the
HTTP Server docs). It is a short JWT that lives 10 minutes. Keep it in
memory and reuse it for reconnects until shortly before it expires.
Optionally pass plantIds to narrow it to the plants on screen. A narrowed
ticket lists those plants by id, which this server can match without any
other information about them. Prefer it while the HTTP event bus is off (see
Who can see what).
2. Send it as the first message
// → client
{"type": "auth", "ticket": "eyJhbGciOiJFUzI1NiIs..."}
// ← server
{"type": "auth_result", "ok": true, "sub": "0f8fad5b-d9cb-469f-a165-70867728950e",
"org": "01JORGANISATION00000000000", "expiresAt": "2026-10-28T10:25:00Z"}
?ticket=<ticket> on the connect URL does the same, but puts the token in
URLs and proxy logs. Prefer the message.
On failure, ok is false with a code:
code | Meaning | What to do |
|---|---|---|
UNAUTHENTICATED | Invalid ticket (bad signature, wrong audience, malformed) | Get a new ticket; do not retry this one |
TICKET_EXPIRED | The ticket's 10 minutes are over | Get a new ticket and send auth again |
UNAVAILABLE | The gateway cannot fetch the HTTP server's signing keys right now, or is not configured for tickets | Retry with backoff |
FORBIDDEN | This connection is already authenticated as another user | Open a new connection for the other user |
3. Refresh before it expires
Send another auth with a fresh ticket at any time, for example a minute
before expiresAt. Watches and subscriptions stay open, re-checked against
the new ticket (since 2026-11-12):
- A device watch the new ticket no longer covers (
registersReadVIEW) ends with the same refusedwatch_ack(NOT_AUTHORIZED) a new watch would get. A watch that still passes has its firmware filter updated to the newfirmwarelevel. - A
subscribe_alertssubscription is rebuilt from the new grants and itsalerts_summarysent again. If it no longer passes, you get the failedalerts_summaryand the subscription ends; subscribe again. - Combined (plant) watches are based on device ownership, not the ticket, and are unchanged.
If the ticket expires anyway, the server pushes:
{"type": "auth_required", "reason": "expired", "closeAt": "2026-10-28T10:26:00Z"}
Send a new auth before closeAt (60 seconds later). Otherwise the server
closes the connection with close code 4401. Reconnect and authenticate
again.
The server can also close a connection with 4401 at any time: when the HTTP server revokes your access (for example, your role was narrowed, your membership removed, your Business suspended or closed, your account blocked, or your remote-control switch turned off). Reconnect with a new ticket, which carries your new access; if the HTTP server refuses you one, you stay out.
After such a revocation, do not reuse the ticket you already hold. The
server refuses every ticket issued before the revocation, on a new
connection and as a refresh, with auth_result code TICKET_EXPIRED,
even if the ticket has not run out yet. Always get a fresh ticket from the
HTTP server after a 4401. For example, when a Business suspends or removes
an Installer, the Installer's app is closed with 4401 within seconds.
Commands and register writes stop with it. The Installer's next ticket
request is refused while they are suspended. Once the Business restores
them, or accepts a new join request, a freshly issued ticket works again.
See Suspended or removed users for which
HTTP error codes should sign the user out and which should only switch org.
Some revocations do not close the connection. They end only your live views
of particular plants: device watches end with a refused watch_ack
(NOT_AUTHORIZED), combined watches with group_watch_ended
(NOT_AUTHORIZED), and a live alert feed that covered the plant is rebuilt
and its alerts_summary sent again. This happens when a plant moves to
another org (an End User joins or leaves a Business), when an installer is
reassigned, and, for every connection, when a plant is
blocked.
Who can see what
Your access to a device is the highest of:
- Ownership. You registered the device: full access, except
firmware, where an owner holds
VIEW(sees the installed version, never acts on it). Since RBAC v2 (2026-11-13) this applies only while the device's plant is in a personal org (an independent End User), or the device is in no plant, or you connect without a ticket. When the plant belongs to a Business, an owner with a ticket holds exactly what the ticket's grants give, like everyone else. That is how a connected End User's remote-control switch works: switched off, the ticket carriescommandsandregistersWriteNONE, and the End User can watch the device but not control it. An org the HTTP server has not yet marked as personal or not counts as personal. - Your ticket's grants. Each grant names plants (by id, by operator
org, by tag or region, by customer, by installer, or all plants) and gives a level
for devices, alerts, commands, register reads (
registersRead), register writes (registersWrite),firmwareandservice:NONE<VIEW<EDIT<MANAGE<FULL. When several grants cover a plant, the highest level of each applies.
An org-wide grant also reaches your org's unbound stock: devices registered under your org that are in no plant yet.
A ticket grant is {sel, ids, lv, rd?, op?}. sel is one of these:
sel | ids | Plants covered | Unbound stock |
|---|---|---|---|
all | none | Every plant | Every device in no plant |
org | operator org ids | Plants whose operator is one of ids | Devices registered under one of ids |
plants | plant ids | Exactly those plants | None |
tag | tag or region tag ids | Plants carrying one of ids | None |
customer | customer org ids | Plants whose customer is one of ids | None |
installer | installer (PARTNER) org ids | Plants whose installer is one of ids, whatever their operator | Devices registered under one of ids, only when the grant has no op |
op (optional) binds the grant to one operator org. The plant's operator
must also equal op. Every selector except all needs 1 to 1,000 ids of
1 to 64 characters. A ticket with an unknown sel is refused whole.
The HTTP server issues an installer grant when a platform admin selects a
PARTNER org they are not a member of. The installer filter on the device
inventory (installerOrgId) also follows an installer set on the device
itself, but a grant does not. An installer grant matches only the
plant's installer.
Besides its grants, a ticket can carry these top-level claims:
| Claim | Set by the HTTP server for |
|---|---|
"sa": true | a Super Admin of the Crown platform org |
"pa": true | an Admin of the Crown platform org |
"pm": true | a member of the Crown platform org, in any role |
"vp": true | a ticket that reaches its org through platform access (the subject is not a member of that org) |
"xp": ["<plantId>", …] | plants frozen by a block (Blocked plants) that your grants would otherwise reach. Since 2026-11-14; at most 50, omitted when there are none |
"oj": "<id>" | the sign-in (Cognito origin_jti) that requested the ticket. Since 2026-11-30, omitted when unknown. Ending that sign-in on the HTTP server closes this ticket's connections at once and refuses the ticket (Revocation) |
An absent claim means "no". sa or pa makes the caller privileged.
Since 2026-11-05 that unlocks the privileged
settings (the
writable More registers on every grouped model, and Nexus work_mode
option 1) and the raw custom_command.
A connection without a ticket (the device-owner path) is never privileged.
A plant in xp is, for the whole life of the ticket, as if no grant
covered it, and ownership does not reach it either: watches (single and
combined), register reads and writes, commands, transfers and alert actions
on its devices are refused, it is left out of every list, and none of its
live data or alerts reach the connection. A ticket with more than 50 ids or
an empty or over-long id is refused. A ticket without xp (an older HTTP
server) is unaffected. Inventory totals still count a frozen plant's
devices. xp adds to the block itself, which TCP enforces from the moment
the block arrives, including for tickets issued before it.
pm and vp decide whether alert actions show the person or "Crown
Support" (see Crown staff on alerts).
Blocked plants
A Super Admin or Admin can block a user together with their plants (the HTTP server's "Block B"). While a plant is blocked:
- Nobody may act on its devices: no watch, register read or write, command,
logger restart, raw command, transfer, move or permanent delete, for owners and connections
without a ticket too. A platform Super Admin or Admin (
saorpa) keeps view-only access: devices, alerts and register reads atVIEW, commands and register writesNONE. - Lists still include its devices (with the readings they last had), so a
console can show them as blocked. Lists of what you may change (scopes at
EDITor above) leave them out. - Every open live view of the plant ends when the block arrives.
- Its inverters are shut down and record no readings. See Plant block (Block B).
Some grants hide serial numbers. Then loggerId and inverterSn are empty
strings in replies, unless another of your grants (or ownership) shows them.
Matching a grant by operator, tag, region, customer or installer needs the plant's
details from the HTTP server's event bus. That bus is not switched on
yet, so today only these grants match: grants that list plants by id, and
the all-plants grant. Request tickets narrowed with plantIds until the bus
is on.
| To | You need |
|---|---|
Watch a device's live data, read_registers, get_registers with includeValues, see a device's latest readings | registersRead VIEW |
List devices, get_registers without values (the catalogue), view history, analytics and the Activity Trail | devices VIEW |
Write a setting (write, send_command with kind: write_register) | registersWrite EDIT (more for critical and engineering settings, see Commands) |
See the writable More settings or the Nexus work_mode option Anti-reflux to Meter in get_registers, and write them | the ticket claim "sa": true or "pa": true as well (see below) |
Send a raw custom_command | "sa": true or "pa": true, plus registersRead VIEW (read) or registersWrite EDIT (write); for an address in the firmware registers, firmware VIEW (read) or EDIT (write) as well |
| Receive a device's firmware values (installed version) in any reading | firmware VIEW (see below) |
Assign an installer to an alert (assign_alert) | alerts EDIT and service EDIT (service in a grant's lv, sent since 2026-11-23; a ticket without it holds NONE, and an owner holds NONE) |
Restart the logger (send_command with kind: logger_restart) | commands at the restart's level |
| Approve another person's command or a bulk task | MANAGE in the command's permission: registersWrite for a setting, commands for a restart |
| List alerts, subscribe to the live alert feed, mark alerts read | alerts VIEW |
| Acknowledge, resolve or assign an alert | alerts EDIT |
Register reads, register writes and device commands are three separate
permissions. You can hold one without the others: for example, write
settings without being allowed to restart the logger. Tickets issued before
the HTTP server sent registersRead and registersWrite still work: reads
then follow devices and writes follow commands. A grant that hides
engineering data still hides engineering registers, whatever its
registersRead level.
Firmware
Since 2026-11-11 firmware is its own permission (firmware in a grant's
lv). The firmware values are the registers that describe the installed
firmware: every register whose name contains version (for example
Aotai fm_version_of_*, IP20 *_software_version_*,
software_version_major_minor, sw_version, IP20 3K6/5K firmware_version,
firmware_version_date and dsp_firmware_version) and IP20's firmware image
checksum (checksum_high_word, checksum_low_word). Without firmware
VIEW on the device:
- live
telemetry(and the reading replayed onwatch) arrives without those keys; lastReadingsinget_devices,get_devices_pageandget_device_detailsleaves them out, andget_device_details'firmwarefield isnullwith reasonneeds FIRMWARE VIEW on this device;get_registersleaves those registers out of the catalogue (and their values);read_registersnaming one is refused:register "<name>" needs FIRMWARE VIEW on this device.
Acting on firmware means writing IP20's OTA block (sheet WF_OTA,
addresses 16384 to 16546), which only a raw custom_command can address
and which then needs firmware EDIT. A device whose model is not
identified yet cannot be told apart, so every raw command to it needs the
firmware level. A ticket without a firmware key grants NONE: there is
no older permission it falls back to. This server has no firmware
catalogue, update job or rollout: the installed version is the only
firmware data it holds.
Every register write attempt, allowed or refused, is recorded with who made it, the device, the register, the old and new value and the result.
Two messages reach granted devices only when you name a scope:
get_activitycovers another user's device when you pass itsdeviceKey, or a granted plant's devices when you passplantId. Without either it is your own devices only, so an all-plants grant does not page through the whole fleet's history.mark_all_alerts_readwithplantId: "all"marks your own plants and the plants your grants list. An all-plants grant is not expanded: mark those plants one at a time.
The live alerts_changed push follows your alert grants. With grants, its
unreadCount and counts cover everything you can see and may be up to 5
seconds old. A grant that reaches more than 20,000 plants cannot subscribe
with plantId: "all"; subscribe per plant instead.
get_devices is paged for every caller (15 devices on the first page, 10
on each later one, or limit up to 50; see
Paging). The old 500-device cap and
its "truncated" flag are gone.
Who can delete, archive or unbind
This section lists, role by role, what each person may remove (checked 2026-11-23). There are four kinds of removal:
- Permanent delete erases everything and cannot be undone.
- Archive hides a plant and can be undone.
- Unbind takes a device out of its plant and keeps its history.
- Remove from service switches a device off and can be undone.
The plant actions belong to the HTTP server. They are summarised here for reference; the Plants API and the role permissions matrix are authoritative.
Device actions on this server
| Action | Message | Needs |
|---|---|---|
| Permanently delete a device | delete_device / confirm_delete_device (mobile app) | You are the device's owner (the user it is registered to), and it is in a plant. Grants and tickets play no part: no grant allows it, a platform grant included |
| Unbind a device from its plant | unbind_device (console) | devices MANAGE on the device |
| Remove from service, and restore | remove_device / restore_device (console) | devices MANAGE on the device |
The HTTP server still has an older unbind route
(DELETE /v1/plants/{plantId}/devices/{serial}). It has been deprecated
since 2026-11-05 and needs only devices EDIT. Use unbind_device instead.
By role
The levels below are the ones the HTTP server puts in each role's ticket.
| Role | Delete a plant | Archive or restore a plant | Unbind or remove a device | Permanently delete a device |
|---|---|---|---|---|
| Crown Super Admin or Administrator | Yes, any plant | Yes | Yes | No |
| Business (owner or Business role) | Only a plant with no customer (otherwise 403 PLANT_HAS_CUSTOMER) | Yes, in bulk too | Yes | No |
| Installer | No | No | Yes, with devices MANAGE | No |
| Operations Manager | No | No | No (devices EDIT) | No |
| Technician, Viewer | No | No | No | No |
| End User, independent (has their own personal org) | Yes, their own plant (mobile or web) | Yes | Yes | Yes, devices they own |
| End User, connected to a Business | No, not a plant where they are the customer | Yes | Yes | Yes, devices they own |
| Shared user (a plant was shared with them) | Never | Only with a FULL share whose granter set plants to MANAGE | No (devices EDIT at most) | No |
| Mobile app admin or viewer (old mobile roles) | No | No | No | No |
Notes:
- Device owner. The owner is the user the device is registered to. An unbind out of a Business plant clears the owner, so after that the End User can no longer delete the device.
- Removing someone from a plant is not a delete. The Business owner, an Installer of that Business, or Crown can take an End User off a plant. An End User can never remove themselves, but they can drop a share they brought in.
- A blocked plant is frozen (see Blocked plants):
none of these actions works on it. That includes the permanent delete
(since 2026-11-23), which is refused when the plant is blocked or listed
as frozen in the ticket (
xp), both at the request and at the confirmation. - Deleting a plant does not delete its devices. They go back to stock with their history erased (see Deleting a device).
Known gaps:
- Unverified owner without a ticket. On a connection with a ticket,
the server uses the ticket's user and ignores the
userIdin the message. Without a ticket (allowed whileWS_AUTH_MODEisoptional),delete_devicetrusts theuserIdthe client sends. The two-step confirmation makes an accidental delete harder, but it is not authentication. Switching torequiredcloses this. - Possible gap on the HTTP server. Its plant-delete check counts every
role with plants
MANAGE, End User included. So a connected End User may be able to delete a Business plant that has no customer. This is under review.
Which messages need a ticket
It depends on the server's WS_AUTH_MODE:
| Mode | Without a ticket |
|---|---|
optional (staging) | Device messages, watch (both scopes), read_registers, get_registers, write and custom_command, are refused with {"type": "error", "code": "UNAUTHENTICATED", "for": "<type>"} (since 2026-11-30: a claimed userId proves no ownership). The mobile app's other messages work as before, trusting userId. Every web-console message is refused with UNAUTHENTICATED. |
required (dev since 2026-11-30, production) | Every message except auth is refused with {"type": "error", "code": "UNAUTHENTICATED", "for": "<type>"} |
legacy | Everything trusts userId. Used only to roll back. |
Native apps and browsers authenticate the same way. The origin allowlist (see Getting connected) applies to browsers only and is not authentication.