---
title: Message reference
section: GT-Link
order: 2
---

<!-- GENERATED by `pnpm --filter @gridtac/gtlink docs` from packages/gtlink. Do not edit by hand. -->

# GT-Link message reference

Protocol `gtl/1`, frozen: fields may be added, never changed or removed.

Every message is JSON with short keys (the same keys are packed as CBOR over LoRa). **Unknown fields are ignored on both sides**, so a newer device never breaks an older server. The JSON Schema for each message carries its `$id` under `https://gridtac.com/gtlink/gtl-1/`. How the pieces fit: [Overview](overview.md).

## Messages

### `hello`: the manifest

`gridtac/dev/<id>/hello` · device to server · QoS 1 · retained

| Field | Type | Required | Meaning |
|---|---|---|---|
| `p` | `"gtl/1"` | yes | Protocol. |
| `m` | string (≤ 48 chars) | yes | Model, vendor-namespaced. gridtac.* is reserved for our reference builds; no registry to apply to. |
| `fw` | string (≤ 32 chars) | yes | Firmware version. |
| `caps` | array of object (≤ 64 items) | yes | Capabilities: inputs, outputs, sensors. |
| `caps[].id` | string | yes | Capability id, chosen by the builder and stable across firmware versions. |
| `caps[].kind` | string | yes | A kind from the vocabulary, or a new one (shown with a generic control, never rejected). |
| `caps[].label` | string (≤ 40 chars) | yes | What the game master sees: "Red button", "Key switch". |
| `caps[].props` | object |  | Kind-specific: e.g. colour for a button, pixels for a strip, positions for a switch. |
| `caps[].role` | string or `arm` \| `disarm` \| `reset` \| `gm` |  | A default the firmware may declare; the GM binding in the app for one game always wins. |
| `caps[].secret` | boolean |  | A keypad whose codes are never logged in clear. |
| `h` | boolean |  | Hidden: expect events plus a long jittered heartbeat, not a steady beat. |

### `evt`: one input event

`gridtac/dev/<id>/evt` · device to server · QoS 1

| Field | Type | Required | Meaning |
|---|---|---|---|
| `b` | integer (0 to 65535) | yes | Boot counter, stored in flash and incremented on every start. |
| `s` | integer (0 to 4294967295) | yes | Sequence number within this boot, from 0. |
| `ms` | integer (≥ 0) | yes | Milliseconds since boot: the device has no trusted clock. |
| `c` | string | yes | Capability id. |
| `e` | string (≤ 16 chars) | yes | Event: press, hold, release, set, code, tag, tripped, cleared, moved, still, hit, value. |
| `x` | number or string (≤ 64 chars) |  | Value: hold ms, switch position, code, tag uid, hit strength, analog value. |
| `z` | string (≤ 16 chars) |  | Zone of a hit. |

### `state`: the device's own state

`gridtac/dev/<id>/state` · device to server · QoS 1 · retained

| Field | Type | Required | Meaning |
|---|---|---|---|
| `b` | integer (0 to 65535) | yes | Boot counter, stored in flash and incremented on every start. |
| `s` | integer (0 to 4294967295) | yes | Sequence number within this boot, from 0. |
| `ms` | integer (≥ 0) | yes | Milliseconds since boot: the device has no trusted clock. |
| `st` | object | yes | The device local state. |
| `st.own` | integer (0 to 3) or null |  | Owner: team slot 0-3, null = neutral. |
| `st.pr` | number (0 to 1) |  | Progress 0-1 (a capture in progress). |
| `st.mo` | string (≤ 24 chars) |  | Mode it runs. |

### `tele`: telemetry

`gridtac/dev/<id>/tele` · device to server · QoS 0

| Field | Type | Required | Meaning |
|---|---|---|---|
| `b` | integer (0 to 65535) | yes | Boot counter, stored in flash and incremented on every start. |
| `s` | integer (0 to 4294967295) | yes | Sequence number within this boot, from 0. |
| `ms` | integer (≥ 0) | yes | Milliseconds since boot: the device has no trusted clock. |
| `bat` | object |  | Battery. |
| `bat.v` | number |  | Volts / version. |
| `bat.pct` | number (0 to 100) |  | Percent. |
| `rssi` | number |  | Received signal strength (dBm). |
| `snr` | number |  | Signal-to-noise ratio (dB). |
| `gps` | object |  | Position. |
| `gps.la` | number (-90 to 90) | yes | Latitude. |
| `gps.lo` | number (-180 to 180) | yes | Longitude. |
| `gps.acc` | number (≥ 0) |  | Accuracy (m). |
| `up` | integer (≥ 0) |  | Uptime (s). |

### `cmd`: a command

`gridtac/dev/<id>/cmd` · server to device · QoS 1

**`k: "config"`**

