# GridTac docs > GridTac is a free tactical map and command platform for airsoft and milsim: a player app for iOS and Android, a web console for commanders and game masters, an open HTTP API for scripts, dashboards and bots, and GT-Link, an open protocol for props and beacons. The API, GT-Link and hardware support are in beta: they work, and may still change before they are announced. Breaking changes are noted on these pages first. --- source: https://gridtac.com/docs/api/authentication.md --- # Authentication and API keys The GridTac API (`https://api.gridtac.com/api/v1`) is for scripts, dashboards, bots and devices that work with a game. Every call carries an **API key**: ```http GET /api/v1/whoami Authorization: Bearer gt_dash_k7q2m9x4h3pd_Zx81… ``` ## Who can create keys Keys are made on [gridtac.com](https://gridtac.com) under **API & hardware → API keys** in the account menu, top right (or with `POST /api/v1/keys`, below). Spectator links are the exception: the game master makes those in the game's settings. You create keys while signed in to GridTac, on an account that has **two-factor authentication turned on, or that signs in only with Google or Apple**. An account with a password and no two-factor cannot create keys, and if two-factor is later turned off, that account's keys stop working until it is turned back on. Creating or rotating a key also needs a sign-in from the last 15 minutes. ## Kinds of key A key belongs to one game and does one job. The kind is part of the key, so you can tell what a leaked key could do just by reading it. | Kind | Prefix | What it is for | Who creates it | Sees | |---|---|---|---|---| | Player | `gt_play_` | Your own device or script in a game you play in | You, in that game | What you see in the app | | Team | `gt_team_` | A team's own board or bot | The game master (any team) or that team's commander (own team) | What that team's commander sees | | Dashboard | `gt_dash_` | A spectator screen | The game master | Score, zones, phase and clock; no positions unless the GM allows them with a delay | | Prop | `gt_prop_` | A device in the game (a domination box, a beacon) | Issued when the device is paired, not created by hand | Only its own commands | | Spectator link | `gt_link_` | A screen with no account: gridtac.com/watch#gt_link_… | The game master, in the game's settings (Map permissions) | Exactly what a dashboard key sees ([Spectator link](dashboard.md#spectator-link)) | There is no key that sees everything. A key never sees more than the person it stands for. Team and dashboard keys and spectator links stop working 24 hours after their game ends. Player keys work until you revoke them. ## Managing keys These calls use your normal signed-in session, not an API key. | Call | What it does | |---|---| | `POST /api/v1/keys` `{ kind, label, gameId, teamId? }` | Creates a key. **The response is the only time you see the full key**; store it somewhere safe. | | `GET /api/v1/keys` | Your keys, shown by prefix and status (`active`, `paused`, `revoked`, `blocked`, `expired`), never their secret. | | `POST /api/v1/keys/{id}/rotate` | A new secret for the same key. The old secret stops working at once. | | `DELETE /api/v1/keys/{id}` | Revokes the key. A game master can also revoke keys bound to their game, spectator links included: the game's settings list every key bound to it (who made it, for which side, when it was last used). | **A key follows its maker's place in the game.** It is checked again on every call, and in every webhook delivery: a team key works while its maker is the game master or that team's commander, a dashboard key while its maker is a game master, a player key while its player is the maker. Moved to another side, no longer commander, kicked, or an account suspended: the key answers `key_owner_lost` until that is true again (within a few seconds of the change). Spectator links are made and listed on the game's page, not with these calls: `POST /api/v1/keys` refuses `kind: "link"` with `kind_not_creatable`, and `GET /api/v1/keys` does not list them. At most 10 new keys an hour per account, and at most 10 team and dashboard keys per game. ## Rate limits Limits are per key, per minute, per kind of call. Every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds to the next window). | Key | Budget per minute | |---|---| | Player | reads 60, position 30 (one every 2 s), status 10, SOS 6, marks 20, order acknowledgements 60 | | Team | reads 60, webhooks 30 | | Dashboard | reads 120, webhooks 30 | | Spectator link | reads 120 (shared by every screen on the link) | | Prop | reads 60, events 60 (an HTTPS batch is one call), MQTT input events 120 (each message) | Over the budget you get `429 rate_limited` with `Retry-After`. A key that keeps going past its budget (20 refused calls within 10 minutes) is **paused for 15 minutes**, and the game master is told. Three pauses in a day **block** the key until GridTac support lifts it. Limits act only on the key: they never change anything in the game. ## Checking a key ```http GET /api/v1/whoami Authorization: Bearer gt_… ``` ```json { "keyId": "…", "kind": "dash", "label": "Scoreboard", "gameId": "…", "teamId": null } ``` ## Keeping keys safe - Treat a key like a password. Do not put it in a public repository, a screenshot or a URL. - The `gt_` prefix is easy to find for secret scanners; if one turns up somewhere it should not be, rotate or revoke it. - GridTac stores only a keyed hash of each key. Nobody at GridTac can show you a lost key: rotate it to get a new one. Errors are described in [Errors](errors.md). --- source: https://gridtac.com/docs/api/team.md --- # Team view One team's picture of the game, exactly as that team's commander sees it in the app: your own players on the map, your markers and drawings, the orders to your team, the zones your side can see, the score as far as the game master shows it, and the events meant for your team. For a team's own board, a bot in your Discord, or a big map at your base. ```http GET /api/v1/team Authorization: Bearer gt_team_… ``` Needs a **team key** (`gt_team_`), made by the game master (for any team) or by that team's commander (for their own team). See [Authentication](authentication.md). **Handle a team key like your team's radio.** It carries your players' live positions. Keep it off public screens and out of streams; use a [dashboard key](dashboard.md) for those. ## Response ```json { "game": { "id": "…", "name": "…", "phase": "live", "paused": false, "startedAt": "…", "endsAt": "…" }, "team": { "id": "…", "name": "Blue", "color": "#6E9BD1" }, "serverTime": "…", "scoreVisibility": "full", "score": [{ "id": "…", "name": "Blue", "color": "#6E9BD1", "points": 420 }], "zones": [{ "id": "…", "name": "ALPHA", "ownerTeamId": "…", "geometry": { "type": "Point", "coordinates": [13.0, 55.6] } }], "units": [{ "callsign": "HAWK", "point": { "lat": 55.6, "lon": 13.0, "ce": 5 }, "status": "alive", "…": "…" }], "lastKnown": [], "markers": [], "graphics": [], "orders": [], "orderAcks": [], "events": [{ "type": "zone_captured", "at": "…", "actor": "HAWK", "summary": "…" }] } ``` | Field | Meaning | |---|---| | `units` | Your team's players with their latest position and status, plus any enemy your side has spotted with a UAV, exactly as the commander's map shows them. | | `lastKnown` | Players of your team who stopped reporting, at their last position. | | `markers`, `graphics` | Your team's markers and drawings, and the game master's markers for everyone. | | `orders`, `orderAcks` | Orders to your team and who acknowledged them. | | `zones` | The active zones your side can see, with the team that holds each. | | `score` | Every side when the game master shows the full score, only yours when it is "own side", none when it is hidden. All sides once the game has ended. | | `events` | The 50 latest events meant for your team. | ## What it never shows The other side's players, markers, orders and events, zones hidden from your side, and chat. A team key never sees more than your commander does. ## Freshness Not cached: every call reads the live game. A team key may read 60 times a minute ([rate limits](authentication.md#rate-limits)); polling every 5 to 10 seconds is plenty. --- source: https://gridtac.com/docs/api/dashboard.md --- # Dashboard The spectator view of one game: the score, who holds which zone, the phase and the clock, and the big moments. Made for a screen at the base, a scoreboard on a stream, or a Discord bot. It shows where players are only if the game master turns that on, and then only as they were several minutes ago ([Delayed positions](#delayed-positions)). ```http GET /api/v1/dashboard Authorization: Bearer gt_dash_… ``` Needs a **dashboard key** (`gt_dash_`), which only the game master can create ([Authentication](authentication.md)). The key belongs to one game; the dashboard is that game's. ## Response ```json { "game": { "id": "…", "name": "Operation Northwind", "phase": "live", "paused": false, "startsAt": "2026-11-14T08:00:00.000Z", "startedAt": "2026-11-14T08:03:12.000Z", "endsAt": "2026-11-14T15:00:00.000Z" }, "serverTime": "2026-11-14T10:41:07.000Z", "scoreVisible": true, "teams": [ { "id": "…", "name": "Blue", "color": "#6E9BD1", "points": 420 }, { "id": "…", "name": "Red", "color": "#D16E6E", "points": 385 } ], "zones": [{ "id": "…", "name": "ALPHA", "ownerTeamId": "…" }], "events": [{ "type": "zone_captured", "at": "2026-11-14T10:38:55.000Z", "summary": "Blue took ALPHA" }], "positions": null } ``` | Field | Meaning | |---|---| | `game.phase` | `draft`, `scheduled`, `live`, `paused` or `ended`. | | `game.paused` | The game master has paused the game clock. | | `serverTime` | Use it to draw countdowns to `startsAt` and `endsAt` without trusting the viewer's clock. | | `scoreVisible` | `false` when the game master has hidden the score; `points` is then `null` for every team. Always `true` once the game has ended. | | `zones` | The active zones every side can see, with the team that holds each (`null` = nobody). A zone the game master hid from a side is not listed. | | `events` | The 20 latest moments meant for everyone: zones taken and lost, hot zones, hold bonuses, delivered items, a side out of tickets, the game paused and resumed, a UAV or EMP fired or ended (with the sides by name). | | `positions` | `null` unless the game master shows delayed positions; see below. | ## Live, or running behind The dashboard has two modes, set by the game master in the game's settings (Map permissions, "Spectator dashboard"): - **No positions (the default): live.** The score, the zones, running UAVs and EMPs and the latest moments as they happen. Made for games that need no map, such as indoor games. - **Positions with a delay of N minutes: the whole screen runs N minutes behind.** Not only the positions: the score, who holds which zone, the UAVs and EMPs and the moments are all as they were N minutes ago, like an after-action review running late. A screen at the base can then never help anyone ghost. | Field | Meaning | |---|---| | `delayMin` | `null` when live; else how many minutes behind everything in the answer is. | | `asOf` | The moment the answer shows: `serverTime`, or about `serverTime` minus the delay. | | `waitingUntil` | Running behind and there is no picture that old yet (the delay was just turned on, or the game just started): when there will be one. Until then `teams` has no points and `zones`, `effects` and `events` are empty. | | `effects` | Running UAVs and EMPs: `kind` (`uav` or `emp`), the side that fired it (`teamId`), `targetTeamIds`, `radiusM` (`null` for a whole side; where the circle is never shows) and `leftSec`, the seconds left at `asOf`. | | `area` | `[west, south, east, north]` around what every side may see of the play area, to frame a map. `null` when the game has no map or zones. | UAVs and EMPs show on the dashboard for every side, also when only the side that fired it was told in the app. ## Delayed positions Off by default. The game master can turn them on in the game's settings (Map permissions, "Spectator dashboard") with a delay of 5, 10, 15 or 30 minutes (the server accepts any whole number from 5 to 120). `positions` is then: ```json "positions": { "delayMin": 10, "asOf": "2026-11-14T10:31:07.000Z", "units": [ { "callsign": "HAWK", "teamId": "…", "point": { "lat": 55.6012, "lon": 13.0034 }, "at": "2026-11-14T10:30:58.000Z" } ] } ``` | Field | Meaning | |---|---| | `delayMin` | How far back the positions are. Never less than 5 minutes. | | `asOf` | The moment shown: `serverTime` minus the delay. | | `units` | Every player's last position at or before `asOf`, with their side. A player who had not reported for three minutes before `asOf` is left out. `at` is when that position was taken. | The positions come from the game's position history, never from the live map: nothing newer than `asOf` is in the answer. There is no health, status or role, and no positions before the game starts. ## Spectator link For a TV at the base or a stream there is no need for a key or a script: the game master makes a **spectator link** in the game's settings (Map permissions, "Spectator link") and opens it on any screen. It looks like `https://gridtac.com/watch#gt_link_…`, needs no account, and shows this same dashboard, big enough to read across a room. The game master can turn a link off at any time, and every screen on it says so within seconds. - Anyone who has the link sees the screen, so share it like a key. The part after `#` never leaves the viewer's browser in a request line, so it does not end up in server logs. - A link is a key of kind `link` (`gt_link_`): it reads `GET /api/v1/dashboard` like a dashboard key and nothing else, on the same budget, shared by every screen on that link. The page polls every 10 seconds and follows `Retry-After`. - At most five live links per game. A link stops working 24 hours after its game ends. - Making one needs the game master's sign-in, not two-factor: the link shows only what this page shows, which never includes anything live about a player. ## What it never shows Live positions, players' status, callsigns of anyone in trouble, SOS calls, orders, chat, and anything the game master shows to one side only. A dashboard key sees less than any player. ## Freshness The dashboard is rebuilt at most every 5 seconds per game and shared by every viewer, so poll it every 5 to 10 seconds. A dashboard key may read 120 times a minute ([rate limits](authentication.md#rate-limits)). --- source: https://gridtac.com/docs/api/play.md --- # Player view What you see in the GridTac app, for your own device or script: your own unit and status, your team on the map, the markers, drawings and orders you can see, the zones your side can see, the score as far as the game master shows it, and the events meant for your team. ```http GET /api/v1/play Authorization: Bearer gt_play_… ``` Needs a **player key** (`gt_play_`) that you create yourself for a game you play in ([Authentication](authentication.md)). It is bound to you in that one game. ## Response The same shape as the [team view](team.md), plus who you are: ```json { "me": { "playerId": "…", "callsign": "HAWK", "role": "soldier", "platoon": "1st", "squad": "Alpha", "unit": { "callsign": "HAWK", "point": { "lat": 55.6, "lon": 13.0, "ce": 5 }, "status": "alive" } }, "game": { "…": "…" }, "team": { "id": "…", "name": "Blue", "color": "#6E9BD1" }, "units": [], "markers": [], "orders": [], "zones": [], "score": [], "events": [] } ``` `me.unit` is your own latest position and status as the server holds it (`null` before your first report). ## The same view as your app, never more The orders, markers and chat channels you see depend on your squad, platoon and role, exactly as in the app: a squad leader sees their squad's traffic, a platoon leader their platoon's. **A game master who also plays gets their side's view through a player key, not the game master's view of everything**: there is no key that sees the whole game. Chat is not part of the API in this version. ## Freshness Not cached. A player key may read 60 times a minute ([rate limits](authentication.md#rate-limits)). ## Writing: your position and status A beacon or a script can report for you, through exactly the same path as your phone: the same checks on who you are, on order, and on whether a position is believable before it counts for a zone or a respawn. A beacon's own key (a paired device) does what a beacon does: position, status and SOS. It does not read this view, place marks or acknowledge orders (`device_key_scope`), so whoever holds the key of a beacon you carry cannot see your side's map. A beacon a club lends you reports for you only once you accept the loan ([Devices](devices.md)). ```http POST /api/v1/play/position Authorization: Bearer gt_play_… Content-Type: application/json { "point": { "lat": 55.6012, "lon": 13.0034, "hae": 21, "ce": 6 }, "speed": 1.2, "course": 85, "battery": 77 } ``` ```http POST /api/v1/play/status Authorization: Bearer gt_play_… Content-Type: application/json { "status": "hit" } ``` | Field | Meaning | |---|---| | `point.lat`, `point.lon` | Position in WGS84 degrees. | | `point.ce` | Horizontal accuracy in metres (the circle the true position is in). Be honest: a fix worse than the game's limit does not count for zones. | | `point.hae` | Height in metres, optional. | | `speed`, `course`, `battery` | Optional: m/s, degrees, percent. | | `status` | `alive`, `hit`, `down`, `medic`, `out` or `respawn`, the same choices as the app. | Both answer `202 Accepted`: the report is on its way into the game. The server stamps the time. Budgets: position 30 a minute (one every 2 seconds), status 10 a minute. The game master can turn off player devices for a game (game settings, Map permissions, "Player devices": Phones only); writes then answer `player_devices_off` (reading still works). Use one position source at a time: your phone or your beacon, not both. ## Writing: SOS A beacon can raise an SOS for you. It is the same SOS as the app's red button: everyone in the game gets the alert and the map marker, whatever side they are on, and a push wakes their phones. ```http POST /api/v1/play/sos Authorization: Bearer gt_play_… Content-Type: application/json { "point": { "lat": 55.6012, "lon": 13.0034 }, "approx": false } ``` Answers `201 Created` with the marker's `uid`, `point` and `time`. - `approx`: set it when your fix is weak (worse than about 100 m). The marker then tells the helpers to search wider. - **The server checks the point.** If it holds a fix of you from the last two minutes that is far from the point you send, the SOS is placed at the server's fix. An SOS cannot be dropped anywhere on the map. - **One SOS per player.** A new one replaces your previous one. - An SOS works before the game goes live, as in the app; only an ended game refuses it. The player clears their own SOS when help has arrived or it was a mistake: ```http DELETE /api/v1/play/sos Authorization: Bearer gt_play_… ``` Answers `{ "cleared": 1 }` (how many were cleared; `0` if there was none). The game master can clear anyone's SOS in the app. Budget: 6 SOS calls a minute, shared by all of a player's keys and beacons. If the game master has turned off player devices, the key's SOS is refused with `player_devices_off`: the phone's own SOS button always works. ## Writing: WILCO Acknowledge an order, the same as tapping WILCO in the app: ```http POST /api/v1/play/orders/{uid}/ack Authorization: Bearer gt_play_… ``` `uid` is the order's `uid` from [`GET /api/v1/play`](#response). Answers `204 No Content` once the acknowledgement is recorded; the leader who gave the order sees it at once. A player key acknowledges as the player it belongs to, never as a game master, so only orders sent to that player can be acknowledged. Any other `uid` answers `order_not_found`, whether the order exists on another side or not at all. Budget: 60 a minute. ## Writing: marks Put a mark on your side's map, the same as placing one in the app. ```http POST /api/v1/play/marks Authorization: Bearer gt_play_… Content-Type: application/json { "marker": "enemy", "point": { "lat": 55.6012, "lon": 13.0034 }, "label": "MG nest", "note": "two players, facing north" } ``` | Field | Meaning | |---|---| | `marker` | The kind: `enemy`, `friendly`, `objective`, `hazard`, `bomb`, `spot`, `rally`, `vehicle`, `building`, `box`, `fob`, `hq`, `medevac` or `waypoint`. | | `point` | Where, in WGS84 degrees. | | `label`, `note` | Optional: a short name (120 characters) and a longer note (500). | | `color` | Optional: `#rrggbb`. | | `deadline` | Optional: a countdown target in epoch milliseconds; your side gets a push. | | `uid` | Optional: your own id for the mark (letters, digits, `-` and `_`, up to 64). Send the same `uid` again to move or change your mark. Left out, the server makes one. | Answers `201 Created` with the mark as your side sees it. - **The game's marker rule decides.** The game master chooses who may place marks: the commander, the leaders, or everyone. A player who may not gets `marks_not_allowed`. A game master who also plays places marks as their player, not as the game master. - **Your side only.** The mark is on your side's map, never the other side's. You cannot choose another side, and the sender is always you. - **Only your own.** You cannot change or remove someone else's mark (`not_your_mark`). - An SOS is not a mark: use [`POST /api/v1/play/sos`](#writing-sos). Remove your own mark: ```http DELETE /api/v1/play/marks/{uid} Authorization: Bearer gt_play_… ``` Answers `204 No Content`. Budget: 20 mark calls a minute. --- source: https://gridtac.com/docs/api/webhooks.md --- # Webhooks Get the game's moments pushed to your own server as they happen: a Discord bot that posts "Blue took ALPHA", a siren at the base when a side runs out of tickets, a club page that keeps a live log. No need to keep a connection open or to poll. A webhook belongs to the **key that registers it** and hears exactly what that key may read: | Key | Hears | |---|---| | Team key (`gt_team_`) | The events of the [team view](team.md): everything meant for that team or for everyone. Never another side's, never the game master's own, never chat. | | Dashboard key (`gt_dash_`) | The events of the [dashboard](dashboard.md): zones taken and lost, hot zones, hold bonuses, delivered items, a side out of tickets, the game paused and resumed, UAVs and EMPs. Never who did it. When the game master runs the dashboard behind (a delay of N minutes), each event arrives N minutes late, like on the dashboard. | Revoke the key and its webhooks go quiet. At most 5 webhooks per key. ## First, get a key 1. Sign in on [gridtac.com](https://gridtac.com). Keys need **two-factor authentication** (or an account that signs in only with Google or Apple): turn it on in **Account** first if it is off. 2. Open **API & hardware** in the account menu and choose the kind: **"Team: one team's board or bot"** for one side's events (you must be its commander, or the game master) or **"Dashboard: a spectator screen"** for the public picture (game master only). Pick the game (and the team), give the key a name such as "Discord bot", and press **Create key**. 3. Copy the key (`gt_team_…` or `gt_dash_…`) right away: it is shown only once. Keep it out of your code repository. More on keys and their limits: [Authentication](authentication.md). ## Register ```http POST /api/v1/webhooks Authorization: Bearer gt_team_… Content-Type: application/json { "url": "https://bot.example.com/gridtac", "events": ["zone_captured", "zone_neutralised"] } ``` `events` is optional: leave it out to get every type the key may hear. The answer carries the webhook and its **secret** (`whsec_…`). It is shown only this once: store it with your receiver. The URL must be `https://` on the public internet. Private, loopback, link-local and reserved addresses are refused (`url_not_allowed`), also if a name later starts pointing at one. Redirects are not followed. ## What arrives ```http POST /gridtac Content-Type: application/json User-Agent: GridTac-Webhooks/1 GridTac-Event: zone_captured GridTac-Webhook-Id: 7b0c… GridTac-Delivery-Id: 3f1e… GridTac-Signature: t=1794041632,v1=5d2c… { "deliveryId": "3f1e…", "webhookId": "7b0c…", "gameId": "a91f…", "event": { "id": "c0de…", "type": "zone_captured", "at": "2026-11-14T10:38:55.000Z", "summary": "Blue took ALPHA", "actor": "BLUE2" } } ``` `actor` is there for a team key only. Answer with any `2xx` within 5 seconds; do the slow work after you have answered. Use `event.id` to ignore a repeat: a delivery can arrive twice if your answer was lost on the way back. ## Check the signature Every delivery is signed. Before trusting one, compute HMAC-SHA256 over `.` with your secret and compare it to `v1`, and refuse a `t` more than five minutes from your clock: that stops someone from replaying an old delivery. ```js import { createHmac, timingSafeEqual } from 'node:crypto'; function verify(secret, header, rawBody) { const parts = Object.fromEntries(header.split(',').map((p) => p.split('='))); const t = Number(parts.t); if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300) return false; const expected = Buffer.from(createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex')); const given = Buffer.from(parts.v1 ?? ''); return expected.length === given.length && timingSafeEqual(expected, given); } ``` Use the raw body exactly as it arrived, before any JSON parsing. ## Retries and the delivery log A delivery that does not get a `2xx` is tried again after 10 seconds, 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours, then marked failed. After 50 failed deliveries in a row the webhook is switched off; its `status` says `disabled` and `disabledReason` says why. Register it again once your receiver works. | Call | What it does | |---|---| | `GET /api/v1/webhooks` | This key's webhooks, never their secrets. | | `GET /api/v1/webhooks/{id}/deliveries` | The latest 50 deliveries with each outcome: your HTTP status, or why your server could not be reached. Kept for 14 days. | | `POST /api/v1/webhooks/{id}/ping` | A signed `ping` delivery, to test your receiver. | | `DELETE /api/v1/webhooks/{id}` | Stops it, retries included. | These calls count against the key's `manage` budget, 30 a minute ([rate limits](authentication.md#rate-limits)). Events start from the moment the webhook is registered; earlier events are in the [team view](team.md) and the [dashboard](dashboard.md). --- source: https://gridtac.com/docs/api/devices.md --- # Devices A beacon (a player's position from a GPS box on the vest) or a prop (a capture box, a mine, a target) gets **its own key** when it is paired. A person's password, session or API key never goes into hardware, and a device key can be revoked on its own. | Kind | Its key | What it does | |---|---|---| | `beacon` | `gt_play_` | Reports as the player who carries it, in the game it is assigned to. **Your own beacon needs no assigning:** its first post binds it to the live game you play (with several, the one you were last heard in), and it moves with you when you play another; a club beacon still needs a loan. It reports position, status and SOS through the [Player view](play.md) calls. It never reads the side's picture, places marks or acknowledges orders (`device_key_scope`): whoever holds a beacon's key, such as the club that owns it, cannot see the player's map or speak for them beyond the beacon's own reports. Its positions outrank the player's phone: for 30 s after a beacon position, the phone's positions are not used (its status and SOS still are). The player's entity then carries `src: "beacon"` in the team and dashboard views, and the GridTac app stops reading GPS while it does. | | `prop` | `gt_prop_` | An object in the game, speaking GT-Link (the device protocol, published separately). | | `gateway` | `gt_gw_` | **BETA, for LoRa from 1.8.** A radio on the field that forwards the encrypted frames of LoRa beacons and props to GridTac. It holds none of their keys, cannot read or change what they send, and never acts in a game itself. See [A gateway online](#a-gateway-online). | A device is owned by **a player** or by **a club**. A club beacon is lent to a member for one game, only once the member accepts that loan, and comes back to the club by itself when that game ends. Every pairing, loan, answer and return is logged. ## Pairing a device that has a screen and internet The device shows a code, and you type it into GridTac: the same way you connect a TV to a streaming service (OAuth device authorization, RFC 8628). **1. The device asks for a code** (no key yet): ```http POST /api/v1/devices/announce Content-Type: application/json { "kind": "beacon", "model": "acme.beacon", "fw": "1.0.0" } ``` ```json { "userCode": "KX7M-Q2RP", "deviceCode": "…secret…", "expiresIn": 600, "interval": 5 } ``` Show `userCode` on the display. Keep `deviceCode` in memory: it is the device's secret. **2. The owner types the code**, signed in on gridtac.com or in the app (or `POST /api/v1/devices/approve` with `{ userCode, label, clubId? }`). `clubId` registers it as the club's; only a manager of the club may do that. **3. The device polls** every `interval` seconds: ```http POST /api/v1/devices/token Content-Type: application/json { "deviceCode": "…secret…" } ``` `202 { "status": "pending" }` until the owner has typed the code, then **once**: ```json { "deviceId": "dev_k7q2m9x4h3pd", "key": "gt_play_…" } ``` Store both in flash. After that answer the pairing is gone, and only one poll ever gets the key: a second poll racing it gets `pairing_not_found`. A code is valid for 10 minutes (`pairing_expired` after that); once the owner has typed it, the device has 10 more minutes to collect its key. ## Pairing through the phone A box that only speaks LoRa has no internet, and a device without a screen cannot show a code. Then the **GridTac app pairs it over Bluetooth**: you prove you stand next to it (the code on its screen, or hold its button for three seconds and check that it blinks the same colours as the app shows), and the app registers it for you (`POST /api/v1/devices`) and writes its id back over Bluetooth. A LoRa prop or beacon hands its own radio key over once (to the app, or over USB from the web installer); GridTac stores it encrypted and never gives it out again. The answer's `radioAddr` is the device's 4-byte radio address, which it writes into the header of every frame it sends ([Radio frame and gateways](../gtlink/radio.md)). A gateway never gets a radio key. ## A prop online A prop speaks **GT-Link**, GridTac's device protocol ([overview](../gtlink/overview.md), every field in the [message reference](../gtlink/reference.md), a walkthrough in [Build a prop](../guides/build-a-prop.md)). With its own key it connects to the broker: ```http POST /api/v1/prop/mqtt-credentials Authorization: Bearer gt_prop_… ``` The answer has an MQTT username and password (a JWT) that let it publish only under `gridtac/dev//` (`hello`, `evt`, `state`, `tele`, `ack`, `lwt`) and subscribe only to its own `cmd` and `game` topics. Fetch new credentials before `expiresAt`. - **Events are deduplicated** on the device's boot counter and sequence number, so sending one again, or over both MQTT and HTTPS, never counts twice. - **The device has no trusted clock.** It sends milliseconds since boot; GridTac dates each event from the freshest message it has had from that boot. An event queued while offline is back-dated by at most 15 minutes; an older one waits for the game master. - **`game`** (retained) tells the prop the phase, kickoff, end and server time, and is refreshed on every change. **`cmd`** carries configuration, outputs, identify, disable and update notices; the prop answers each on `ack`. - **The game master can switch every prop of a game off at once.** The props get a `disable` command and their events are ignored until it is lifted. - **The key decides over MQTT too.** A prop whose key is revoked, paused or blocked is ignored on every message, within a few seconds, even on a connection opened before. Over MQTT each input event counts against the key: 120 a minute, and a key that keeps going past that is paused and blocked exactly as over HTTPS ([rate limits](authentication.md#rate-limits)). - **Revoking a device's key unpairs the device:** it leaves its game and shows as revoked. Pair it again for a new key. ## A gateway online **BETA, for LoRa from 1.8.** A gateway pairs like any device (`"kind": "gateway"` in the announce, or through the app) and gets a `gt_gw_` key. With it, it fetches its broker credentials: ``` POST /api/v1/gw/mqtt-credentials Authorization: Bearer gt_gw_… ``` The answer is the same shape as a prop's. The token lets the gateway publish only `gridtac/gw//up`, `tele` and `lwt`, and subscribe only to `gridtac/gw//down`; `` is its `dev_` id. It can publish nothing under another device's topics. What goes on those topics is in [Radio frame and gateways](../gtlink/radio.md). A prop that cannot keep an MQTT connection posts the same messages over HTTPS: ```http POST /api/v1/prop/events Authorization: Bearer gt_prop_… Content-Type: application/json { "tele": { "b": 7, "s": 40, "ms": 912000, "bat": { "pct": 81 } }, "evts": [{ "b": 7, "s": 41, "ms": 905300, "c": "red", "e": "hold", "x": 3000 }] } ``` Send `state` or `tele` with every batch: its `ms` is what dates the queued events. The answer carries `accepted`, the commands waiting for the prop, and the game clock. ## Using a device in a game | Call | What it does | |---|---| | `GET /api/v1/devices` | Your devices and those of every club you manage, never their keys. Each has `online` (a prop connected over MQTT right now; false for a beacon, which only posts), `battery` (percent from its latest `tele`, or for a beacon from the `battery` on its latest position; null when none) and `lastSeenAt`. `loans` lists the beacons someone else lends to you; `assignment.accepted: false` means one waits for your answer. | | `POST /api/v1/devices/{id}/assign` `{ gameId, playerId? }` | A beacon: your own for yourself (only needed to pick a game yourself: it otherwise follows you), or your club's lent to a member who plays in that game. `POST /api/v1/devices/{id}/return` takes a beacon out of its game, and it does not follow you back into that game while it is live. **A loan waits for the member to accept it** in their own app (`assignment.accepted: false`); the beacon's key does nothing until then, and the member is told by a push notification. A prop: into a game you run as game master. | | `POST /api/v1/devices/{id}/accept` | The member accepts a beacon lent to them; only they can, on their own session. | | `POST /api/v1/devices/{id}/decline` | The member declines it; the loan ends. | | `POST /api/v1/devices/{id}/return` | Take it back (the owner, a club manager, or the player who has it: that is how a member withdraws a loan they accepted; for a prop, also the game master of the game it plays in). Its key stops acting in the game at once. | | `DELETE /api/v1/devices/{id}` | Unpair: the key stops and the device leaves any game. | These calls use your normal signed-in session. Pairing your own device or your club's needs no two-factor sign-in, because a device key does far less than a script's: a beacon's sends only position, status and SOS for the player who carries it (never reads their map), a prop's only its own events in a game its game master put it in. You can unpair any time. Plain API keys for your own scripts still need two-factor ([Authentication](authentication.md)). **Limits:** at most 10 new devices an hour per account (`too_many_devices`); 20 devices per account and 200 per club (`device_limit`, unpair one first); **one beacon per player** in a game (`beacon_limit`); at most 100 props in one game (`game_device_limit`). SOS from a player's keys and beacons together: 6 a minute; the phone's own SOS button is apart and always works. --- source: https://gridtac.com/docs/api/reference.md --- # API reference Every call, generated from the server code. Base URL: `https://api.gridtac.com`. The same thing as an OpenAPI 3 document, for generating a client: [openapi.json](https://api.gridtac.com/api/v1/openapi.json). Keys and how to make them: [Authentication](authentication.md). What each error code means: [Errors](errors.md). ## Keys Make and manage API keys. ### Create an API key ```http POST /api/v1/keys ``` Needs a signed-in session from the last 15 minutes, on an account with two-factor on or one that signs in only with Google or Apple. The answer is the only time the full key is shown. **Auth:** a session signed in within the last 15 minutes, with two-factor on or Google/Apple sign-in only. **Body:** | Field | Type | Notes | |---|---|---| | `kind` | `play` / `team` / `dash` / `prop` / `link` / `gw` | prop and gw keys come from pairing a device, and link keys from the game page (a spectator link); none of them can be made here. | | `label` | string | | | `gameId` | string (uuid) | | | `teamId` (optional) | string (uuid) | Required for a team key. | **201:** The new key, with its secret (once). | Field | Type | Notes | |---|---|---| | `id` | string (uuid) | | | `kind` | `play` / `team` / `dash` / `prop` / `link` / `gw` | | | `label` | string | | | `prefix` | string | The public part of the key, e.g. gt_team_ab12cd34. Safe to show. | | `gameId` | string (uuid) or null | | | `teamId` | string (uuid) or null | | | `status` | `active` / `paused` / `blocked` / `revoked` / `expired` | | | `createdAt` | string (date-time) | ISO 8601 time | | `lastUsedAt` | string (date-time) or null | ISO 8601 time | | `expiresAt` | string (date-time) or null | ISO 8601 time | | `pausedUntil` (optional) | string (date-time) | Only while the key is paused. | | `pausedReason` (optional) | string or null | Only while the key is paused. | | `key` | string | The full key. Shown ONCE: store it now, it cannot be read again. | **Errors:** [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_key_limit`](errors.md#game_key_limit), [`game_not_found`](errors.md#game_not_found), [`invalid_body`](errors.md#invalid_body), [`kind_not_creatable`](errors.md#kind_not_creatable), [`mfa_required`](errors.md#mfa_required), [`not_in_game`](errors.md#not_in_game), [`reauth_required`](errors.md#reauth_required), [`team_not_found`](errors.md#team_not_found), [`team_required`](errors.md#team_required), [`too_many_keys`](errors.md#too_many_keys), [`unauthorized`](errors.md#unauthorized). ### Your API keys ```http GET /api/v1/keys ``` Newest first. Never the secrets. **Auth:** a signed-in session (cookie). **200:** Your keys. | Field | Type | Notes | |---|---|---| | `keys` | array of ApiKey | | **Errors:** [`unauthorized`](errors.md#unauthorized). ### Rotate a key ```http POST /api/v1/keys/{id}/rotate ``` A new secret for the same key. The old secret stops at once. **Auth:** a session signed in within the last 15 minutes, with two-factor on or Google/Apple sign-in only. **Path:** `id` (string (uuid)). **200:** The key, with its new secret (once). | Field | Type | Notes | |---|---|---| | `id` | string (uuid) | | | `kind` | `play` / `team` / `dash` / `prop` / `link` / `gw` | | | `label` | string | | | `prefix` | string | The public part of the key, e.g. gt_team_ab12cd34. Safe to show. | | `gameId` | string (uuid) or null | | | `teamId` | string (uuid) or null | | | `status` | `active` / `paused` / `blocked` / `revoked` / `expired` | | | `createdAt` | string (date-time) | ISO 8601 time | | `lastUsedAt` | string (date-time) or null | ISO 8601 time | | `expiresAt` | string (date-time) or null | ISO 8601 time | | `pausedUntil` (optional) | string (date-time) | Only while the key is paused. | | `pausedReason` (optional) | string or null | Only while the key is paused. | | `key` | string | The full key. Shown ONCE: store it now, it cannot be read again. | **Errors:** [`key_blocked`](errors.md#key_blocked), [`key_not_found`](errors.md#key_not_found), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`reauth_required`](errors.md#reauth_required), [`unauthorized`](errors.md#unauthorized). ### Revoke a key ```http DELETE /api/v1/keys/{id} ``` Your own key, or any key bound to a game you run as game master. Revoking twice is fine. **Auth:** a signed-in session (cookie). **Path:** `id` (string (uuid)). **204:** Revoked. **Errors:** [`key_not_found`](errors.md#key_not_found), [`unauthorized`](errors.md#unauthorized). ### What this key is ```http GET /api/v1/whoami ``` **Auth:** any key; counts against the `read` budget. **200:** The key behind the call. | Field | Type | Notes | |---|---|---| | `keyId` | string (uuid) | | | `kind` | `play` / `team` / `dash` / `prop` / `link` / `gw` | | | `label` | string | | | `gameId` | string (uuid) or null | | | `teamId` | string (uuid) or null | | **Errors:** [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited). ## Player Act as yourself in a game: a player key. ### What you see in the app ```http GET /api/v1/play ``` Your own unit and status, and what your side sees: units, markers, drawings, orders, zones, the score as far as the game master shows it, and the events meant for your side. Never the game master view. **Auth:** a play key (`gt_play_`); counts against the `read` budget. **200:** Your view. | Field | Type | Notes | |---|---|---| | `me` | object | | | `me.playerId` | string (uuid) | | | `me.callsign` | string | | | `me.role` | string or null | | | `me.platoon` | string or null | | | `me.squad` | string or null | | | `me.unit` | Entity or null | Your own live unit, or null when you are not reporting. | | `game` | object | | | `game.id` | string (uuid) | | | `game.name` | string | | | `game.phase` | `draft` / `live` / `ended` | | | `game.paused` | boolean | | | `game.startedAt` | string (date-time) or null | ISO 8601 time | | `game.endsAt` | string (date-time) or null | ISO 8601 time | | `team` | object or null | | | `team.id` | string (uuid) | | | `team.name` | string | | | `team.color` | string | Hex colour, #rrggbb | | `serverTime` | string (date-time) | ISO 8601 time | | `scoreVisibility` | `full` / `own` / `none` | The game master's score setting. | | `score` | array of object | Only the teams the score setting shows. | | `score[].id` | string (uuid) | | | `score[].name` | string | | | `score[].color` | string | Hex colour, #rrggbb | | `score[].points` | number | | | `zones` | array of object | Active zones this side can see. | | `zones[].id` | string (uuid) | | | `zones[].name` | string | | | `zones[].ownerTeamId` | string (uuid) or null | | | `zones[].geometry` | object or null | GeoJSON geometry (Polygon, or Point with a radius); null for an indoor zone set by hand. | | `zones[].geometry.type` | string | | | `zones[].geometry.coordinates` (optional) | any | | | `units` | array of Entity | Live units this side can see. | | `lastKnown` | array of Entity | Units that went dark, as they were at their last fix. | | `markers` | array of Marker | | | `graphics` | array of Graphic | | | `orders` | array of Order | | | `orderAcks` | array of object | | | `orderAcks[].orderUid` | string | | | `orderAcks[].by` | string | | | `orderAcks[].time` | integer | | | `events` | array of object | The latest 50 events meant for this side (never chat). | | `events[].type` | string | | | `events[].at` | string (date-time) | ISO 8601 time | | `events[].actor` | string or null | | | `events[].summary` | string or null | | **Errors:** [`device_key_scope`](errors.md#device_key_scope), [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`no_side`](errors.md#no_side), [`not_in_game`](errors.md#not_in_game), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Report your position ```http POST /api/v1/play/position ``` **Auth:** a play key (`gt_play_`); counts against the `position` budget. **Body:** | Field | Type | Notes | |---|---|---| | `point` | GeoPoint | | | `speed` (optional) | number | | | `course` (optional) | number | | | `battery` (optional) | number | | | `intervalSec` (optional) | number | | | `mock` (optional) | boolean | | | `time` (optional) | integer | Ignored: the server stamps its own time. | **202:** Accepted: published on your own live topic, through the same checks as your phone. | Field | Type | Notes | |---|---|---| | `accepted` | `true` | | **Errors:** [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_body`](errors.md#invalid_body), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`not_in_game`](errors.md#not_in_game), [`player_devices_off`](errors.md#player_devices_off), [`rate_limited`](errors.md#rate_limited), [`unavailable`](errors.md#unavailable), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Report your status ```http POST /api/v1/play/status ``` **Auth:** a play key (`gt_play_`); counts against the `status` budget. **Body:** | Field | Type | Notes | |---|---|---| | `status` | `alive` / `hit` / `down` / `medic` / `out` / `respawn` | | **202:** Accepted: published on your own live topic, through the same checks as your phone. | Field | Type | Notes | |---|---|---| | `accepted` | `true` | | **Errors:** [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_body`](errors.md#invalid_body), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`not_in_game`](errors.md#not_in_game), [`player_devices_off`](errors.md#player_devices_off), [`rate_limited`](errors.md#rate_limited), [`unavailable`](errors.md#unavailable), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Raise an SOS ```http POST /api/v1/play/sos ``` The same SOS as the app: one active per player, seen by everyone in the game, pushed to every phone. **Auth:** a play key (`gt_play_`); counts against the `sos` budget. **Body:** | Field | Type | Notes | |---|---|---| | `point` | object | | | `point.lat` | number | | | `point.lon` | number | | | `approx` (optional) | boolean | true when the point is a guess; a fresh fix from the phone wins. | **201:** The SOS is up. | Field | Type | Notes | |---|---|---| | `uid` | string | | | `point` | GeoPoint | | | `time` | integer | | **Errors:** [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_body`](errors.md#invalid_body), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`not_in_game`](errors.md#not_in_game), [`player_devices_off`](errors.md#player_devices_off), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Clear your own SOS ```http DELETE /api/v1/play/sos ``` **Auth:** a play key (`gt_play_`); counts against the `sos` budget. **200:** How many of your SOS marks were cleared (0 is fine). | Field | Type | Notes | |---|---|---| | `cleared` | integer | | **Errors:** [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`not_in_game`](errors.md#not_in_game), [`player_devices_off`](errors.md#player_devices_off), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### WILCO an order ```http POST /api/v1/play/orders/{uid}/ack ``` Only an order sent to you. **Auth:** a play key (`gt_play_`); counts against the `wilco` budget. **Path:** `uid` (string). **204:** Acknowledged. **Errors:** [`device_key_scope`](errors.md#device_key_scope), [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`not_in_game`](errors.md#not_in_game), [`order_not_found`](errors.md#order_not_found), [`player_devices_off`](errors.md#player_devices_off), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Place or update a mark ```http POST /api/v1/play/marks ``` The game's marker rule decides who may; the mark belongs to your side. **Auth:** a play key (`gt_play_`); counts against the `mark` budget. **Body:** | Field | Type | Notes | |---|---|---| | `uid` (optional) | string | Your own id, to update the same mark later. Made for you when left out. | | `marker` | `enemy` / `friendly` / `objective` / `hazard` / `bomb` / `spot` / `rally` / `vehicle` / `building` / `box` / `fob` / `hq` / `medevac` / `waypoint` | An SOS has its own call. | | `point` | object | | | `point.lat` | number | | | `point.lon` | number | | | `label` (optional) | string | | | `note` (optional) | string | | | `color` (optional) | string | | | `deadline` (optional) | integer | Epoch ms | **201:** The mark as stored. | Field | Type | Notes | |---|---|---| | `kind` | `marker` | | | `uid` | string | | | `marker` | `enemy` / `friendly` / `objective` / `hazard` / `bomb` / `spot` / `rally` / `vehicle` / `building` / `box` / `fob` / `hq` / `medevac` / `waypoint` / `sos` | | | `point` | GeoPoint | | | `sender` | string | | | `channel` | string | | | `teamId` (optional) | string or null | | | `label` (optional) | string | | | `note` (optional) | string | | | `color` (optional) | string | | | `sidc` (optional) | string | | | `time` | integer | | | `stale` | integer | | | `deadline` (optional) | integer | | **Errors:** [`device_key_scope`](errors.md#device_key_scope), [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_body`](errors.md#invalid_body), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`marks_not_allowed`](errors.md#marks_not_allowed), [`mfa_required`](errors.md#mfa_required), [`no_side`](errors.md#no_side), [`not_in_game`](errors.md#not_in_game), [`not_your_mark`](errors.md#not_your_mark), [`player_devices_off`](errors.md#player_devices_off), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Remove your own mark ```http DELETE /api/v1/play/marks/{uid} ``` **Auth:** a play key (`gt_play_`); counts against the `mark` budget. **Path:** `uid` (string). **204:** Removed (or it was already gone). **Errors:** [`device_key_scope`](errors.md#device_key_scope), [`forbidden`](errors.md#forbidden), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`marks_not_allowed`](errors.md#marks_not_allowed), [`mfa_required`](errors.md#mfa_required), [`no_side`](errors.md#no_side), [`not_in_game`](errors.md#not_in_game), [`not_your_mark`](errors.md#not_your_mark), [`player_devices_off`](errors.md#player_devices_off), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ## Team One team's commander view: a team key. ### One team's commander view ```http GET /api/v1/team ``` Read-only, own team only. Carries live positions: not cached. **Auth:** a team key (`gt_team_`); counts against the `read` budget. **200:** The team view. | Field | Type | Notes | |---|---|---| | `game` | object | | | `game.id` | string (uuid) | | | `game.name` | string | | | `game.phase` | `draft` / `live` / `ended` | | | `game.paused` | boolean | | | `game.startedAt` | string (date-time) or null | ISO 8601 time | | `game.endsAt` | string (date-time) or null | ISO 8601 time | | `team` | object or null | | | `team.id` | string (uuid) | | | `team.name` | string | | | `team.color` | string | Hex colour, #rrggbb | | `serverTime` | string (date-time) | ISO 8601 time | | `scoreVisibility` | `full` / `own` / `none` | The game master's score setting. | | `score` | array of object | Only the teams the score setting shows. | | `score[].id` | string (uuid) | | | `score[].name` | string | | | `score[].color` | string | Hex colour, #rrggbb | | `score[].points` | number | | | `zones` | array of object | Active zones this side can see. | | `zones[].id` | string (uuid) | | | `zones[].name` | string | | | `zones[].ownerTeamId` | string (uuid) or null | | | `zones[].geometry` | object or null | GeoJSON geometry (Polygon, or Point with a radius); null for an indoor zone set by hand. | | `zones[].geometry.type` | string | | | `zones[].geometry.coordinates` (optional) | any | | | `units` | array of Entity | Live units this side can see. | | `lastKnown` | array of Entity | Units that went dark, as they were at their last fix. | | `markers` | array of Marker | | | `graphics` | array of Graphic | | | `orders` | array of Order | | | `orderAcks` | array of object | | | `orderAcks[].orderUid` | string | | | `orderAcks[].by` | string | | | `orderAcks[].time` | integer | | | `events` | array of object | The latest 50 events meant for this side (never chat). | | `events[].type` | string | | | `events[].at` | string (date-time) | ISO 8601 time | | `events[].actor` | string or null | | | `events[].summary` | string or null | | **Errors:** [`forbidden`](errors.md#forbidden), [`game_not_found`](errors.md#game_not_found), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ## Dashboard The spectator view: a dashboard key. ### The spectator dashboard ```http GET /api/v1/dashboard ``` One shared snapshot per game, rebuilt at most every 5 seconds. A spectator link (gt_link_, made by the game master on the game page) reads the same. **Auth:** a dashboard key (`gt_dash_`) or a spectator link key (`gt_link_`); counts against the `read` budget. **200:** The dashboard. | Field | Type | Notes | |---|---|---| | `game` | object | | | `game.id` | string (uuid) | | | `game.name` | string | | | `game.paused` | boolean | | | `game.startedAt` | string (date-time) or null | ISO 8601 time | | `game.endsAt` | string (date-time) or null | ISO 8601 time | | `game.phase` | `draft` / `live` / `ended` | | | `game.startsAt` | string (date-time) or null | ISO 8601 time | | `serverTime` | string (date-time) | ISO 8601 time | | `delayMin` | integer or null | null = live; else everything below is this many minutes old (the dashboard delay the game master set). | | `asOf` | string (date-time) | The moment the picture shows: serverTime, or serverTime minus the delay. | | `waitingUntil` | string (date-time) or null | Delayed, and no picture old enough yet: when there will be one. Score, zones and events are empty until then. | | `scoreVisible` | boolean | | | `teams` | array of object | | | `teams[].id` | string (uuid) | | | `teams[].name` | string | | | `teams[].color` | string | Hex colour, #rrggbb | | `teams[].points` | number or null | null while the score is hidden | | `zones` | array of object | | | `zones[].id` | string (uuid) | | | `zones[].name` | string | | | `zones[].ownerTeamId` | string (uuid) or null | | | `effects` | array of object | Running UAVs and EMPs. | | `effects[].kind` | `uav` / `emp` | | | `effects[].teamId` | string (uuid) | The side that fired it. | | `effects[].targetTeamIds` | array of string (uuid) | | | `effects[].radiusM` | number or null | null = the whole side. Where the circle is never shows. | | `effects[].leftSec` | integer | Seconds left at asOf; frozen while the game is paused. | | `events` | array of object | | | `events[].type` | string | | | `events[].at` | string (date-time) | ISO 8601 time | | `events[].summary` | string or null | | | `area` | array of any or null | [west, south, east, north] of the play area every side may see, to frame a map; null when the game has none. | | `positions` | object or null | null unless the game master shows positions, and then only as they were delayMin minutes ago. | | `positions.delayMin` | integer | | | `positions.asOf` | string (date-time) | ISO 8601 time | | `positions.units` | array of object | | | `positions.units[].callsign` | string | | | `positions.units[].teamId` | string (uuid) or null | | | `positions.units[].point` | object | | | `positions.units[].at` | string (date-time) | ISO 8601 time | **Errors:** [`forbidden`](errors.md#forbidden), [`game_not_found`](errors.md#game_not_found), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ## Webhooks Live events pushed to your server, signed: a team or dashboard key. ### Register a webhook ```http POST /api/v1/webhooks ``` Every event this key may see is POSTed to the URL, signed with the secret in this answer (shown once). A team key hears its team's events, a dashboard key the dashboard's. At most 5 per key. **Auth:** a team key (`gt_team_`) or a dashboard key (`gt_dash_`); counts against the `manage` budget. **Body:** | Field | Type | Notes | |---|---|---| | `url` | string | https:// on the public internet. Private and reserved addresses are refused. | | `events` (optional) | array of string | Only these event types. Left out: every type the key may see. | **201:** The webhook, with its secret (once). | Field | Type | Notes | |---|---|---| | `id` | string (uuid) | | | `url` | string | | | `events` | array of string or null | The event types it asked for; null = every type the key may see. | | `status` | `active` / `disabled` | | | `disabledReason` | string or null | | | `createdAt` | string (date-time) | ISO 8601 time | | `secret` | string | whsec_…: signs every delivery. Shown only in this answer. | **Errors:** [`forbidden`](errors.md#forbidden), [`invalid_body`](errors.md#invalid_body), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`url_not_allowed`](errors.md#url_not_allowed), [`webhook_limit`](errors.md#webhook_limit), [`wrong_key_kind`](errors.md#wrong_key_kind). ### This key's webhooks ```http GET /api/v1/webhooks ``` **Auth:** a team key (`gt_team_`) or a dashboard key (`gt_dash_`); counts against the `manage` budget. **200:** The webhooks, newest first. Never the secrets. | Field | Type | Notes | |---|---|---| | `webhooks` | array of object | | | `webhooks[].id` | string (uuid) | | | `webhooks[].url` | string | | | `webhooks[].events` | array of string or null | The event types it asked for; null = every type the key may see. | | `webhooks[].status` | `active` / `disabled` | | | `webhooks[].disabledReason` | string or null | | | `webhooks[].createdAt` | string (date-time) | ISO 8601 time | **Errors:** [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Remove a webhook ```http DELETE /api/v1/webhooks/{id} ``` Nothing more is sent to it, including retries. Removing twice is fine. **Auth:** a team key (`gt_team_`) or a dashboard key (`gt_dash_`); counts against the `manage` budget. **Path:** `id` (string (uuid)). **204:** Removed. **Errors:** [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`webhook_not_found`](errors.md#webhook_not_found), [`wrong_key_kind`](errors.md#wrong_key_kind). ### The delivery log ```http GET /api/v1/webhooks/{id}/deliveries ``` The latest 50 deliveries, newest first, with each attempt's outcome. Kept for 14 days. **Auth:** a team key (`gt_team_`) or a dashboard key (`gt_dash_`); counts against the `manage` budget. **Path:** `id` (string (uuid)). **200:** The deliveries. | Field | Type | Notes | |---|---|---| | `deliveries` | array of object | | | `deliveries[].id` | string (uuid) | | | `deliveries[].eventType` | string | | | `deliveries[].status` | `pending` / `delivered` / `failed` | | | `deliveries[].attempts` | integer | | | `deliveries[].lastStatus` | integer or null | Your server's HTTP status on the last attempt; null when it could not be reached. | | `deliveries[].lastError` | string or null | | | `deliveries[].createdAt` | string (date-time) | ISO 8601 time | | `deliveries[].deliveredAt` | string (date-time) or null | ISO 8601 time | | `deliveries[].nextAttemptAt` | string (date-time) or null | When a pending delivery is tried again. | **Errors:** [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`webhook_not_found`](errors.md#webhook_not_found), [`wrong_key_kind`](errors.md#wrong_key_kind). ### Send a test delivery ```http POST /api/v1/webhooks/{id}/ping ``` A `ping` event, signed like any other, to check your receiver. **Auth:** a team key (`gt_team_`) or a dashboard key (`gt_dash_`); counts against the `manage` budget. **Path:** `id` (string (uuid)). **202:** Queued; it shows in the delivery log. | Field | Type | Notes | |---|---|---| | `deliveryId` | string (uuid) | | **Errors:** [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`webhook_not_found`](errors.md#webhook_not_found), [`wrong_key_kind`](errors.md#wrong_key_kind). ## Devices Pair beacons and props, lend club devices, take them back. ### Start pairing from the device ```http POST /api/v1/devices/announce ``` For a device with internet and a display (RFC 8628 device authorization). Show userCode on the device; keep deviceCode secret and poll POST /api/v1/devices/token every `interval` seconds until the owner has typed the code in GridTac. **Auth:** none. **Body:** | Field | Type | Notes | |---|---|---| | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `model` | string | vendor.model, as in its GT-Link manifest. | | `fw` | string | | **201:** The codes. | Field | Type | Notes | |---|---|---| | `userCode` | string | ABCD-EFGH, for the display. | | `deviceCode` | string | Secret: only for polling. | | `expiresIn` | integer | | | `interval` | integer | | **Errors:** [`invalid_body`](errors.md#invalid_body), [`rate_limited`](errors.md#rate_limited). ### Poll for the device key ```http POST /api/v1/devices/token ``` From the device, with its deviceCode. 202 while the owner has not typed the code yet; 200 once, with the device id and its key; after that the pairing is gone. **Auth:** none. **Body:** | Field | Type | Notes | |---|---|---| | `deviceCode` | string | | **200:** Paired: the device id and its own key (once). | Field | Type | Notes | |---|---|---| | `deviceId` | string | | | `key` | string | | **202:** Not yet: poll again after `interval` seconds. | Field | Type | Notes | |---|---|---| | `status` | `pending` | | | `interval` | integer | | **Errors:** [`invalid_body`](errors.md#invalid_body), [`pairing_expired`](errors.md#pairing_expired), [`pairing_not_found`](errors.md#pairing_not_found), [`rate_limited`](errors.md#rate_limited). ### Type in the code a device shows ```http POST /api/v1/devices/approve ``` Signed in. Makes the device yours, or your club's when you manage it. No two-factor needed: a device never does more than the account that paired it. **Auth:** a signed-in session (cookie). **Body:** | Field | Type | Notes | |---|---|---| | `userCode` | string | The code the device shows, with or without the dash. | | `label` | string | | | `clubId` (optional) | string (uuid) | Register it as this club's (you must manage the club); left out, it is yours. | **201:** The device; it receives its key on its next poll. | Field | Type | Notes | |---|---|---| | `id` | string | dev_…: the opaque id the device uses in its topics. | | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `label` | string | | | `model` | string or null | | | `fw` | string or null | | | `owner` | object | | | `owner.kind` | `player` / `club` | | | `owner.clubId` | string (uuid) or null | | | `owner.clubName` | string or null | | | `assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `assignment.gameId` | string (uuid) | | | `assignment.gameName` | string | | | `assignment.playerId` | string (uuid) or null | | | `assignment.callsign` | string or null | | | `assignment.since` | string (date-time) | ISO 8601 time | | `assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `status` | `active` / `revoked` | | | `online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `battery` | number or null | Battery percent from the latest telemetry, or null. | | `lastSeenAt` | string (date-time) or null | ISO 8601 time | | `createdAt` | string (date-time) | ISO 8601 time | **Errors:** [`device_limit`](errors.md#device_limit), [`forbidden`](errors.md#forbidden), [`invalid_body`](errors.md#invalid_body), [`pairing_expired`](errors.md#pairing_expired), [`pairing_not_found`](errors.md#pairing_not_found), [`rate_limited`](errors.md#rate_limited), [`too_many_devices`](errors.md#too_many_devices), [`unauthorized`](errors.md#unauthorized). ### Register a device through the phone (BLE) ```http POST /api/v1/devices ``` For a LoRa-only or display-less device the app has proved it stands next to (a code on its display, or a held button and a matching blink pattern). The app writes the returned id and key back over BLE. **Auth:** a signed-in session (cookie). **Body:** | Field | Type | Notes | |---|---|---| | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `model` | string | | | `fw` | string | | | `label` | string | | | `clubId` (optional) | string (uuid) | | | `radioKey` (optional) | string | A LoRa prop's or beacon's own 16-byte AEAD key, base64, read from the device over BLE or USB. Stored encrypted; never given out again. The answer's radioAddr is the address the device then uses. | **201:** The device with its key (once). | Field | Type | Notes | |---|---|---| | `id` | string | dev_…: the opaque id the device uses in its topics. | | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `label` | string | | | `model` | string or null | | | `fw` | string or null | | | `owner` | object | | | `owner.kind` | `player` / `club` | | | `owner.clubId` | string (uuid) or null | | | `owner.clubName` | string or null | | | `assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `assignment.gameId` | string (uuid) | | | `assignment.gameName` | string | | | `assignment.playerId` | string (uuid) or null | | | `assignment.callsign` | string or null | | | `assignment.since` | string (date-time) | ISO 8601 time | | `assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `status` | `active` / `revoked` | | | `online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `battery` | number or null | Battery percent from the latest telemetry, or null. | | `lastSeenAt` | string (date-time) or null | ISO 8601 time | | `createdAt` | string (date-time) | ISO 8601 time | | `key` | string or null | Its own key (gt_play_ for a beacon, gt_prop_ for a prop, gt_gw_ for a gateway). Shown only in this answer; write it into the device and nowhere else. | **Errors:** [`device_limit`](errors.md#device_limit), [`forbidden`](errors.md#forbidden), [`invalid_body`](errors.md#invalid_body), [`too_many_devices`](errors.md#too_many_devices), [`unauthorized`](errors.md#unauthorized). ### Your devices and your clubs' ```http GET /api/v1/devices ``` Yours, and those of every club you manage. Never their keys. A loan whose game has ended is shown as back with its owner. `loans` are beacons someone else lends to you; one with `accepted: false` waits for your answer. **Auth:** a signed-in session (cookie). **200:** The devices. | Field | Type | Notes | |---|---|---| | `devices` | array of object | | | `devices[].id` | string | dev_…: the opaque id the device uses in its topics. | | `devices[].kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `devices[].label` | string | | | `devices[].model` | string or null | | | `devices[].fw` | string or null | | | `devices[].owner` | object | | | `devices[].owner.kind` | `player` / `club` | | | `devices[].owner.clubId` | string (uuid) or null | | | `devices[].owner.clubName` | string or null | | | `devices[].assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `devices[].assignment.gameId` | string (uuid) | | | `devices[].assignment.gameName` | string | | | `devices[].assignment.playerId` | string (uuid) or null | | | `devices[].assignment.callsign` | string or null | | | `devices[].assignment.since` | string (date-time) | ISO 8601 time | | `devices[].assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `devices[].radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `devices[].status` | `active` / `revoked` | | | `devices[].online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `devices[].battery` | number or null | Battery percent from the latest telemetry, or null. | | `devices[].lastSeenAt` | string (date-time) or null | ISO 8601 time | | `devices[].createdAt` | string (date-time) | ISO 8601 time | | `loans` | array of object | | | `loans[].id` | string | dev_…: the opaque id the device uses in its topics. | | `loans[].kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `loans[].label` | string | | | `loans[].model` | string or null | | | `loans[].fw` | string or null | | | `loans[].owner` | object | | | `loans[].owner.kind` | `player` / `club` | | | `loans[].owner.clubId` | string (uuid) or null | | | `loans[].owner.clubName` | string or null | | | `loans[].assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `loans[].assignment.gameId` | string (uuid) | | | `loans[].assignment.gameName` | string | | | `loans[].assignment.playerId` | string (uuid) or null | | | `loans[].assignment.callsign` | string or null | | | `loans[].assignment.since` | string (date-time) | ISO 8601 time | | `loans[].assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `loans[].radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `loans[].status` | `active` / `revoked` | | | `loans[].online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `loans[].battery` | number or null | Battery percent from the latest telemetry, or null. | | `loans[].lastSeenAt` | string (date-time) or null | ISO 8601 time | | `loans[].createdAt` | string (date-time) | ISO 8601 time | **Errors:** [`unauthorized`](errors.md#unauthorized). ### Use a device in a game ```http POST /api/v1/devices/{id}/assign ``` A beacon: yours for yourself, or your club's lent to a member who plays in that game. A loan to someone other than you waits for them to accept it in their own app (`assignment.accepted: false`); until then the beacon's key does nothing. A prop: into a game you run as game master. Ends any earlier assignment; a loan returns to the club when the game ends. **Auth:** a signed-in session (cookie). **Path:** `id` (string). **Body:** | Field | Type | Notes | |---|---|---| | `gameId` | string (uuid) | | | `playerId` (optional) | string (uuid) | Beacons: who carries it. Left out for your own beacon: you. | **200:** The device, assigned. | Field | Type | Notes | |---|---|---| | `id` | string | dev_…: the opaque id the device uses in its topics. | | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `label` | string | | | `model` | string or null | | | `fw` | string or null | | | `owner` | object | | | `owner.kind` | `player` / `club` | | | `owner.clubId` | string (uuid) or null | | | `owner.clubName` | string or null | | | `assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `assignment.gameId` | string (uuid) | | | `assignment.gameName` | string | | | `assignment.playerId` | string (uuid) or null | | | `assignment.callsign` | string or null | | | `assignment.since` | string (date-time) | ISO 8601 time | | `assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `status` | `active` / `revoked` | | | `online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `battery` | number or null | Battery percent from the latest telemetry, or null. | | `lastSeenAt` | string (date-time) or null | ISO 8601 time | | `createdAt` | string (date-time) | ISO 8601 time | **Errors:** [`beacon_limit`](errors.md#beacon_limit), [`device_not_found`](errors.md#device_not_found), [`forbidden`](errors.md#forbidden), [`game_device_limit`](errors.md#game_device_limit), [`game_ended`](errors.md#game_ended), [`game_not_found`](errors.md#game_not_found), [`invalid_body`](errors.md#invalid_body), [`not_in_game`](errors.md#not_in_game), [`not_your_player`](errors.md#not_your_player), [`unauthorized`](errors.md#unauthorized). ### Accept a beacon lent to you ```http POST /api/v1/devices/{id}/accept ``` Only the player it is lent to, on their own session. From then on the beacon reports for you in that game. **Auth:** a signed-in session (cookie). **Path:** `id` (string). **200:** The device, now in use by you. | Field | Type | Notes | |---|---|---| | `id` | string | dev_…: the opaque id the device uses in its topics. | | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `label` | string | | | `model` | string or null | | | `fw` | string or null | | | `owner` | object | | | `owner.kind` | `player` / `club` | | | `owner.clubId` | string (uuid) or null | | | `owner.clubName` | string or null | | | `assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `assignment.gameId` | string (uuid) | | | `assignment.gameName` | string | | | `assignment.playerId` | string (uuid) or null | | | `assignment.callsign` | string or null | | | `assignment.since` | string (date-time) | ISO 8601 time | | `assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `status` | `active` / `revoked` | | | `online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `battery` | number or null | Battery percent from the latest telemetry, or null. | | `lastSeenAt` | string (date-time) or null | ISO 8601 time | | `createdAt` | string (date-time) | ISO 8601 time | **Errors:** [`device_not_found`](errors.md#device_not_found), [`unauthorized`](errors.md#unauthorized). ### Decline a beacon lent to you ```http POST /api/v1/devices/{id}/decline ``` Only the player it is lent to. The loan ends and the beacon goes back to its owner. **Auth:** a signed-in session (cookie). **Path:** `id` (string). **200:** The device, back with its owner. | Field | Type | Notes | |---|---|---| | `id` | string | dev_…: the opaque id the device uses in its topics. | | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `label` | string | | | `model` | string or null | | | `fw` | string or null | | | `owner` | object | | | `owner.kind` | `player` / `club` | | | `owner.clubId` | string (uuid) or null | | | `owner.clubName` | string or null | | | `assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `assignment.gameId` | string (uuid) | | | `assignment.gameName` | string | | | `assignment.playerId` | string (uuid) or null | | | `assignment.callsign` | string or null | | | `assignment.since` | string (date-time) | ISO 8601 time | | `assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `status` | `active` / `revoked` | | | `online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `battery` | number or null | Battery percent from the latest telemetry, or null. | | `lastSeenAt` | string (date-time) or null | ISO 8601 time | | `createdAt` | string (date-time) | ISO 8601 time | **Errors:** [`device_not_found`](errors.md#device_not_found), [`unauthorized`](errors.md#unauthorized). ### Take a device back ```http POST /api/v1/devices/{id}/return ``` By its owner, a manager of the owning club, the player who has it (that is how you withdraw a loan you accepted), or for a prop the game master of the game it plays in. Its key stops acting in the game at once. **Auth:** a signed-in session (cookie). **Path:** `id` (string). **200:** The device, back with its owner. | Field | Type | Notes | |---|---|---| | `id` | string | dev_…: the opaque id the device uses in its topics. | | `kind` | `beacon` / `prop` / `gateway` | A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA). | | `label` | string | | | `model` | string or null | | | `fw` | string or null | | | `owner` | object | | | `owner.kind` | `player` / `club` | | | `owner.clubId` | string (uuid) or null | | | `owner.clubName` | string or null | | | `assignment` | object or null | Who uses it in which game right now; null when it is with its owner. | | `assignment.gameId` | string (uuid) | | | `assignment.gameName` | string | | | `assignment.playerId` | string (uuid) or null | | | `assignment.callsign` | string or null | | | `assignment.since` | string (date-time) | ISO 8601 time | | `assignment.accepted` | boolean | False while a loan waits for the player to accept it; the device's key does nothing until then. | | `radioAddr` | string or null | A LoRa device: its 4-byte radio address as 8 hex digits, the addr in its frame headers. Write it into the device with its key. Null for a device without a radio key. | | `status` | `active` / `revoked` | | | `online` | boolean | A prop or gateway connected over MQTT right now (its last will says when it drops). Always false for a beacon, which only posts. | | `battery` | number or null | Battery percent from the latest telemetry, or null. | | `lastSeenAt` | string (date-time) or null | ISO 8601 time | | `createdAt` | string (date-time) | ISO 8601 time | **Errors:** [`device_not_found`](errors.md#device_not_found), [`unauthorized`](errors.md#unauthorized). ### Unpair a device ```http DELETE /api/v1/devices/{id} ``` Its key stops at once and it leaves any game. Pair it again to use it. Revoking twice is fine. **Auth:** a signed-in session (cookie). **Path:** `id` (string). **204:** Unpaired. **Errors:** [`device_not_found`](errors.md#device_not_found), [`unauthorized`](errors.md#unauthorized). ### A prop's MQTT credentials ```http POST /api/v1/prop/mqtt-credentials ``` With its own prop key. A JWT for the broker that lets the prop publish only under gridtac/dev// (hello, evt, state, tele, ack, lwt) and subscribe only to its cmd and game topics. Fetch a new one before expiresAt. **Auth:** a prop key (`gt_prop_`); counts against the `read` budget. **200:** The credentials. | Field | Type | Notes | |---|---|---| | `deviceId` | string | | | `username` | string | | | `token` | string | The MQTT password. | | `expiresAt` | integer | | | `topics` | object | | | `topics.publish` | object | | | `topics.subscribe` | object | | **Errors:** [`device_not_found`](errors.md#device_not_found), [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### A gateway's MQTT credentials ```http POST /api/v1/gw/mqtt-credentials ``` BETA, from 1.8. With its own gateway key (gt_gw_). A JWT for the broker that lets the gateway publish only gridtac/gw//up, tele and lwt, and subscribe only to its down topic. A gateway carries the encrypted frames of other devices and holds none of their keys. Fetch a new one before expiresAt. **Auth:** a gateway key (`gt_gw_`); counts against the `read` budget. **200:** The credentials. | Field | Type | Notes | |---|---|---| | `deviceId` | string | dev_…: the gateway id in its topics. | | `username` | string | | | `token` | string | The MQTT password. | | `expiresAt` | integer | | | `topics` | object | | | `topics.publish` | object | | | `topics.subscribe` | object | | **Errors:** [`device_not_found`](errors.md#device_not_found), [`forbidden`](errors.md#forbidden), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ### A prop's events over HTTPS ```http POST /api/v1/prop/events ``` The fallback for a sleepy or simple prop: input events (deduplicated on boot and seq, so a retry is safe), with its state or telemetry so the server can date queued events. The answer carries the commands waiting for it and the game clock. **Auth:** a prop key (`gt_prop_`); counts against the `event` budget. **Body:** | Field | Type | Notes | |---|---|---| | `evts` | array of object | | | `evts[].b` | integer | Boot counter, stored in flash and incremented on every start. | | `evts[].s` | integer | Sequence number within this boot, from 0. | | `evts[].ms` | integer | Milliseconds since boot: the device has no trusted clock (ADR 0007 section 5). | | `evts[].c` | string | Capability id. | | `evts[].e` | string | Event: press, hold, release, set, code, tag, tripped, cleared, moved, still, hit, value. | | `evts[].x` (optional) | number or string | Value: hold ms, switch position, code, tag uid, hit strength, analog value. | | `evts[].z` (optional) | string | Zone of a hit. | | `state` (optional) | object | | | `state.b` | integer | Boot counter, stored in flash and incremented on every start. | | `state.s` | integer | Sequence number within this boot, from 0. | | `state.ms` | integer | Milliseconds since boot: the device has no trusted clock (ADR 0007 section 5). | | `state.st` | object | | | `state.st.own` (optional) | integer or null | Owner: team slot 0-3, null = neutral. | | `state.st.pr` (optional) | number | Progress 0-1 (a capture in progress). | | `state.st.mo` (optional) | string | Mode it runs. | | `tele` (optional) | object | | | `tele.b` | integer | Boot counter, stored in flash and incremented on every start. | | `tele.s` | integer | Sequence number within this boot, from 0. | | `tele.ms` | integer | Milliseconds since boot: the device has no trusted clock (ADR 0007 section 5). | | `tele.bat` (optional) | object | | | `tele.bat.v` (optional) | number | | | `tele.bat.pct` (optional) | number | | | `tele.rssi` (optional) | number | | | `tele.snr` (optional) | number | | | `tele.gps` (optional) | object | | | `tele.gps.la` | number | | | `tele.gps.lo` | number | | | `tele.gps.acc` (optional) | number | | | `tele.up` (optional) | integer | | **200:** Taken. | Field | Type | Notes | |---|---|---| | `accepted` | integer | | | `cmds` | array of object or object or object or object or object or object | | | `cmds[].id` | string | Command id; the device echoes it in its ack. | | `cmds[].k` | `config` | | | `cmds[].mo` (optional) | string | | | `cmds[].set` (optional) | object | Mode settings: teams per colour, hold time, volume. | | `game` | object | | | `game.v` | `1` | | | `game.g` | string or null | Game id; null when not assigned (the device shows "not in a game"). | | `game.ph` | `draft` / `scheduled` / `live` / `paused` / `ended` | Phase. | | `game.srv` | integer | Server time, epoch ms. | | `game.sa` (optional) | integer or null | Scheduled kickoff. | | `game.ea` (optional) | integer or null | Scheduled or set ENDEX. | | `game.tm` (optional) | array of object | | | `game.tm[].id` | string | | | `game.tm[].l` | string | | | `game.tm[].ea` | integer | | | `game.tm[].phy` (optional) | boolean | | | `game.pa` (optional) | integer or null | Paused at, or null. | **Errors:** [`device_not_found`](errors.md#device_not_found), [`forbidden`](errors.md#forbidden), [`invalid_body`](errors.md#invalid_body), [`invalid_key`](errors.md#invalid_key), [`key_blocked`](errors.md#key_blocked), [`key_expired`](errors.md#key_expired), [`key_owner_lost`](errors.md#key_owner_lost), [`key_paused`](errors.md#key_paused), [`key_required`](errors.md#key_required), [`key_revoked`](errors.md#key_revoked), [`mfa_required`](errors.md#mfa_required), [`rate_limited`](errors.md#rate_limited), [`wrong_key_kind`](errors.md#wrong_key_kind). ## Shared types ### ApiKey An API key as its owner sees it. Never the secret, except once in the create and rotate answers. | Field | Type | Notes | |---|---|---| | `id` | string (uuid) | | | `kind` | `play` / `team` / `dash` / `prop` / `link` / `gw` | | | `label` | string | | | `prefix` | string | The public part of the key, e.g. gt_team_ab12cd34. Safe to show. | | `gameId` | string (uuid) or null | | | `teamId` | string (uuid) or null | | | `status` | `active` / `paused` / `blocked` / `revoked` / `expired` | | | `createdAt` | string (date-time) | ISO 8601 time | | `lastUsedAt` | string (date-time) or null | ISO 8601 time | | `expiresAt` | string (date-time) or null | ISO 8601 time | | `pausedUntil` (optional) | string (date-time) | Only while the key is paused. | | `pausedReason` (optional) | string or null | Only while the key is paused. | ### Entity | Field | Type | Notes | |---|---|---| | `uid` | string | | | `affiliation` | `friend` / `hostile` / `neutral` / `unknown` | | | `callsign` | string | | | `team` (optional) | string | | | `squad` (optional) | string | | | `point` | GeoPoint | | | `status` (optional) | `alive` / `hit` / `down` / `medic` / `out` / `respawn` | | | `battery` (optional) | number | | | `speed` (optional) | number | | | `course` (optional) | number | | | `src` (optional) | `beacon` | | | `time` | integer | | | `stale` | integer | | ### GeoPoint | Field | Type | Notes | |---|---|---| | `lat` | number | | | `lon` | number | | | `hae` (optional) | number | | | `ce` (optional) | number | | | `le` (optional) | number | | ### Graphic | Field | Type | Notes | |---|---|---| | `kind` | `graphic` | | | `uid` | string | | | `shape` | `line` / `area` / `arrow` / `circle` | | | `points` | array of GeoPoint | | | `radius` (optional) | number | | | `sender` | string | | | `channel` | string | | | `teamId` (optional) | string or null | | | `label` (optional) | string | | | `color` (optional) | string | | | `time` | integer | | | `stale` | integer | | ### Marker | Field | Type | Notes | |---|---|---| | `kind` | `marker` | | | `uid` | string | | | `marker` | `enemy` / `friendly` / `objective` / `hazard` / `bomb` / `spot` / `rally` / `vehicle` / `building` / `box` / `fob` / `hq` / `medevac` / `waypoint` / `sos` | | | `point` | GeoPoint | | | `sender` | string | | | `channel` | string | | | `teamId` (optional) | string or null | | | `label` (optional) | string | | | `note` (optional) | string | | | `color` (optional) | string | | | `sidc` (optional) | string | | | `svg` (optional) | string | | | `time` | integer | | | `stale` | integer | | | `deadline` (optional) | integer | | ### Order | Field | Type | Notes | |---|---|---| | `kind` | `order` | | | `uid` | string | | | `sender` | string | | | `channel` | string | | | `orderType` | `move` / `waypoint` / `hold` / `rally` / `attack` / `recon` / `support` | | | `point` (optional) | GeoPoint | | | `waypoints` (optional) | array of GeoPoint | | | `text` (optional) | string | | | `time` | integer | | | `stale` | integer | | | `deadline` (optional) | integer | | ### Problem RFC 9457 problem details, sent as application/problem+json. | Field | Type | Notes | |---|---|---| | `type` | string (uri) | A link to this code on the errors page. | | `title` | string | For people; may be reworded. | | `status` | integer | | | `detail` (optional) | string | For people; may be reworded. | | `code` | string | Stable machine code: branch on this. | | `retryAfterSec` (optional) | integer or null | Seconds until a retry can work (rate limits, pauses). | | `issues` (optional) | array of object | invalid_body only: each problem with the request body. | | `issues[].path` | string | | | `issues[].message` | string | | --- source: https://gridtac.com/docs/api/errors.md --- # Errors Every error from `/api/v1` is an RFC 9457 problem document with the content type `application/problem+json`: ```json { "type": "https://gridtac.com/docs/api/errors#mfa_required", "title": "Two-factor sign-in required", "status": 403, "detail": "API keys need an account with two-factor authentication on, …", "code": "mfa_required" } ``` Branch on `code`. `title` and `detail` are for people and may be reworded. ## Codes | Code | Status | Meaning | |---|---|---| | `key_required` | 401 | No `Authorization: Bearer gt_…` header. | | `invalid_key` | 401 | The key is wrong, malformed or does not exist. | | `key_revoked` | 401 / 409 | The key was revoked. | | `key_expired` | 401 | The key's game ended more than 24 hours ago, or the key has passed its expiry. | | `rate_limited` | 429 | Over this key's per-minute budget for this kind of call. `Retry-After` and `retryAfterSec` say when the window resets. | | `key_paused` | 403 | Paused automatically, for example after too many requests. `retryAfterSec` says for how long. | | `key_blocked` | 403 | Blocked by an administrator. | | `mfa_required` | 403 | The key's owner has no second factor (see [Authentication](authentication.md)). | | `key_owner_lost` | 403 | The person who made the key no longer holds the place that gave it its powers: moved to another side, no longer commander or game master, kicked, or suspended. It works again if that changes back. | | `unauthorized` | 401 | Managing keys needs a signed-in session. | | `reauth_required` | 401 | Creating or rotating a key needs a sign-in from the last 15 minutes. | | `invalid_body` | 400 | The request body is wrong; `issues` lists each problem with its `path`. | | `wrong_key_kind` | 403 | This call needs another kind of key (for example the dashboard needs `gt_dash_`). | | `kind_not_creatable` | 400 | Prop and gateway keys come from pairing a device, and spectator links from the game page, not from this call. | | `team_required` | 400 | A team key needs a `teamId`. | | `game_not_found` | 404 | No such game. | | `team_not_found` | 404 | No such team in this game. | | `key_not_found` | 404 | No such key, or not one you may manage. | | `forbidden` | 403 | You may not create this kind of key in this game. | | `not_in_game` | 403 | A player key needs you to play in the game, or the player behind the key has left it. | | `player_devices_off` | 403 | The game master has turned off player devices for this game. Reading still works. | | `unavailable` | 503 | The live link is briefly unavailable; try again in a few seconds. | | `no_side` | 409 | The player behind this key is not on a side yet. | | `marks_not_allowed` | 403 | The game's marker rule does not let this player place marks (the game master chooses who may). | | `not_your_mark` | 403 | That mark belongs to someone else; you may change or remove only your own. | | `order_not_found` | 404 | No such order for this player: it does not exist, or it was not sent to you. | | `game_ended` | 409 | The game has ended: keys cannot be created for it, and players cannot write to it. | | `game_key_limit` | 409 | The game already has 10 team and dashboard keys; revoke one first. | | `too_many_keys` | 429 | More than 10 new keys in an hour. `retryAfterSec` says when to try again. | | `webhook_not_found` | 404 | No such webhook for this key: it does not exist, was removed, or another key made it. | | `webhook_limit` | 409 | This key already has 5 webhooks; remove one first. | | `url_not_allowed` | 400 | The webhook URL is not `https://` on the public internet (`detail` says why). | | `device_not_found` | 404 | No such device among yours or your clubs'. | | `device_key_scope` | 403 | A beacon's own key sends position, status and SOS only: it cannot read the player view, place marks or acknowledge orders. | | `too_many_devices` | 429 | At most 10 new devices an hour per account. | | `device_limit` | 409 | At most 20 devices per account, 200 per club; unpair one first. | | `beacon_limit` | 409 | That player already has a beacon in this game; take the other one out first. | | `game_device_limit` | 409 | At most 100 props in one game; take one out first. | | `pairing_not_found` | 404 | No pairing with that code: mistyped, already used, or never started. | | `pairing_expired` | 410 | The pairing code is older than 10 minutes; start pairing again on the device. | | `not_your_player` | 403 | Your own beacon is for you; a club beacon is lent only to a member of the club. | --- source: https://gridtac.com/docs/gtlink/overview.md --- # GT-Link GT-Link (`gtl/1`) is how a physical prop talks to GridTac: a domination box, a mine, a popper target, a countdown clock, a GPS beacon, or something we never thought of. It is open: anyone may build a device that speaks it, sell it, and run it in any GridTac game, **without a change on our side**. Our own reference firmware is MIT-licensed and the hardware files are CERN-OHL-P. > **Status: frozen (2026-11-10).** `gtl/1` will not change under you: fields, kinds and vocabulary > may be added (unknown ones are ignored on both sides), never changed or removed. A breaking change > would be `gtl/2`, served alongside. ## The idea in five lines 1. A device is **paired** to a player or a club once ([Devices](../api/devices.md)) and gets an opaque id (`dev_…`) and its own key (`gt_prop_…`, or `gt_play_…` for a beacon). 2. It says **what it has** in a manifest: buttons, switches, LEDs, a siren, a display. GridTac builds the game master's controls from that list; there is no device registry to apply to. 3. The game master **puts it in a game** and gives its inputs a meaning for that game (Red's button, the arm key). The firmware never decides who owns what. 4. It sends **events** (`press`, `hold`, `tripped`, `hit`) and its own state. The server decides what they mean for the game (a capture, a detonation) and sends **commands** back (light red, sound the siren, show the countdown). 5. It **never trusts its own clock**: it counts milliseconds since boot, and the server tells it the game time. ## Three ways to connect | Transport | For | How | |---|---|---| | **MQTT** | A device with Wi-Fi or 4G that can hold a connection: the normal case | `wss://mqtt.gridtac.com/mqtt` (MQTT over WebSocket), or `mqtts://mqtt.gridtac.com:8883` (MQTT over TLS) when your library has no WebSocket. Never plaintext. Credentials: `POST /api/v1/prop/mqtt-credentials` with the device key. | | **HTTPS** | A sleepy or very simple device that wakes, sends and sleeps | `POST /api/v1/prop/events` with the device key: the same messages in one batch; waiting commands and the game clock come back in the answer. | | **LoRa** (from 1.8) | A field without coverage | A gateway on the field forwards encrypted radio frames; it cannot read or forge them. See [Radio frame](radio.md). | A GPS beacon is simpler still: it is a player, not a prop, and uses the [player API](../api/play.md) with its own `gt_play_` key (`POST /api/v1/play/position`). Its position then outranks the player's phone. ## Topics All under the device's own id, which the server issued: a device cannot publish anywhere else. | Topic | Direction | QoS | Retained | Message | |---|---|---|---|---| | `gridtac/dev//hello` | device → server | 1 | yes | The manifest: what the device has | | `gridtac/dev//evt` | device → server | 1 | | One input event | | `gridtac/dev//state` | device → server | 1 | yes | Its own state (owner, progress, mode) | | `gridtac/dev//tele` | device → server | 0 | | Battery, signal, position, uptime | | `gridtac/dev//ack` | device → server | 1 | | The answer to a command | | `gridtac/dev//lwt` | device → server | 1 | yes | Set as the MQTT last will: `{ "on": false }` | | `gridtac/dev//cmd` | server → device | 1 | | A command | | `gridtac/dev//game` | server → device | 1 | yes | The game clock: phase, start, end, server time | Every field of every message: [Message reference](reference.md). ## The rules a device must follow - **Count boots and events.** Keep a boot counter in flash and add one on every start (`b`); number every message within a boot from 0 (`s`). GridTac drops anything it has already seen, so sending an event twice, or over both MQTT and HTTPS, never counts twice. - **Send time since boot, not a clock** (`ms`). GridTac dates each event from the freshest message it has had from that boot. Events queued offline are back-dated by at most 15 minutes. - **Read the game clock.** On every `game` message set `offset = srv - millis()` and draw countdowns from `ea - (millis() + offset)`. Not `live`: log inputs but never capture. `paused`: freeze local progress (a timer marked `phy`, such as a bomb, keeps running). - **Answer every command** on `ack` with its `id`. An output, action or field you do not know is answered `ok: false` with `err: "unknown_output"` or `"unknown_action"`, never a crash. - **Ignore unknown fields.** GridTac does the same, so a newer device works with an older server and the other way round. - **Obey `disable`.** The game master can switch every prop of a game off at once: all outputs off, inputs ignored, until a `disable` with `on: false`. - **Fetch new MQTT credentials before `expiresAt`.** ## What GridTac does with it The game master sees each device in the game with its battery, signal and last seen, binds a box to a zone, and can switch the whole game's props off. Which side a team button means is the game master's choice; by default a button labelled like a side means that side, a button labelled with a colour ("Red") means the side of that colour, and a red press never takes a zone for Blue. A box bound to a zone captures it under the zone's rules (a press, a hold, or a hold with enough players of that side inside); every event lands in the after-action review. Nothing a device sends can do more than the game master allowed for that game. Next: [Build a prop](../guides/build-a-prop.md), a walkthrough from pairing to the first capture. --- source: https://gridtac.com/docs/gtlink/reference.md --- # 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//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//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//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//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//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//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//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//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//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//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//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. --- source: https://gridtac.com/docs/gtlink/radio.md --- # Radio frame and gateways (LoRa, from 1.8) > **BETA, for GridTac 1.8.** GridTac already accepts gateways and opens their frames as described > here; our own gateway and LoRa beacon are still being built. The radio frame and the gateway topics > are additions to gtl/1 and are not part of its frozen core: they may change before 1.8. Everything > that already runs over MQTT is frozen. A field without mobile coverage still works: props and beacons talk LoRa to a **gateway** on the field, and the gateway forwards to GridTac over Wi-Fi or 4G. Anyone may build a gateway, ours or yours, and it is trusted with **nothing but transport**. ## Gateways forward, they do not speak - Every prop behind a gateway is still **its own device**, with its own id, key, manifest and sequence numbers. The gateway is a radio, nothing more. - A prop **encrypts with its own key**. The gateway sees ciphertext and radio metadata only, so it cannot read, change or invent a prop's events. Server-to-prop frames are encrypted by GridTac. - Several gateways may hear the same frame. GridTac deduplicates on address, boot and sequence, so two gateways on one field are redundancy, not double counting. - A gateway has its own identity and MQTT credentials that allow only its own `gridtac/gw//` topics, where `` is the `dev_` id it got at pairing (its key is `gt_gw_`; see [A gateway online](../api/devices.md#a-gateway-online)): `up` (frames heard), `down` (frames to send), `tele` (its battery, uplink, props heard, invalid frames). Fields: [Message reference](reference.md#gateway-up). ## The frame ``` | ver 1B | addr 4B | boot 2B | seq 4B | type 1B | ciphertext (CBOR payload) | tag 12B | \______________ header, sent in clear, authenticated ______________/ ``` - **AES-128-GCM** with a 12-byte tag; the header is the additional authenticated data. - **Nonce** (12 bytes) = `addr | boot | seq | direction | 0x00`. It never repeats as long as `boot` is a counter in flash, incremented on every start, and `seq` restarts at 0 each boot. The direction byte keeps prop-to-server and server-to-prop apart. A prop that cannot keep a boot counter must not use GCM. - **Payload:** the same short-key messages as over MQTT, packed as CBOR. A typical event fits in about 44 bytes: 12 header, about 20 payload, 12 tag. - **Keys:** 128 bits per prop, generated on the prop from its own hardware random number generator on first boot (never baked into the firmware image), handed to GridTac once at pairing and stored encrypted. A gateway never holds a prop key. To rotate, pair again. - **Replay:** GridTac accepts a frame only if its `(boot, seq)` is newer than the last one it accepted from that prop. - **Address:** 4 random bytes given to the device when it is paired with its radio key (`radioAddr` in the answer). Planned: a fresh address per game, so a captured address says nothing next week. ## What a frame may carry The `type` byte says what the payload is. A prop sends the messages it would send over MQTT; a beacon sends what the [Player view](../api/play.md) calls take, for the player who carries it. | Type | Name | Who | Payload | |---|---|---|---| | 1-4, 6 | `hello`, `evt`, `state`, `tele`, `ack` | prop | The [MQTT message](reference.md) of that name, without `b` and `s` | | 8 | `pos` | beacon | [`la`, `lo`, `acc`, `bat`, `spd`, `crs`](reference.md#beacon-pos-radio-type-8) | | 9 | `sos` | beacon | [`on`, and `la`, `lo` when it is raised](reference.md#beacon-sos-radio-type-9) | | 10 | `status` | beacon | [`ps`: alive, hit, down, medic, out, respawn](reference.md#beacon-status-radio-type-10) | The boot counter and sequence number come from the header, never from the payload. A type the device's kind does not send is ignored. A beacon's reports then go exactly the way its HTTPS calls would: the same game, the same player, the same limits, and its position outranks the player's phone the same way. ## What GridTac does with a frame In this order, so that nothing unauthenticated can change anything: 1. **Bounds:** 24 to 255 bytes, version 1, and the batch's `a` must equal the header's address. 2. An address dropped for abuse (below) is skipped. 3. The address is looked up among paired devices and the frame is **opened with that device's key**. A failed tag counts toward the abuse limits and nothing else happens. 4. Only an authentic frame meets the **replay rule**: its `(boot, seq)` must be newer than the last one accepted from that device. The same frame heard by two gateways is accepted once. Because the rule runs after the tag, a forged header cannot use up a real frame's sequence number. 5. The payload is handled as the device's own message; the device's key must be active and its rate limits apply. Your gateway gets no answer per frame: it forwards what it hears and leaves the judging to GridTac. ## Frames to a device GridTac sends a LoRa prop its commands (`cmd`, type 5) and its game clock (`game`, type 7) on `gridtac/gw//down`, as `{ "a": "", "f": "" }`, through **the gateway that heard the device most recently** (within 10 minutes). The gateway transmits `f` as it is; it cannot read it. - The frame is encrypted with the device's own key in the **down** direction, so it never opens as one of the device's own frames. - Its `boot` is the device's current boot counter, and its `seq` is GridTac's own downlink counter for that device: it only grows, never restarts. A device accepts a down frame only for its current boot and with a `seq` higher than the last one it accepted. - The clock goes only when it changes, when the device says `hello` and when it is put into or taken out of a game: airtime is scarce, so there is no 30-second refresh as over MQTT. - A device no gateway has heard gets nothing over radio. Its commands wait, as for any device. ## Abuse More than 20 failed tags a minute from one address drops that address for 5 minutes and tells the game master; more than 100 a minute across addresses flags the gateway. None of this ever changes the game by itself: a person decides. ## Hidden props A prop the other side must not find by radio (a hidden cache, a mine) sends on events plus a long heartbeat with random jitter, never a steady beat that gives its position away. It says so with `h: true` in its manifest. --- source: https://gridtac.com/docs/guides/first-scoreboard.md --- # Your first scoreboard Ten minutes from nothing to a screen at the field entrance that shows the score, who holds which zone and the time left, and a Discord message when a zone falls. You need to be the game master of the game (or ask them for a key). ## 1. Make a dashboard key On [gridtac.com](https://gridtac.com), signed in with two-factor on (or with Google or Apple), open **API & hardware → API keys** in the account menu, top right, and create a **Dashboard** key for your game. Copy it now: it is shown once. It starts with `gt_dash_` and can read only what every spectator may see. Check it: ```sh curl -s https://api.gridtac.com/api/v1/whoami -H "Authorization: Bearer gt_dash_…" ``` ```json { "keyId": "…", "kind": "dash", "label": "Scoreboard", "gameId": "…", "teamId": null } ``` Keep the key on a server, never in a web page that visitors can open. If all you want is a screen, the game master can make a **spectator link** instead (the game's settings, Map permissions): no key, no code, a URL you open on the TV ([Spectator link](../api/dashboard.md#spectator-link)). ## 2. Read the game ```sh curl -s https://api.gridtac.com/api/v1/dashboard -H "Authorization: Bearer gt_dash_…" ``` You get the phase, the teams and their points, the zones with their owner, the latest moments and the server time. It is rebuilt at most every 5 seconds, so poll every 5 to 15 seconds; the `RateLimit-Remaining` header says how much room you have left ([rate limits](../api/authentication.md#rate-limits)). A minimal page in Node, served on your own box: ```js import http from 'node:http'; const KEY = process.env.GRIDTAC_KEY; // gt_dash_… http.createServer(async (_req, res) => { const r = await fetch('https://api.gridtac.com/api/v1/dashboard', { headers: { authorization: `Bearer ${KEY}` } }); const d = await r.json(); const left = d.game.endsAt ? Math.max(0, Date.parse(d.game.endsAt) - Date.parse(d.serverTime)) : null; const rows = d.teams.map((t) => `
  • ${t.name}: ${t.points ?? 'hidden'}
  • `).join(''); const zones = d.zones.map((z) => `
  • ${z.name}: ${d.teams.find((t) => t.id === z.ownerTeamId)?.name ?? 'nobody'}
  • `).join(''); res.setHeader('content-type', 'text/html; charset=utf-8'); res.end(`

    ${d.game.name}

    ${d.game.phase}${left !== null ? `, ${Math.round(left / 60000)} min left` : ''}

      ${rows}

    Zones

      ${zones}
    `); }).listen(8080); ``` Draw countdowns from `serverTime`, not from the viewer's clock. `points` is `null` for every team when the game master hides the score. ## 3. Get pushed when a zone falls Polling is fine for a screen. For a bot, let GridTac call you: ```sh curl -s https://api.gridtac.com/api/v1/webhooks \ -H "Authorization: Bearer gt_dash_…" -H "content-type: application/json" \ -d '{ "url": "https://bot.example.com/gridtac", "events": ["zone_captured"] }' ``` Store the `secret` (`whsec_…`) from the answer. Every delivery is a `POST` with the event in the body and a `GridTac-Signature` header; check the signature, answer `2xx` within 5 seconds, then post `event.summary` ("Blue took ALPHA") to your Discord channel. How to check the signature, retries and the delivery log: [Webhooks](../api/webhooks.md). ## Where next - A team's own board, with that team's positions and orders: [Team view](../api/team.md) and a `gt_team_` key. - Your own device as a player: [Player view](../api/play.md). - Hardware: [Build a prop](build-a-prop.md). - Every endpoint: [API reference](../api/reference.md). Every error: [Errors](../api/errors.md). --- source: https://gridtac.com/docs/guides/build-a-prop.md --- # Build a prop: a two-button domination box From an ESP32 on the bench to a zone captured in a real game. Everything below is plain HTTPS and MQTT; any board and language that can do TLS will work. Our own reference firmware does exactly this and is MIT-licensed, so you can start from it instead: put it on a Heltec V4 from your browser at [gridtac.com/flash](https://gridtac.com/flash) (Chrome or Edge, a USB cable, no install). It talks to api.gridtac.com; the optional **Server** step on the same page points it at your own server or a dev stack instead. The protocol itself: [GT-Link](../gtlink/overview.md). > GT-Link `gtl/1` is **frozen**: what this guide uses will not change under you. See the [overview](../gtlink/overview.md). ## 1. Pair it The box has a small screen, so it pairs the way a TV does. With no key stored yet it asks for a code: ```http POST https://api.gridtac.com/api/v1/devices/announce Content-Type: application/json { "kind": "prop", "model": "acme.dombox", "fw": "0.1.0" } ``` It shows `userCode` (for example `KX7M-Q2RP`), then polls `POST /api/v1/devices/token` with its `deviceCode` every `interval` seconds. You type the code in the GridTac app (**Account → My devices**) or on gridtac.com. The next poll answers once with `deviceId` (`dev_…`) and `key` (`gt_prop_…`): store both in flash. Details and the Bluetooth path for boxes without a screen: [Devices](../api/devices.md). Pick a model name in your own namespace (`yourname.thing`); `gridtac.*` is ours. There is nothing to register. ## 2. Connect ```http POST https://api.gridtac.com/api/v1/prop/mqtt-credentials Authorization: Bearer gt_prop_… ``` Connect to `wss://mqtt.gridtac.com/mqtt` (or `mqtts://mqtt.gridtac.com:8883`) with the returned `username` and `token` as the password, and set the last will to `gridtac/dev//lwt` = `{"on":false}`, retained. Subscribe to `gridtac/dev//cmd` and `gridtac/dev//game`. Fetch new credentials before `expiresAt`. ## 3. Say what it has Publish the manifest to `gridtac/dev//hello`, retained, on every connect: ```json { "p": "gtl/1", "m": "acme.dombox", "fw": "0.1.0", "caps": [ { "id": "red", "kind": "button", "label": "Red", "role": "team:0", "props": { "colour": "red" } }, { "id": "blue", "kind": "button", "label": "Blue", "role": "team:1", "props": { "colour": "blue" } }, { "id": "capture", "kind": "strip", "label": "Light bar", "props": { "pixels": 8 } }, { "id": "beep", "kind": "buzzer", "label": "Buzzer" } ] } ``` `role: "team:0"` marks a team button. Which side it means in a given game is decided by the game master; by default the button's label or colour picks the side with that name or colour. Capability ids are yours to choose (a port name like `in3` is fine) and must stay the same across firmware versions. ## 4. Keep a boot counter Read a counter from flash at start, add one, write it back: that is `b`. Number every message in this boot from 0: that is `s`. Send `ms`, milliseconds since boot, in every message. Never send a wall-clock time; the box does not have a trusted one. ## 5. Send events A press on the red button: ```json { "b": 7, "s": 12, "ms": 905300, "c": "red", "e": "press" } ``` to `gridtac/dev//evt` at QoS 1. If the zone needs a hold, send `hold` with the held time in milliseconds as `x` (`{"c":"red","e":"hold","x":10000,…}`) as soon as the button has been held long enough, not on release. Every minute or so, and on a change, publish telemetry to `gridtac/dev//tele`: ```json { "b": 7, "s": 13, "ms": 960000, "bat": { "v": 3.92, "pct": 81 }, "rssi": -61, "up": 960 } ``` Lost the connection? Keep the events in a small queue with their `b`, `s` and `ms`, and send them when it is back, after a fresh `tele`. GridTac dates them from that `tele` (up to 15 minutes back) and drops anything it has already seen. ## 6. Listen to the server On `cmd`, act on what you know and answer every command on `gridtac/dev//ack`: ```json { "id": "own-3fa2c1d0-lx8k2", "ok": true } ``` What a capture box receives from GridTac: | Command | Meaning | |---|---| | `{"k":"config","mo":"capture","set":{"holdMs":10000}}` | How long a hold is (0 = a press captures). Fill the light bar while a button is held, and send `hold` the moment it is long enough. | | `{"k":"mode","mo":"capture","a":"owner","args":{"own":0}}` | Who holds the zone now: team slot 0-3, or `null` for neutral. Light the bar in that colour, or whatever your box does for an owner. | | `{"k":"mode","mo":"capture","a":"answer","args":{"ok":false,"slot":0,"reason":"too_few_inside","have":2,"need":5}}` | The answer to a hold that started, in a game where enough players must be inside the zone. Show it: two of five. | | `{"k":"disable","on":true}` | The game master switched the props off: everything dark, ignore the buttons until `on: false`. | A `mode` command tells your box what happened in the game mode; how it shows that (lights, sounds, a display) is up to the box. An output or action you do not have gets `{"id":"…","ok":false,"err":"unknown_output"}`, a mode you do not run `"err":"unknown_mode"`. Unknown fields are ignored. On `game`, keep the phase and the clock: `offset = srv - millis()`. While `ph` is not `live`, show that and do not capture locally. ## 7. Into a game The game master adds the box to the game, binds it to a zone and picks how the zone is taken: by the box alone (a press or a hold) or by the box with enough players of that side inside. They see its battery, signal and last seen, and can switch every prop in the game off at once. ## No MQTT? Use HTTPS A box that wakes, sends and sleeps can post the same messages in one batch: ```http POST https://api.gridtac.com/api/v1/prop/events Authorization: Bearer gt_prop_… Content-Type: application/json { "tele": { "b": 7, "s": 11, "ms": 905000, "bat": { "pct": 81 } }, "evts": [{ "b": 7, "s": 12, "ms": 905300, "c": "red", "e": "press" }] } ``` The answer carries `accepted`, the commands waiting for the box, and the current `game`. Sending a batch again after a timeout is safe: events are deduplicated on `b` and `s`. Every field: [Message reference](../gtlink/reference.md). --- source: https://gridtac.com/docs/guides/game-master.md --- # Game Master guide Everything the organiser of a game does on gridtac.com: set the game up, put it on the map, invite the players, start it, run it, and look back at it afterwards. Use a laptop or a tablet; the game screens ask for a larger screen than a phone. The pictures on this page are taken by a script from the live screens, so they show what you will see. The game in them is a made-up one. Map data © OpenStreetMap contributors. ## Who can do what A game has an **owner** (who made it), and the owner can add **co-owners** and **referees**. In the game itself players have a rank: **commander**, **platoon leader**, **squad leader** or **soldier**. A player can also be made a **map operator**, who may draw on the map. The bar at the top of every game screen has a switcher with the workspaces your role may open: | Role | Workspaces | |---|---| | Owner, co-owner | Command, GM, Setup, Map | | Referee | Command, GM | | Commander, platoon leader, squad leader | Command | | Map operator | Command, Map | | Soldier | none: soldiers play in the app | - **Setup** is where the game is prepared. - **Map** is where the play area, the zones and the map overlay are drawn. - **GM** is where you run a live game. - **Command** is the commander's map. A GM sees every side there and can pick **View as** to see one side's picture. A GM who also plays on a side keeps every GM tool and starts as their own team (marked "your team"); **All teams** gives the full picture back. See the [Commander guide](commander.md). The switcher only moves you between screens. The server checks every change against your role, so a button you can see but may not use answers with the reason. A referee can run the live game but not change its setup: no deleting zones, no changing timers or tickets, and no Setup or Map. ## Your games ![My games: your games with their status, and New game](img/gm-my-games.jpg) **My games** (the account menu, top right, or gridtac.com/admin) lists the games you run, newest first, with date, players and status: - **draft**: being set up. - **live**: being played. - **ended**: over, with an after-action review. A draft with a start time shows when it starts. It goes live by itself at that time. - **Click a game** to open its Setup. - **Clone** makes a new draft with the same rules, map and sides, but no players. Use it to run the same scenario again. - **Delete** removes the game for good. Only the owner can do this. - **AAR** on an ended game opens the replay. - Under **After-action** are the games you only played in. ### Make a game ![The New game form](img/gm-create-game.jpg) **New game** asks for: - a **name** - an optional **start** and **end** time: the game goes live and ends by itself at these times - the **factions** (sides), each with a name and a colour - the **timers** for being down, revived and respawning (see [Rules](#down-revive-and-respawn)) - how often the players' phones report their position The default is a good start for most games. **Create game** takes you into Setup. ## Setup ![Setup: the sections on the left, the section in the middle, the readiness check on the right](img/gm-setup-basics.jpg) Setup has three columns: - **Left:** the sections. - **Middle:** the section you opened. - **Right:** whether the game is ready to start, and the Start and End buttons. Changes in a form are saved with its **Save changes** button. A choice made with a button, such as On or Off, saves at once. ### Basics - The game's **ID**, with a **Copy ID** button, for a key or for support. - Its **name** and **schedule**. - How often phones report their position. The **Danger zone** at the bottom deletes the game. Only the owner can do this. ### Factions ![Factions: name and colour per side](img/gm-setup-factions.jpg) One row per side, with its name and colour. **Add faction** adds a side, and **Delete** removes one. A game can have any number of sides; most have two. ### Down, revive and respawn ![The rules: timers, revive by GPS, medics per life](img/gm-setup-rules.jpg) When a player is hit they go **down** and a bleed-out timer runs. A medic can **revive** them before it ends. If no one does, they must go to a **respawn** area and wait out the respawn timer. - **Bleed-out**, **Medic / revive** and **Respawn** set the timers. - **Respawn countdown starts** decides when the respawn timer begins: when the player reaches their respawn area, or the moment they die. - **Require GPS proximity for revive**: when On, the medic's phone must be close to the casualty. - **Medics per life** limits how many times one life can be revived. ### Map permissions ![Map permissions: markers, map operators, symbols, devices, spectators](img/gm-setup-permissions.jpg) Who may put what on the map: - **Markers**: who may place markers (enemy seen, mine, objective and so on). The choices are the commander only, the leaders, or everyone. - **Map operators**: allow players who are not leaders to draw, and how many per squad. - **NATO symbols**: commanders build proper unit symbols instead of plain markers. - **Player devices**: whether players may use a GPS beacon instead of their phone, or phones only. - **Spectator dashboard**: whether a spectator screen shows positions, and how late. A delay of 5 to 30 minutes stops the dashboard from being used to spy. - **Spectator link**: make a link for a TV at the field entrance. It is shown once, and **Turn off** stops it. - **API keys**: the keys made for this game (Beta). You can see them and revoke them here. Keys are made on gridtac.com under **API & hardware**. The **Alerts** section has one setting. When it is On, a player's phone warns them when they leave the play area, also with the screen off. ### Invites ![Invites: a new invite with PIN, QR code and link](img/gm-setup-invites.jpg) An invite decides which rank a player gets when they join. It can also set their side, platoon and squad. 1. Pick the **role**. Leave the **faction** on "Any / let them pick" to let players choose. 2. Optionally set **max uses** and how many hours it lasts. 3. **Create invite** gives three ways in: - a **PIN** like `GTAC-K7Q2M`, typed in the app - a **QR code** to scan - a **link** to send in a chat **Active invites** lists every invite that still works and how often it has been used. **Revoke** stops one. Make one soldier invite per side and one commander invite. That covers most games. #### The whole structure at once For a bigger game, **Create the structure** makes every code your organisation needs in one go: 1. Tick the factions, and write the **Platoons** as names separated by commas: `1, 2` gives Platoon 1 and Platoon 2, and a name like `Alpha` stays as it is. 2. Keep **A commander code per faction** ticked if you want one. 3. Tick **Down to squads** and fill in **Squads per platoon** if every squad should get its own squad leader and soldier code. Without it, each platoon gets one platoon leader code and one soldier code, and soldiers pick their squad when they join. 4. Pick how long the codes are **Valid for** (7 days by default, so you can make them before the game day), then create them. 5. **Print sheets** prints the codes per faction: a card per code with what it is for, its QR code and its PIN, running onto more pages when there are many. Next to it, **Soldier codes only** (the default) prints just the codes for the players, for the briefing; the leaders usually get theirs in person. Pick **Every code** to print the commander and leader codes too. Cut the cards and hand each one to the people it is for. Codes you already made for the same role and place are kept rather than made twice, so you can click again after adding a platoon. A code that would run out before the others is replaced. ### Roster ![Roster: every player, with the edit form open](img/gm-setup-roster.jpg) Everyone who has joined, filterable by callsign or squad. **Edit** on a player lets you: - change their callsign, side, platoon, squad, echelon or class - make them a map operator, when map operators are allowed - **Kick** them: they can join again - **Ban** them, with a reason: they cannot join again until you **Unban** them ### Staff and referees ![Staff: co-owners and referees by email](img/gm-setup-staff.jpg) Add a **co-owner** (runs the game with you, including Setup) or a **referee** (runs the live game only) by the email they signed up with. **Staff seats on the field** decides whether each staff member's position is shown to the teams or hidden. ### Event log ![The event log with its exports](img/gm-event-log.jpg) Everything that happened in the game: joins, status changes, markers, orders and chat. Filter it by type. **Export** it as CSV or PDF for the record, or as KML or GPX to open the tracks in another map program. ## The map ![The map editor: tools on the left, the map, settings on the right](img/gm-map-editor.jpg) **Map** (the switcher, or **Map & zones** in Setup) is where the play area is drawn. The **tools** on the left, from the top: - **Select**: pick and move what is drawn. Esc returns to it from any other tool. - **Boundary**: the play area. With the play-area alert on, players are warned when they leave it. - **Safe zone**: an area marked safe on every map, such as the staging area. It is a marking only: the game does not stop hits there. - **No-go**: an area no one may enter. A player's phone, and watch, warns them when they walk into it. - **Zone**: a game zone (see [Zones](#zones)). - **Camp**, **Water**, **Parking**, **Hazard** and **Marker**: points everyone sees. - **Grid**: a reference grid with your own cell size and labels. It can follow the map or an overlay image. - **Overlay**: put a picture over the map, such as a hand-drawn site map or a drone photo. Align it by three points. Name a feature before you place it, in the field under the tools. Undo and Redo are at the top. **Save map** stores the drawing; the editor warns you before you leave with unsaved changes. The **right column** holds the settings for the base map, the grid, the overlay and the zones. ### Zones ![A zone open in the inspector](img/gm-map-zone.jpg) A zone is a circle or a free shape with a purpose. On the map its label says who holds it in words as well as colour ("ALPHA · Blue"), so colour-blind players can read it too. The purposes: - **Capture point**: sides take it and score points every minute they hold it. - **Respawn**: where a side respawns. - **Base**: a side's home. - **Destination**: where a VIP or an item must be brought. - **Item start**: where a fetch item lies. - **FOB**: a capture point that also works as a respawn for the side that holds it. For a capture point you set: - **Taken by**: players inside it (by GPS), a capture box, or a box with players inside. - **Players to take** and **Time to take**: how many players, and for how long, it takes to win the zone. - **Points a minute** while held. - **Seen by**: everyone, or only some sides. A zone a side cannot see does not exist for them. **Score and template**, under the zone list, sets whether players see every side's points, only their own, or none until the end. It also applies a ready-made set of capture rules (Sunday domination, Small group or Milsim weekend) to every capture point. Zones change at once, also in a live game. They do not wait for **Save map**. ## Start the game ![The readiness check on a draft](img/gm-readiness.jpg) The right column in Setup checks the game before you start it. It looks for things such as: - nobody has joined, or there is no play area - players on no side, or everyone on one side - players who have never reported a position - no commander - a zone taken by a box when no box is chosen - a respawn zone that names no side - A **blocking** finding must be fixed first. - A **warning** is worth reading but does not stop you. - A finding about zones has a link straight to them on the map. The table under the findings shows each player's last report and GPS accuracy. Check it before you start: a player who has not reported is not on the map. **Start the game**, then **Yes, start the game**, makes it live. A draft with a start time goes live by itself at that time. ## Run a live game ![The GM workspace in a live game](img/gm-live.jpg) Open **GM** in the switcher. You see every side on the map. - **Left:** the actions. - **Right:** what needs your attention, the zones, and the event log. Every action shows its result next to its button. When the server refuses one, the reason is shown there, for example "The game is paused. Resume scoring first." ### Pause and points - **Pause scoring** stops the zones from scoring, for a break or a dispute. Down and respawn timers and tickets keep running, and the top bar shows PAUSED. **Resume scoring** starts it again. - To adjust points, press the **+/-** button on a side's row, enter the points (for example +200 or -100) and a reason, then **Apply**. The reason is shown to the players and logged. ### Needs you ![Needs you: an SOS, the casualties and the players who stopped reporting](img/gm-needs-you.jpg) The first tab on the right collects what needs a person: - **SOS**: a player asked for help. **Show on map** finds them. **Acknowledge** tells you have seen it. **Clear** takes it down for everyone. - **Casualties**: who is down right now. **Revive** brings a player back from the GM's side, for example when a medic's phone has no signal. - **Box captures to check**: a capture box reported something worth a look. - **Stopped reporting**: phones that went dark. **Show** gives where they last were. ### Zones in a live game ![The Zones tab with one zone open](img/gm-zones.jpg) The **Zones** tab lists every zone with its owner. **Manage** on a zone lets you: - set its owner, with a reason, when a capture was disputed - switch it off and on - delete it - open it in the map editor Under the zones, **Boxes in this game** lists the capture boxes. **Take back** releases a box from this game. **Turn all boxes off** silences every box at once. ### Send The **Send** buttons on the left each open a small form: ![Send a mission to a side's commanders](img/gm-send-mission.jpg) - **Message to everyone**: to all players, or to the commanders only. To write to **one** player, use the chat on the Command screen with **Direct** and pick them; they answer you the same way, and their reply reaches the game staff only. - **Mission to a team**: a task for one side's commanders, or every side's, with an optional points reward. Commanders see it on their **Missions** tab and **Report done**. You approve it under **Open missions**, and the reward is paid. ![Hot zone and hold bonus](img/gm-send-hotzone.jpg) - **Hot zone or hold bonus**: one capture point scores double for some minutes, or pays a bonus to whoever holds it for long enough. Both are good for moving a game that has stalled. ![Give and fire UAV and EMP](img/gm-send-uav.jpg) - **UAV or EMP for a team**: give a side a **UAV** (it shows them the enemy for a while) or an **EMP** (it blinds the enemy's map for a while). Give one as a reward, or fire one yourself, over a whole side or around a place. The side's commander can fire what they have been given. The durations are set here too. A running UAV or EMP is listed in the top bar, where the GM can **End** it early. ### Game modes ![Game modes: VIP, hunt, fetch, tickets and mobile respawn](img/gm-modes.jpg) **Game modes** starts a mode on top of the zones: - **VIP**: one player must be escorted to a destination. You choose who escorts, who can see the VIP, how often they are shown, the time limit and the reward. - **Hunt**: one squad is hunted and shown to the hunters every so often. Optionally it wins by surviving for a time. - **Fetch**: items, or a single flag, start somewhere and must be brought to a base. You choose what happens when a carrier is hit. **Confirm** or **Send back** settles a delivery. - **Tickets**: each side has a number of respawns. **Adjust** changes them during the game, and you choose what happens when a side runs out. - **Respawn**: a mobile respawn that you, or the players you name, can move during the game. ## End the game ![Setup on a live game: End is in the right column](img/gm-setup-live.jpg) **End**, in the right column of Setup, then **End the game** stops it for everyone. A game with an end time ends by itself at that time. **Re-open** brings an ended game back; its review is rebuilt when it ends again. A live game that has been quiet for a long time can also be ended by a GridTac administrator. The reason they give is shown to the players and to you. ## After the game ![The after-action review](img/gm-aar.jpg) **AAR** on an ended game, in My games, replays it: - **Summary**: the result, the missions, and the losses per side. - **Timeline**: every event. Under the map, the replay controls step from event to event or play the game at a speed you pick. The **Trails** and **Heat** chips on the map show where everyone went and where the game was fought. Players who were in the game can open the review too. --- source: https://gridtac.com/docs/guides/commander.md --- # Commander guide The Commander screen on gridtac.com is a live map of your side. It is for whoever leads: commanders, platoon and squad leaders, and map operators. From it you see your people, give orders, mark what you know, talk, and use what the Game Master gives you. Use a laptop or a tablet. In the field, a phone runs the GridTac app. The pictures on this page are taken by a script from the live screen. The game in them is a made-up one: Blue against Red, and you are BLUE6, Blue's commander. Map data © OpenStreetMap contributors. ## The screen ![The Commander screen in a live game](img/cmd-overview.jpg) Open it from **Command** in the top bar, or from gridtac.com/command. **Top bar:** - the game you are watching - your side and callsign - the status of the game and how many are reporting - the clock to the end - the score: points per side, and running UAVs and EMPs. With tickets or fetch items in the game, these are shown too. **Left:** the tools, and under them the list of what is on the map (orders, drawings, markers). **Middle:** the map. **Right:** four tabs. | Tab | What it holds | |---|---| | **Force** | your people | | **Missions** | missions from the Game Master, and your UAV and EMP. Commanders only | | **Comms** | the chat | | **Events** | what has happened | **What you see is fogged.** You see your own side, and the enemy only where your side has seen them: a marker someone placed, a UAV, or a zone they took. The fog is applied on the server, so no screen and no app can show more than your side has earned. On a smaller screen the left column opens from the button at the top of the map, and the right column from the line at the bottom. ## Your people on the map ![A player's card on the map](img/cmd-unit.jpg) Each dot is a player, coloured by side, with their callsign. A zone's label says who holds it in words as well as colour ("ALPHA · Blue"). A hit or down player is drawn differently, and a player whose phone stopped reporting fades out. **Click a player** to see: - their side, status, and how long ago they reported - how accurate their GPS is - their battery - whether they report through a GPS beacon instead of a phone **Track** follows them on the map. The tracking panel then shows their range, bearing and time to reach them from the map centre or from another player. **Stop** ends it. Players too close together to tell apart are listed in one card ("3 here"). ## Orders ![Giving an order: click the map, then fill in the form](img/cmd-order.jpg) 1. Pick **Order** in the tools. 2. Click the map where the order is for. Click again to add legs to a route. 3. Fill in the form on the right: - **Type**: move, waypoint, hold, rally, attack, recon or support. - **To**: everyone, a side, a squad or a single player. - A **note**. - How long it is valid (**TTL**, in minutes). - An optional **countdown**, for example "attack in 10 minutes". 4. **Issue** sends it. The players get it in the app with a sound and see it on their map. ![The active orders, with who has acknowledged them](img/cmd-orders-list.jpg) The **Orders** list on the left shows every active order and who has acknowledged it ("✓ 3 by B-11, B-12 …"). The arrow shows an order on the map, and **Cancel** takes it back. You can also drag an order on the map to move it. An order goes through three steps: 1. **Open**: sent, nobody has answered yet. It is on your map. 2. **WILCO**: a player has acknowledged it. It leaves your map, so the map shows only what is still waiting for an answer, and stays in the list marked WILCO with who answered. Turn on **Acknowledged orders** under **Layers** to see them on the map again, dimmed. 3. **Done**: the unit has finished the task and tapped **Done**. The order is gone for everyone, and you get a "Done" notice. When an order is addressed to you, you can mark it **Done** yourself from the list or from the order on the map. ## Markers ![Placing a marker: the marker dialog](img/cmd-marker.jpg) **Marker** opens a menu of marker types: enemy seen, objective, mine, casualty and more. Pick one and click the map. You can add a title, a note, a countdown and a colour, then **Place** it. Who may place markers is the Game Master's choice (commander only, the leaders, or everyone). When the game uses NATO symbols, the Marker button builds a proper unit symbol instead: affiliation, unit type and echelon. Click a marker to delete it, or drag it to move it. ## Drawing ![Drawing an arrow](img/cmd-draw.jpg) **Draw** gives a line, an area, an arrow or a circle, for a phase line, an objective area or an axis of attack. - Click the map for each point. - Right-click undoes the last point, and a double-click finishes. - The bar above the map has the colours, **Finish**, **Undo** and **Cancel**. You can give the drawing a label. Your own side sees it. ## Measuring ![Measuring a distance](img/cmd-measure.jpg) **Measure** gives a **distance**, an **area** or a **range ring**. Measurements are yours alone: nobody else sees them, and they are not saved with the game. **Clear all** removes them. ## The map: layers and more ![The layers menu](img/cmd-layers.jpg) **Layers**, in the map's corner, changes only your own view: - the base map, and Lantmäteriet's detailed map in Sweden - a daylight style for bright screens - the Game Master's overlay image - colouring the players by side, platoon or squad - **Acknowledged orders**: orders a unit has answered WILCO, shown dimmed (off by default) - the reference grid (the game's own, MGRS or none) and where its labels go ![The More menu, with Print map](img/cmd-more.jpg) **More**: - **Fit to units** or **Fit to area**. - **Print map**: an A5 PDF of the map with the grid, the zones and the players, to hand out or put in a map case. Markers, orders and labels are not printed. - Sounds for chat, orders and SOS, on or off. The coordinate readout in the corner toggles between MGRS, latitude and longitude, and the game's own grid. ## Force ![Force: your side, with one player opened](img/cmd-force.jpg) **Force** lists your side by platoon and squad. At the top is a tally: joined, alive, down, and dark (stopped reporting). Search by callsign, or filter by side. Click a player to find them on the map. **Manage** on a player lets a commander: - change their callsign, platoon, squad and rank - make them a map operator, when the game allows map operators Only the Game Master can move a player to another side, or make or unmake a commander. **Invite players**, the icon at the top of Force, makes an invite for your side: a PIN, a QR code and a link. It works like the Game Master's [invites](game-master.md#invites), with two limits: the invite is always for your own side, and only for ranks below your own. ## Missions, UAV and EMP ![Missions: a mission from the Game Master, and the UAV and EMP in stock](img/cmd-missions.jpg) **Missions** is for commanders. **Missions from the Game Master:** - A mission shows its task and its reward. - When your side has done it, **Report done**. The Game Master approves it and the points are paid. - **Send to all of Blue** passes a commanders' mission on to your whole side. **UAV and EMP:** what the Game Master has given your side is in stock here. - A **UAV** shows you the enemy for a while. - An **EMP** blinds the enemy's map for a while. **Fire** asks where: over the whole enemy side, or around a zone with a radius. While one runs, the map draws it as a circle with the time left, and the top bar counts it down. A UAV is shown only to the side that fired it; an EMP also to the side it hits. ## Comms ![The chat](img/cmd-comms.jpg) **Comms** is the game's chat. Send to: - **All** - your **Faction** - your **Squad** - the **Commanders** of every side, as a commander - **Direct**: one person. A second list picks who: the **Game staff**, or a player on your side. Nobody else on the side sees a direct message, not even another commander. The Game Master, who sees the whole game, can. Inside a side, a leader has to be at one end: two plain players cannot write to each other directly. Direct messages are labelled "Direct" with the other person's callsign, and clicking one sets up your reply to them. Each message can be found on the map: it was sent from where the sender stood. ## Events ![Recent events](img/cmd-events.jpg) **Events** is the game's recent history as your side may see it: joins, players going dark, hits, markers, orders and chat. Filter it by type. The line at the bottom of the screen shows the latest event; click it to open the tab. ## SOS ![An SOS on the Commander screen](img/cmd-sos.jpg) When a player on your side sends an SOS from the app, a red banner and a sound tell you. - **Show** centres the map on them. - **Ack** tells your own screen you have seen it. - **Clear** takes the SOS down for everyone, once help is on its way. A commander or the Game Master can do this. - **Acknowledge all** handles several at once. The sound can be turned off under **More**.