Skip to main content

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:

codeMeaningWhat to do
UNAUTHENTICATEDInvalid ticket (bad signature, wrong audience, malformed)Get a new ticket; do not retry this one
TICKET_EXPIREDThe ticket's 10 minutes are overGet a new ticket and send auth again
UNAVAILABLEThe gateway cannot fetch the HTTP server's signing keys right now, or is not configured for ticketsRetry with backoff
FORBIDDENThis connection is already authenticated as another userOpen 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 (registersRead VIEW) ends with the same refused watch_ack (NOT_AUTHORIZED) a new watch would get. A watch that still passes has its firmware filter updated to the new firmware level.
  • A subscribe_alerts subscription is rebuilt from the new grants and its alerts_summary sent again. If it no longer passes, you get the failed alerts_summary and 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 carries commands and registersWrite NONE, 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), firmware and service: 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:

selidsPlants coveredUnbound stock
allnoneEvery plantEvery device in no plant
orgoperator org idsPlants whose operator is one of idsDevices registered under one of ids
plantsplant idsExactly those plantsNone
tagtag or region tag idsPlants carrying one of idsNone
customercustomer org idsPlants whose customer is one of idsNone
installerinstaller (PARTNER) org idsPlants whose installer is one of ids, whatever their operatorDevices 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:

ClaimSet by the HTTP server for
"sa": truea Super Admin of the Crown platform org
"pa": truean Admin of the Crown platform org
"pm": truea member of the Crown platform org, in any role
"vp": truea 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 (sa or pa) keeps view-only access: devices, alerts and register reads at VIEW, commands and register writes NONE.
  • 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 EDIT or 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.

ToYou need
Watch a device's live data, read_registers, get_registers with includeValues, see a device's latest readingsregistersRead VIEW
List devices, get_registers without values (the catalogue), view history, analytics and the Activity Traildevices 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 themthe 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 readingfirmware 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 taskMANAGE in the command's permission: registersWrite for a setting, commands for a restart
List alerts, subscribe to the live alert feed, mark alerts readalerts VIEW
Acknowledge, resolve or assign an alertalerts 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 on watch) arrives without those keys;
  • lastReadings in get_devices, get_devices_page and get_device_details leaves them out, and get_device_details' firmware field is null with reason needs FIRMWARE VIEW on this device;
  • get_registers leaves those registers out of the catalogue (and their values);
  • read_registers naming 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_activity covers another user's device when you pass its deviceKey, or a granted plant's devices when you pass plantId. 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_read with plantId: "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​

ActionMessageNeeds
Permanently delete a devicedelete_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 plantunbind_device (console)devices MANAGE on the device
Remove from service, and restoreremove_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.

RoleDelete a plantArchive or restore a plantUnbind or remove a devicePermanently delete a device
Crown Super Admin or AdministratorYes, any plantYesYesNo
Business (owner or Business role)Only a plant with no customer (otherwise 403 PLANT_HAS_CUSTOMER)Yes, in bulk tooYesNo
InstallerNoNoYes, with devices MANAGENo
Operations ManagerNoNoNo (devices EDIT)No
Technician, ViewerNoNoNoNo
End User, independent (has their own personal org)Yes, their own plant (mobile or web)YesYesYes, devices they own
End User, connected to a BusinessNo, not a plant where they are the customerYesYesYes, devices they own
Shared user (a plant was shared with them)NeverOnly with a FULL share whose granter set plants to MANAGENo (devices EDIT at most)No
Mobile app admin or viewer (old mobile roles)NoNoNoNo

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 userId in the message. Without a ticket (allowed while WS_AUTH_MODE is optional), delete_device trusts the userId the client sends. The two-step confirmation makes an accidental delete harder, but it is not authentication. Switching to required closes 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:

ModeWithout 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>"}
legacyEverything 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.