| Field | Type | Required | Meaning |
|---|---|---|---|
| `id` | string (≤ 24 chars) | yes | Command id; the device echoes it in its ack. |
| `k` | `"config"` | yes | Command kind. |
| `mo` | string (≤ 24 chars) |  | Mode. |
| `set` | object |  | Mode settings: teams per colour, hold time, volume. |

**`k: "set"`**

| Field | Type | Required | Meaning |
|---|---|---|---|
| `id` | string (≤ 24 chars) | yes | Command id; the device echoes it in its ack. |
| `k` | `"set"` | yes | Command kind. |
| `c` | string | yes | Capability id. |
| `a` | string (≤ 16 chars) | yes | Action of the output kind. |
| `args` | object |  | Action arguments: colour, pattern, ms, track, lines. |

**`k: "mode"`**

| Field | Type | Required | Meaning |
|---|---|---|---|
| `id` | string (≤ 24 chars) | yes | Command id; the device echoes it in its ack. |
| `k` | `"mode"` | yes | Command kind. |
| `mo` | string (≤ 24 chars) | yes | The game mode it is about: capture, and later bomb, trigger, score. |
| `a` | string (≤ 16 chars) | yes | What happened in the mode: owner (who holds the zone), answer (a hold accepted or refused). |
| `args` | object |  | owner: {own: slot or null}; answer: {ok, slot, reason?, have?, need?}. |

**`k: "identify"`**

| Field | Type | Required | Meaning |
|---|---|---|---|
| `id` | string (≤ 24 chars) | yes | Command id; the device echoes it in its ack. |
| `k` | `"identify"` | yes | Command kind. |
| `ms` | integer (0 to 60000) |  | How long to blink and beep. |

**`k: "disable"`**

| Field | Type | Required | Meaning |
|---|---|---|---|
| `id` | string (≤ 24 chars) | yes | Command id; the device echoes it in its ack. |
| `k` | `"disable"` | yes | Command kind. |
| `on` | boolean | yes | true = all outputs off and inputs ignored for this game. |

**`k: "update"`**

| Field | Type | Required | Meaning |
|---|---|---|---|
| `id` | string (≤ 24 chars) | yes | Command id; the device echoes it in its ack. |
| `k` | `"update"` | yes | Command kind. |
| `fw` | string (≤ 32 chars) | yes | The firmware version available. |
| `url` | string |  | Where to fetch it, when the device updates itself. |

### `ack`: the answer to a command

`gridtac/dev/<id>/ack` · device to server · QoS 1

| Field | Type | Required | Meaning |
|---|---|---|---|
| `id` | string (≤ 24 chars) | yes | Command id (echoed in the ack). |
| `ok` | boolean | yes | Command succeeded. |
| `err` | string (≤ 32 chars) |  | unknown_output, unknown_action, busy, ... |

### `lwt`: last will

`gridtac/dev/<id>/lwt` · device to server · QoS 1 · retained (set as the MQTT last will)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `on` | boolean | yes | Online / on. |

### `game`: the game clock

`gridtac/dev/<id>/game` · server to device · QoS 1 · retained

| Field | Type | Required | Meaning |
|---|---|---|---|
| `v` | `1` | yes | Volts / version. |
| `g` | string (≤ 48 chars) or null | yes | Game id; null when not assigned (the device shows "not in a game"). |
| `ph` | `draft` \| `scheduled` \| `live` \| `paused` \| `ended` | yes | Phase. |
| `srv` | integer | yes | Server time, epoch ms. |
| `sa` | integer or null |  | Scheduled kickoff. |
| `ea` | integer or null |  | Scheduled or set ENDEX. |
| `tm` | array of object (≤ 16 items) |  | Timers. |
| `tm[].id` | string (≤ 16 chars) | yes | Command id (echoed in the ack). |
| `tm[].l` | string (≤ 40 chars) | yes | Label. |
| `tm[].ea` | integer | yes | Ends at (epoch ms). |
| `tm[].phy` | boolean |  | Physical timer: keeps running through a GM pause (a bomb). |
| `pa` | integer or null |  | Paused at, or null. |

### HTTPS: the request body

`POST /api/v1/prop/events` · device to server

| Field | Type | Required | Meaning |
|---|---|---|---|
| `evts` | array of object (≤ 100 items) | yes |  |
| `evts[].b` | integer (0 to 65535) | yes | Boot counter, stored in flash and incremented on every start. |
| `evts[].s` | integer (0 to 4294967295) | yes | Sequence number within this boot, from 0. |
| `evts[].ms` | integer (≥ 0) | yes | Milliseconds since boot: the device has no trusted clock. |
| `evts[].c` | string | yes | Capability id. |
| `evts[].e` | string (≤ 16 chars) | yes | Event: press, hold, release, set, code, tag, tripped, cleared, moved, still, hit, value. |
| `evts[].x` | number or string (≤ 64 chars) |  | Value: hold ms, switch position, code, tag uid, hit strength, analog value. |
| `evts[].z` | string (≤ 16 chars) |  | Zone of a hit. |
| `state` | object |  |  |
| `state.b` | integer (0 to 65535) | yes | Boot counter, stored in flash and incremented on every start. |
| `state.s` | integer (0 to 4294967295) | yes | Sequence number within this boot, from 0. |
| `state.ms` | integer (≥ 0) | yes | Milliseconds since boot: the device has no trusted clock. |
| `state.st` | object | yes | The device local state. |
| `state.st.own` | integer (0 to 3) or null |  | Owner: team slot 0-3, null = neutral. |
| `state.st.pr` | number (0 to 1) |  | Progress 0-1 (a capture in progress). |
| `state.st.mo` | string (≤ 24 chars) |  | Mode it runs. |
| `tele` | object |  |  |
| `tele.b` | integer (0 to 65535) | yes | Boot counter, stored in flash and incremented on every start. |
| `tele.s` | integer (0 to 4294967295) | yes | Sequence number within this boot, from 0. |
| `tele.ms` | integer (≥ 0) | yes | Milliseconds since boot: the device has no trusted clock. |
| `tele.bat` | object |  | Battery. |
| `tele.bat.v` | number |  | Volts / version. |
| `tele.bat.pct` | number (0 to 100) |  | Percent. |
| `tele.rssi` | number |  | Received signal strength (dBm). |
| `tele.snr` | number |  | Signal-to-noise ratio (dB). |
| `tele.gps` | object |  | Position. |
| `tele.gps.la` | number (-90 to 90) | yes | Latitude. |
| `tele.gps.lo` | number (-180 to 180) | yes | Longitude. |
| `tele.gps.acc` | number (≥ 0) |  | Accuracy (m). |
| `tele.up` | integer (≥ 0) |  | Uptime (s). |

### HTTPS: the response

`POST /api/v1/prop/events` · server to device

| Field | Type | Required | Meaning |
|---|---|---|---|
| `accepted` | integer (≥ 0) | yes |  |
| `cmds` | array of object or object or object or object or object or object | yes |  |
| `game` | object | yes |  |
| `game.v` | `1` | yes | Volts / version. |
| `game.g` | string (≤ 48 chars) or null | yes | Game id; null when not assigned (the device shows "not in a game"). |
| `game.ph` | `draft` \| `scheduled` \| `live` \| `paused` \| `ended` | yes | Phase. |
| `game.srv` | integer | yes | Server time, epoch ms. |
| `game.sa` | integer or null |  | Scheduled kickoff. |
| `game.ea` | integer or null |  | Scheduled or set ENDEX. |
| `game.tm` | array of object (≤ 16 items) |  | Timers. |
| `game.tm[].id` | string (≤ 16 chars) | yes | Command id (echoed in the ack). |
| `game.tm[].l` | string (≤ 40 chars) | yes | Label. |
| `game.tm[].ea` | integer | yes | Ends at (epoch ms). |
| `game.tm[].phy` | boolean |  | Physical timer: keeps running through a GM pause (a bomb). |
| `game.pa` | integer or null |  | Paused at, or null. |

### Gateway `up`

`gridtac/gw/<gwid>/up` · gateway to server · QoS 1 (from 1.8)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `fr` | array of object (≤ 50 items) | yes | The frames heard since the last batch. |
| `fr[].a` | string | yes | The prop radio address from the frame header. |
| `fr[].rssi` | number | yes | dBm |
| `fr[].snr` | number | yes | dB |
| `fr[].at` | integer | yes | Gateway receive time, epoch ms (as the gateway knows it). |
| `fr[].f` | string (≤ 400 chars) | yes | The received frame bytes, base64: header in clear plus ciphertext and tag. |

### Gateway `down`

`gridtac/gw/<gwid>/down` · server to gateway · QoS 1 (from 1.8)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `a` | string | yes | The prop radio address to send to. |
| `f` | string (≤ 400 chars) | yes | The frame to transmit, base64, already encrypted by the server with the prop key. |
| `nb` | integer |  | Not before, epoch ms. |

### Gateway `tele`

`gridtac/gw/<gwid>/tele` · gateway to server (from 1.8)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `bat` | object |  | Battery. |
| `bat.v` | number |  | Volts / version. |
| `bat.pct` | number (0 to 100) |  | Percent. |
| `link` | `wifi` \| `4g` \| `ethernet` \| `other` |  | Uplink kind. |
| `heard` | integer (≥ 0) |  | Props heard in the last minute. |
| `bad` | integer (≥ 0) |  | Invalid frames (failed tag) in the last minute. |
| `up` | integer (≥ 0) |  | Uptime, s. |

### Beacon `pos` (radio type 8)

inside an encrypted LoRa frame · beacon to server, through a gateway (from 1.8)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `ms` | integer (≥ 0) |  | Milliseconds since boot (optional). |
| `la` | number (-90 to 90) | yes | Latitude, degrees (WGS84). |
| `lo` | number (-180 to 180) | yes | Longitude, degrees (WGS84). |
| `acc` | number (0 to 10000) |  | Horizontal accuracy, m. |
| `bat` | number (0 to 100) |  | Battery, percent. |
| `spd` | number (0 to 200) |  | Ground speed, m/s. |
| `crs` | number (0 to 360) |  | Course, degrees. |

### Beacon `sos` (radio type 9)

inside an encrypted LoRa frame · beacon to server, through a gateway (from 1.8)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `ms` | integer (≥ 0) |  | Milliseconds since boot (optional). |
| `on` | boolean | yes | true raises an SOS, false clears the own SOS. |
| `la` | number (-90 to 90) |  | Latitude. |
| `lo` | number (-180 to 180) |  | Longitude. |

### Beacon `status` (radio type 10)

inside an encrypted LoRa frame · beacon to server, through a gateway (from 1.8)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `ms` | integer (≥ 0) |  | Milliseconds since boot (optional). |
| `ps` | `alive` \| `hit` \| `down` \| `medic` \| `out` \| `respawn` | yes | Player status. |

## Short keys

| Key | Meaning |
|---|---|
| `p` | protocol (gtl/1) |
| `m` | model, vendor-namespaced (gridtac.box, acme.flagpole) |
| `fw` | firmware version |
| `caps` | capabilities |
| `h` | hidden: transmits only on events plus a long jittered heartbeat |
| `b` | boot counter (stored in flash, +1 on every start) |
| `s` | sequence number within this boot (from 0) |
| `ms` | milliseconds since boot |
| `c` | capability id |
| `e` | event name (press, hold, set, tag, hit, ...) |
| `x` | event value (hold ms, switch position, code, tag uid, strength, analog value) |
| `z` | zone (a hit) |
| `st` | the device local state |
| `own` | owner: team slot 0-3, or null for neutral |
| `pr` | progress 0-1 |
| `mo` | mode |
| `bat` | battery |
| `v` | volts / version |
| `pct` | percent |
| `rssi` | received signal strength (dBm) |
| `snr` | signal-to-noise ratio (dB) |
| `gps` | position |
| `la` | latitude |
| `lo` | longitude |
| `acc` | accuracy (m) |
| `up` | uptime (s) |
| `id` | command id (echoed in the ack) |
| `k` | command kind |
| `a` | action |
| `ok` | command succeeded |
| `err` | error code |
| `on` | online / on |
| `g` | game id, or null when not assigned |
| `ph` | phase |
| `srv` | server time (epoch ms) |
| `sa` | starts at (epoch ms) |
| `ea` | ends at (epoch ms) |
| `tm` | timers |
| `l` | label |
| `phy` | physical timer: keeps running through a GM pause (a bomb) |
| `pa` | paused at (epoch ms), or null |
| `ps` | player status (a beacon over LoRa): alive, hit, down, medic, out, respawn |

## Capability kinds

A manifest lists capabilities, each with an `id` you choose (at most 16 characters: a board's port name works), a `kind`, a `label` and kind-specific `props`. **A kind not listed here is accepted**, shown with a generic control and logged, never rejected.

**Inputs** (device to server, sent as `evt` with these event names in `e`):

| Kind | Events |
|---|---|
| `button` | `press`, `hold`, `release` |
| `switch` | `set` |
| `keypad` | `code` |
| `rfid` | `tag` |
| `trigger` | `tripped`, `cleared` |
| `motion` | `moved`, `still` |
| `hit` | `hit` |
| `analog` | `value` |

**Outputs** (server to device, sent as `cmd` with `k: "set"` and these actions in `a`):

| Kind | Actions |
|---|---|
| `rgb` | `set` |
| `strip` | `fill`, `progress`, `pattern` |
| `buzzer` | `tone` |
| `siren` | `on`, `off`, `pattern` |
| `audio` | `play`, `stop`, `volume` |
| `display` | `text`, `countdown` |
| `relay` | `on`, `off`, `pulse` |
| `lock` | `lock`, `unlock`, `pulse` |
| `motor` | `run`, `stop` |

**Sensors** (device to server, in `tele`): `battery`, `rssi`, `snr`, `gps`, `temperature`, `humidity`, `light`, `uptime`, `custom`.

**Roles**: `team:0` to `team:3` (that team slot's capture input), `arm`, `disarm`, `reset`, `gm` (a key only the game master uses). The firmware may declare a default (a red button that means team 0); the game master's binding for a game always wins.
