{"openapi":"3.1.0","info":{"title":"GridTac API","version":"1","description":"The public GridTac API. Generated from the server code (apps/api/src/api/v1-spec.ts); guides at https://gridtac.com/docs."},"servers":[{"url":"https://api.gridtac.com"}],"tags":[{"name":"Keys","description":"Make and manage API keys."},{"name":"Player","description":"Act as yourself in a game: a player key."},{"name":"Team","description":"One team's commander view: a team key."},{"name":"Dashboard","description":"The spectator view: a dashboard key."},{"name":"Webhooks","description":"Live events pushed to your server, signed: a team or dashboard key."},{"name":"Devices","description":"Pair beacons and props, lend club devices, take them back."}],"paths":{"/api/v1/keys":{"post":{"operationId":"createKey","tags":["Keys"],"summary":"Create an API key","description":"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.","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["play","team","dash","prop","link","gw"],"description":"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":{"type":"string","minLength":1,"maxLength":60},"gameId":{"type":"string","format":"uuid"},"teamId":{"type":"string","format":"uuid","description":"Required for a team key."}},"required":["kind","label","gameId"]}}}},"responses":{"201":{"description":"The new key, with its secret (once).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["play","team","dash","prop","link","gw"]},"label":{"type":"string"},"prefix":{"type":"string","description":"The public part of the key, e.g. gt_team_ab12cd34. Safe to show."},"gameId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"teamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"status":{"type":"string","enum":["active","paused","blocked","revoked","expired"]},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"expiresAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"pausedUntil":{"type":"string","format":"date-time","description":"Only while the key is paused."},"pausedReason":{"type":["string","null"],"description":"Only while the key is paused."},"key":{"type":"string","description":"The full key. Shown ONCE: store it now, it cannot be read again."}},"required":["id","kind","label","prefix","gameId","teamId","status","createdAt","lastUsedAt","expiresAt","key"],"description":"An API key as its owner sees it. Never the secret, except once in the create and rotate answers."}}}},"400":{"description":"Problem: `invalid_body`, `kind_not_creatable`, `team_required`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `reauth_required`, `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `mfa_required`, `not_in_game`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`, `team_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `game_key_limit`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `too_many_keys`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"operationId":"listKeys","tags":["Keys"],"summary":"Your API keys","description":"Newest first. Never the secrets.","security":[{"session":[]}],"responses":{"200":{"description":"Your keys.","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}},"required":["keys"]}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/keys/{id}/rotate":{"post":{"operationId":"rotateKey","tags":["Keys"],"summary":"Rotate a key","description":"A new secret for the same key. The old secret stops at once.","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The key, with its new secret (once).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["play","team","dash","prop","link","gw"]},"label":{"type":"string"},"prefix":{"type":"string","description":"The public part of the key, e.g. gt_team_ab12cd34. Safe to show."},"gameId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"teamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"status":{"type":"string","enum":["active","paused","blocked","revoked","expired"]},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"expiresAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"pausedUntil":{"type":"string","format":"date-time","description":"Only while the key is paused."},"pausedReason":{"type":["string","null"],"description":"Only while the key is paused."},"key":{"type":"string","description":"The full key. Shown ONCE: store it now, it cannot be read again."}},"required":["id","kind","label","prefix","gameId","teamId","status","createdAt","lastUsedAt","expiresAt","key"],"description":"An API key as its owner sees it. Never the secret, except once in the create and rotate answers."}}}},"401":{"description":"Problem: `key_revoked`, `reauth_required`, `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `key_blocked`, `mfa_required`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `key_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/keys/{id}":{"delete":{"operationId":"revokeKey","tags":["Keys"],"summary":"Revoke a key","description":"Your own key, or any key bound to a game you run as game master. Revoking twice is fine.","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Revoked."},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `key_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/whoami":{"get":{"operationId":"whoami","tags":["Keys"],"summary":"What this key is","security":[{"apiKey":[]}],"responses":{"200":{"description":"The key behind the call.","content":{"application/json":{"schema":{"type":"object","properties":{"keyId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["play","team","dash","prop","link","gw"]},"label":{"type":"string"},"gameId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"teamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},"required":["keyId","kind","label","gameId","teamId"]}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/play":{"get":{"operationId":"getPlay","tags":["Player"],"summary":"What you see in the app","description":"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.","security":[{"apiKey":[]}],"responses":{"200":{"description":"Your view.","content":{"application/json":{"schema":{"type":"object","properties":{"me":{"type":"object","properties":{"playerId":{"type":"string","format":"uuid"},"callsign":{"type":"string"},"role":{"type":["string","null"]},"platoon":{"type":["string","null"]},"squad":{"type":["string","null"]},"unit":{"anyOf":[{"$ref":"#/components/schemas/Entity"},{"type":"null"}],"description":"Your own live unit, or null when you are not reporting."}},"required":["playerId","callsign","role","platoon","squad","unit"]},"game":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"phase":{"type":"string","enum":["draft","live","ended"]},"paused":{"type":"boolean"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"endsAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"}},"required":["id","name","phase","paused","startedAt","endsAt"]},"team":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"type":"string","description":"Hex colour, #rrggbb"}},"required":["id","name","color"]},{"type":"null"}]},"serverTime":{"type":"string","format":"date-time","description":"ISO 8601 time"},"scoreVisibility":{"type":"string","enum":["full","own","none"],"description":"The game master's score setting."},"score":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"type":"string","description":"Hex colour, #rrggbb"},"points":{"type":"number"}},"required":["id","name","color","points"]},"description":"Only the teams the score setting shows."},"zones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"ownerTeamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"geometry":{"anyOf":[{"type":"object","properties":{"type":{"type":"string"},"coordinates":{}},"required":["type"]},{"type":"null"}],"description":"GeoJSON geometry (Polygon, or Point with a radius); null for an indoor zone set by hand."}},"required":["id","name","ownerTeamId","geometry"]},"description":"Active zones this side can see."},"units":{"type":"array","items":{"$ref":"#/components/schemas/Entity"},"description":"Live units this side can see."},"lastKnown":{"type":"array","items":{"$ref":"#/components/schemas/Entity"},"description":"Units that went dark, as they were at their last fix."},"markers":{"type":"array","items":{"$ref":"#/components/schemas/Marker"}},"graphics":{"type":"array","items":{"$ref":"#/components/schemas/Graphic"}},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"orderAcks":{"type":"array","items":{"type":"object","properties":{"orderUid":{"type":"string"},"by":{"type":"string"},"time":{"type":"integer","minimum":0}},"required":["orderUid","by","time"]}},"events":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"at":{"type":"string","format":"date-time","description":"ISO 8601 time"},"actor":{"type":["string","null"]},"summary":{"type":["string","null"]}},"required":["type","at","actor","summary"]},"description":"The latest 50 events meant for this side (never chat)."}},"required":["me","game","team","serverTime","scoreVisibility","score","zones","units","lastKnown","markers","graphics","orders","orderAcks","events"],"description":"What the player behind the key sees in the app."}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `device_key_scope`, `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `not_in_game`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`, `no_side`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/play/position":{"post":{"operationId":"postPosition","tags":["Player"],"summary":"Report your position","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"point":{"$ref":"#/components/schemas/GeoPoint"},"speed":{"type":"number","minimum":0},"course":{"type":"number","minimum":0,"maximum":360},"battery":{"type":"number","minimum":0,"maximum":100},"intervalSec":{"type":"number","exclusiveMinimum":0,"maximum":3600},"mock":{"type":"boolean"},"time":{"type":"integer","exclusiveMinimum":0,"description":"Ignored: the server stamps its own time."}},"required":["point"]}}}},"responses":{"202":{"description":"Accepted: published on your own live topic, through the same checks as your phone.","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean","const":true}},"required":["accepted"]}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `not_in_game`, `player_devices_off`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Problem: `unavailable`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/play/status":{"post":{"operationId":"postStatus","tags":["Player"],"summary":"Report your status","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["alive","hit","down","medic","out","respawn"]}},"required":["status"]}}}},"responses":{"202":{"description":"Accepted: published on your own live topic, through the same checks as your phone.","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean","const":true}},"required":["accepted"]}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `not_in_game`, `player_devices_off`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Problem: `unavailable`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/play/sos":{"post":{"operationId":"raiseSos","tags":["Player"],"summary":"Raise an SOS","description":"The same SOS as the app: one active per player, seen by everyone in the game, pushed to every phone.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"point":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["lat","lon"]},"approx":{"type":"boolean","description":"true when the point is a guess; a fresh fix from the phone wins."}},"required":["point"]}}}},"responses":{"201":{"description":"The SOS is up.","content":{"application/json":{"schema":{"type":"object","properties":{"uid":{"type":"string"},"point":{"$ref":"#/components/schemas/GeoPoint"},"time":{"type":"integer","minimum":0}},"required":["uid","point","time"]}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `not_in_game`, `player_devices_off`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"clearSos","tags":["Player"],"summary":"Clear your own SOS","security":[{"apiKey":[]}],"responses":{"200":{"description":"How many of your SOS marks were cleared (0 is fine).","content":{"application/json":{"schema":{"type":"object","properties":{"cleared":{"type":"integer"}},"required":["cleared"]}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `not_in_game`, `player_devices_off`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/play/orders/{uid}/ack":{"post":{"operationId":"ackOrder","tags":["Player"],"summary":"WILCO an order","description":"Only an order sent to you.","security":[{"apiKey":[]}],"parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"204":{"description":"Acknowledged."},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `device_key_scope`, `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `not_in_game`, `player_devices_off`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`, `order_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/play/marks":{"post":{"operationId":"placeMark","tags":["Player"],"summary":"Place or update a mark","description":"The game's marker rule decides who may; the mark belongs to your side.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"uid":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$","description":"Your own id, to update the same mark later. Made for you when left out."},"marker":{"type":"string","enum":["enemy","friendly","objective","hazard","bomb","spot","rally","vehicle","building","box","fob","hq","medevac","waypoint"],"description":"An SOS has its own call."},"point":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["lat","lon"]},"label":{"type":"string","maxLength":120},"note":{"type":"string","maxLength":500},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"deadline":{"type":"integer","exclusiveMinimum":0,"description":"Epoch ms"}},"required":["marker","point"]}}}},"responses":{"201":{"description":"The mark as stored.","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","const":"marker"},"uid":{"type":"string","minLength":1},"marker":{"type":"string","enum":["enemy","friendly","objective","hazard","bomb","spot","rally","vehicle","building","box","fob","hq","medevac","waypoint","sos"]},"point":{"$ref":"#/components/schemas/GeoPoint"},"sender":{"type":"string","minLength":1},"channel":{"type":"string","minLength":1},"teamId":{"type":["string","null"]},"label":{"type":"string","maxLength":120},"note":{"type":"string","maxLength":500},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"sidc":{"type":"string","maxLength":30},"time":{"type":"integer","minimum":0},"stale":{"type":"integer","minimum":0},"deadline":{"type":"integer","minimum":0}},"required":["kind","uid","marker","point","sender","channel","time","stale"]}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `device_key_scope`, `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `marks_not_allowed`, `mfa_required`, `not_in_game`, `not_your_mark`, `player_devices_off`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `key_revoked`, `no_side`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/play/marks/{uid}":{"delete":{"operationId":"removeMark","tags":["Player"],"summary":"Remove your own mark","security":[{"apiKey":[]}],"parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"204":{"description":"Removed (or it was already gone)."},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `device_key_scope`, `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `marks_not_allowed`, `mfa_required`, `not_in_game`, `not_your_mark`, `player_devices_off`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `game_ended`, `key_revoked`, `no_side`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/team":{"get":{"operationId":"getTeam","tags":["Team"],"summary":"One team's commander view","description":"Read-only, own team only. Carries live positions: not cached.","security":[{"apiKey":[]}],"responses":{"200":{"description":"The team view.","content":{"application/json":{"schema":{"type":"object","properties":{"game":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"phase":{"type":"string","enum":["draft","live","ended"]},"paused":{"type":"boolean"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"endsAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"}},"required":["id","name","phase","paused","startedAt","endsAt"]},"team":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"type":"string","description":"Hex colour, #rrggbb"}},"required":["id","name","color"]},{"type":"null"}]},"serverTime":{"type":"string","format":"date-time","description":"ISO 8601 time"},"scoreVisibility":{"type":"string","enum":["full","own","none"],"description":"The game master's score setting."},"score":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"type":"string","description":"Hex colour, #rrggbb"},"points":{"type":"number"}},"required":["id","name","color","points"]},"description":"Only the teams the score setting shows."},"zones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"ownerTeamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"geometry":{"anyOf":[{"type":"object","properties":{"type":{"type":"string"},"coordinates":{}},"required":["type"]},{"type":"null"}],"description":"GeoJSON geometry (Polygon, or Point with a radius); null for an indoor zone set by hand."}},"required":["id","name","ownerTeamId","geometry"]},"description":"Active zones this side can see."},"units":{"type":"array","items":{"$ref":"#/components/schemas/Entity"},"description":"Live units this side can see."},"lastKnown":{"type":"array","items":{"$ref":"#/components/schemas/Entity"},"description":"Units that went dark, as they were at their last fix."},"markers":{"type":"array","items":{"$ref":"#/components/schemas/Marker"}},"graphics":{"type":"array","items":{"$ref":"#/components/schemas/Graphic"}},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"orderAcks":{"type":"array","items":{"type":"object","properties":{"orderUid":{"type":"string"},"by":{"type":"string"},"time":{"type":"integer","minimum":0}},"required":["orderUid","by","time"]}},"events":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"at":{"type":"string","format":"date-time","description":"ISO 8601 time"},"actor":{"type":["string","null"]},"summary":{"type":["string","null"]}},"required":["type","at","actor","summary"]},"description":"The latest 50 events meant for this side (never chat)."}},"required":["game","team","serverTime","scoreVisibility","score","zones","units","lastKnown","markers","graphics","orders","orderAcks","events"],"description":"One team's commander view, read-only."}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/dashboard":{"get":{"operationId":"getDashboard","tags":["Dashboard"],"summary":"The spectator dashboard","description":"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.","security":[{"apiKey":[]}],"responses":{"200":{"description":"The dashboard.","content":{"application/json":{"schema":{"type":"object","properties":{"game":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"paused":{"type":"boolean"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"endsAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"phase":{"type":"string","enum":["draft","live","ended"]},"startsAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"}},"required":["id","name","paused","startedAt","endsAt","phase","startsAt"]},"serverTime":{"type":"string","format":"date-time","description":"ISO 8601 time"},"delayMin":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"null = live; else everything below is this many minutes old (the dashboard delay the game master set)."},"asOf":{"type":"string","format":"date-time","description":"The moment the picture shows: serverTime, or serverTime minus the delay."},"waitingUntil":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"Delayed, and no picture old enough yet: when there will be one. Score, zones and events are empty until then."},"scoreVisible":{"type":"boolean"},"teams":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"type":"string","description":"Hex colour, #rrggbb"},"points":{"type":["number","null"],"description":"null while the score is hidden"}},"required":["id","name","color","points"]}},"zones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"ownerTeamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},"required":["id","name","ownerTeamId"]}},"effects":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["uav","emp"]},"teamId":{"type":"string","format":"uuid","description":"The side that fired it."},"targetTeamIds":{"type":"array","items":{"type":"string","format":"uuid"}},"radiusM":{"type":["number","null"],"description":"null = the whole side. Where the circle is never shows."},"leftSec":{"type":"integer","description":"Seconds left at asOf; frozen while the game is paused."}},"required":["kind","teamId","targetTeamIds","radiusM","leftSec"]},"description":"Running UAVs and EMPs."},"events":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"at":{"type":"string","format":"date-time","description":"ISO 8601 time"},"summary":{"type":["string","null"]}},"required":["type","at","summary"]}},"area":{"anyOf":[{"type":"array","minItems":4,"maxItems":4,"items":[{"type":"number"},{"type":"number"},{"type":"number"},{"type":"number"}]},{"type":"null"}],"description":"[west, south, east, north] of the play area every side may see, to frame a map; null when the game has none."},"positions":{"anyOf":[{"type":"object","properties":{"delayMin":{"type":"integer"},"asOf":{"type":"string","format":"date-time","description":"ISO 8601 time"},"units":{"type":"array","items":{"type":"object","properties":{"callsign":{"type":"string"},"teamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"point":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["lat","lon"]},"at":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["callsign","teamId","point","at"]}}},"required":["delayMin","asOf","units"]},{"type":"null"}],"description":"null unless the game master shows positions, and then only as they were delayMin minutes ago."}},"required":["game","serverTime","delayMin","asOf","waitingUntil","scoreVisible","teams","zones","effects","events","area","positions"],"description":"The spectator view: score, zones, phase, clock and the big events."}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/webhooks":{"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Register a webhook","description":"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.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"description":"https:// on the public internet. Private and reserved addresses are refused."},"events":{"type":"array","items":{"type":"string","pattern":"^[a-z_]{2,40}$"},"minItems":1,"maxItems":40,"description":"Only these event types. Left out: every type the key may see."}},"required":["url"]}}}},"responses":{"201":{"description":"The webhook, with its secret (once).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string"},"events":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"The event types it asked for; null = every type the key may see."},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"},"secret":{"type":"string","description":"whsec_…: signs every delivery. Shown only in this answer."}},"required":["id","url","events","status","disabledReason","createdAt","secret"],"description":"A webhook registered by this key."}}}},"400":{"description":"Problem: `invalid_body`, `url_not_allowed`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`, `webhook_limit`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"This key's webhooks","security":[{"apiKey":[]}],"responses":{"200":{"description":"The webhooks, newest first. Never the secrets.","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string"},"events":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"The event types it asked for; null = every type the key may see."},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","url","events","status","disabledReason","createdAt"],"description":"A webhook registered by this key."}}},"required":["webhooks"]}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/webhooks/{id}":{"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Remove a webhook","description":"Nothing more is sent to it, including retries. Removing twice is fine.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Removed."},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `webhook_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/webhooks/{id}/deliveries":{"get":{"operationId":"listWebhookDeliveries","tags":["Webhooks"],"summary":"The delivery log","description":"The latest 50 deliveries, newest first, with each attempt's outcome. Kept for 14 days.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"lastStatus":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Your server's HTTP status on the last attempt; null when it could not be reached."},"lastError":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"},"deliveredAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"nextAttemptAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"When a pending delivery is tried again."}},"required":["id","eventType","status","attempts","lastStatus","lastError","createdAt","deliveredAt","nextAttemptAt"]}}},"required":["deliveries"]}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `webhook_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/webhooks/{id}/ping":{"post":{"operationId":"pingWebhook","tags":["Webhooks"],"summary":"Send a test delivery","description":"A `ping` event, signed like any other, to check your receiver.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Queued; it shows in the delivery log.","content":{"application/json":{"schema":{"type":"object","properties":{"deliveryId":{"type":"string","format":"uuid"}},"required":["deliveryId"]}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `webhook_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/announce":{"post":{"operationId":"announceDevice","tags":["Devices"],"summary":"Start pairing from the device","description":"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.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"model":{"type":"string","pattern":"^[a-z0-9-]+\\.[a-z0-9.-]+$","maxLength":48,"description":"vendor.model, as in its GT-Link manifest."},"fw":{"type":"string","minLength":1,"maxLength":32}},"required":["kind","model","fw"]}}}},"responses":{"201":{"description":"The codes.","content":{"application/json":{"schema":{"type":"object","properties":{"userCode":{"type":"string","description":"ABCD-EFGH, for the display."},"deviceCode":{"type":"string","description":"Secret: only for polling."},"expiresIn":{"type":"integer"},"interval":{"type":"integer"}},"required":["userCode","deviceCode","expiresIn","interval"]}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/token":{"post":{"operationId":"pollDeviceToken","tags":["Devices"],"summary":"Poll for the device key","description":"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.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceCode":{"type":"string","minLength":20,"maxLength":64}},"required":["deviceCode"]}}}},"responses":{"200":{"description":"Paired: the device id and its own key (once).","content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string"},"key":{"type":"string"}},"required":["deviceId","key"]}}}},"202":{"description":"Not yet: poll again after `interval` seconds.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"pending"},"interval":{"type":"integer"}},"required":["status","interval"]}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `pairing_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"410":{"description":"Problem: `pairing_expired`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/approve":{"post":{"operationId":"approveDevice","tags":["Devices"],"summary":"Type in the code a device shows","description":"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.","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userCode":{"type":"string","minLength":8,"maxLength":12,"description":"The code the device shows, with or without the dash."},"label":{"type":"string","minLength":1,"maxLength":40},"clubId":{"type":"string","format":"uuid","description":"Register it as this club's (you must manage the club); left out, it is yours."}},"required":["userCode","label"]}}}},"responses":{"201":{"description":"The device; it receives its key on its next poll.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt"],"description":"A paired beacon, prop or gateway."}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `pairing_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `device_limit`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"410":{"description":"Problem: `pairing_expired`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`, `too_many_devices`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices":{"post":{"operationId":"registerDevice","tags":["Devices"],"summary":"Register a device through the phone (BLE)","description":"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.","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"model":{"type":"string","pattern":"^[a-z0-9-]+\\.[a-z0-9.-]+$","maxLength":48},"fw":{"type":"string","minLength":1,"maxLength":32},"label":{"type":"string","minLength":1,"maxLength":40},"clubId":{"type":"string","format":"uuid"},"radioKey":{"type":"string","pattern":"^[A-Za-z0-9+/]{22}==$","description":"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."}},"required":["kind","model","fw","label"]}}}},"responses":{"201":{"description":"The device with its key (once).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"},"key":{"type":["string","null"],"description":"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."}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt","key"],"description":"A paired beacon, prop or gateway."}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `device_limit`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `too_many_devices`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"operationId":"listDevices","tags":["Devices"],"summary":"Your devices and your clubs'","description":"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.","security":[{"session":[]}],"responses":{"200":{"description":"The devices.","content":{"application/json":{"schema":{"type":"object","properties":{"devices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt"],"description":"A paired beacon, prop or gateway."}},"loans":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt"],"description":"A paired beacon, prop or gateway."}}},"required":["devices","loans"]}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/{id}/assign":{"post":{"operationId":"assignDevice","tags":["Devices"],"summary":"Use a device in a game","description":"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.","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^dev_[a-z2-9]{12}$","description":"The device id, dev_…"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"playerId":{"type":"string","format":"uuid","description":"Beacons: who carries it. Left out for your own beacon: you."}},"required":["gameId"]}}}},"responses":{"200":{"description":"The device, assigned.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt"],"description":"A paired beacon, prop or gateway."}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `not_in_game`, `not_your_player`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`, `game_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `beacon_limit`, `game_device_limit`, `game_ended`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/{id}/accept":{"post":{"operationId":"acceptDeviceLoan","tags":["Devices"],"summary":"Accept a beacon lent to you","description":"Only the player it is lent to, on their own session. From then on the beacon reports for you in that game.","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^dev_[a-z2-9]{12}$","description":"The device id, dev_…"}}],"responses":{"200":{"description":"The device, now in use by you.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt"],"description":"A paired beacon, prop or gateway."}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/{id}/decline":{"post":{"operationId":"declineDeviceLoan","tags":["Devices"],"summary":"Decline a beacon lent to you","description":"Only the player it is lent to. The loan ends and the beacon goes back to its owner.","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^dev_[a-z2-9]{12}$","description":"The device id, dev_…"}}],"responses":{"200":{"description":"The device, back with its owner.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt"],"description":"A paired beacon, prop or gateway."}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/{id}/return":{"post":{"operationId":"returnDevice","tags":["Devices"],"summary":"Take a device back","description":"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.","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^dev_[a-z2-9]{12}$","description":"The device id, dev_…"}}],"responses":{"200":{"description":"The device, back with its owner.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"dev_…: the opaque id the device uses in its topics."},"kind":{"type":"string","enum":["beacon","prop","gateway"],"description":"A gateway is a LoRa radio that forwards beacons and props to GridTac (from 1.8, BETA)."},"label":{"type":"string"},"model":{"type":["string","null"]},"fw":{"type":["string","null"]},"owner":{"type":"object","properties":{"kind":{"type":"string","enum":["player","club"]},"clubId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"clubName":{"type":["string","null"]}},"required":["kind","clubId","clubName"]},"assignment":{"anyOf":[{"type":"object","properties":{"gameId":{"type":"string","format":"uuid"},"gameName":{"type":"string"},"playerId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"callsign":{"type":["string","null"]},"since":{"type":"string","format":"date-time","description":"ISO 8601 time"},"accepted":{"type":"boolean","description":"False while a loan waits for the player to accept it; the device's key does nothing until then."}},"required":["gameId","gameName","playerId","callsign","since","accepted"]},{"type":"null"}],"description":"Who uses it in which game right now; null when it is with its owner."},"radioAddr":{"type":["string","null"],"description":"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":{"type":"string","enum":["active","revoked"]},"online":{"type":"boolean","description":"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":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Battery percent from the latest telemetry, or null."},"lastSeenAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"}},"required":["id","kind","label","model","fw","owner","assignment","radioAddr","status","online","battery","lastSeenAt","createdAt"],"description":"A paired beacon, prop or gateway."}}}},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/devices/{id}":{"delete":{"operationId":"revokeDevice","tags":["Devices"],"summary":"Unpair a device","description":"Its key stops at once and it leaves any game. Pair it again to use it. Revoking twice is fine.","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^dev_[a-z2-9]{12}$","description":"The device id, dev_…"}}],"responses":{"204":{"description":"Unpaired."},"401":{"description":"Problem: `unauthorized`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/prop/mqtt-credentials":{"post":{"operationId":"propMqttCredentials","tags":["Devices"],"summary":"A prop's MQTT credentials","description":"With its own prop key. A JWT for the broker that lets the prop publish only under gridtac/dev/<its id>/ (hello, evt, state, tele, ack, lwt) and subscribe only to its cmd and game topics. Fetch a new one before expiresAt.","security":[{"apiKey":[]}],"responses":{"200":{"description":"The credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string"},"username":{"type":"string"},"token":{"type":"string","description":"The MQTT password."},"expiresAt":{"type":"integer"},"topics":{"type":"object","properties":{"publish":{"type":"object","additionalProperties":{"type":"string"}},"subscribe":{"type":"object","additionalProperties":{"type":"string"}}},"required":["publish","subscribe"]}},"required":["deviceId","username","token","expiresAt","topics"]}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/gw/mqtt-credentials":{"post":{"operationId":"gatewayMqttCredentials","tags":["Devices"],"summary":"A gateway's MQTT credentials","description":"BETA, from 1.8. With its own gateway key (gt_gw_). A JWT for the broker that lets the gateway publish only gridtac/gw/<its id>/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.","security":[{"apiKey":[]}],"responses":{"200":{"description":"The credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","description":"dev_…: the gateway id in its topics."},"username":{"type":"string"},"token":{"type":"string","description":"The MQTT password."},"expiresAt":{"type":"integer"},"topics":{"type":"object","properties":{"publish":{"type":"object","additionalProperties":{"type":"string"}},"subscribe":{"type":"object","additionalProperties":{"type":"string"}}},"required":["publish","subscribe"]}},"required":["deviceId","username","token","expiresAt","topics"]}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/prop/events":{"post":{"operationId":"propEvents","tags":["Devices"],"summary":"A prop's events over HTTPS","description":"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.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"evts":{"type":"array","items":{"type":"object","properties":{"b":{"type":"integer","minimum":0,"maximum":65535,"description":"Boot counter, stored in flash and incremented on every start."},"s":{"type":"integer","minimum":0,"maximum":4294967295,"description":"Sequence number within this boot, from 0."},"ms":{"type":"integer","minimum":0,"description":"Milliseconds since boot: the device has no trusted clock (ADR 0007 section 5)."},"c":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,16}$","description":"Capability id."},"e":{"type":"string","minLength":1,"maxLength":16,"description":"Event: press, hold, release, set, code, tag, tripped, cleared, moved, still, hit, value."},"x":{"anyOf":[{"type":"number"},{"type":"string","maxLength":64}],"description":"Value: hold ms, switch position, code, tag uid, hit strength, analog value."},"z":{"type":"string","maxLength":16,"description":"Zone of a hit."}},"required":["b","s","ms","c","e"]},"minItems":1,"maxItems":100},"state":{"type":"object","properties":{"b":{"type":"integer","minimum":0,"maximum":65535,"description":"Boot counter, stored in flash and incremented on every start."},"s":{"type":"integer","minimum":0,"maximum":4294967295,"description":"Sequence number within this boot, from 0."},"ms":{"type":"integer","minimum":0,"description":"Milliseconds since boot: the device has no trusted clock (ADR 0007 section 5)."},"st":{"type":"object","properties":{"own":{"anyOf":[{"type":"integer","minimum":0,"maximum":3},{"type":"null"}],"description":"Owner: team slot 0-3, null = neutral."},"pr":{"type":"number","minimum":0,"maximum":1,"description":"Progress 0-1 (a capture in progress)."},"mo":{"type":"string","maxLength":24,"description":"Mode it runs."}}}},"required":["b","s","ms","st"]},"tele":{"type":"object","properties":{"b":{"type":"integer","minimum":0,"maximum":65535,"description":"Boot counter, stored in flash and incremented on every start."},"s":{"type":"integer","minimum":0,"maximum":4294967295,"description":"Sequence number within this boot, from 0."},"ms":{"type":"integer","minimum":0,"description":"Milliseconds since boot: the device has no trusted clock (ADR 0007 section 5)."},"bat":{"type":"object","properties":{"v":{"type":"number"},"pct":{"type":"number","minimum":0,"maximum":100}}},"rssi":{"type":"number"},"snr":{"type":"number"},"gps":{"type":"object","properties":{"la":{"type":"number","minimum":-90,"maximum":90},"lo":{"type":"number","minimum":-180,"maximum":180},"acc":{"type":"number","minimum":0}},"required":["la","lo"]},"up":{"type":"integer","minimum":0}},"required":["b","s","ms"]}},"required":["evts"]}}}},"responses":{"200":{"description":"Taken.","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"integer","minimum":0},"cmds":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":24,"description":"Command id; the device echoes it in its ack."},"k":{"type":"string","const":"config"},"mo":{"type":"string","maxLength":24},"set":{"type":"object","additionalProperties":{},"description":"Mode settings: teams per colour, hold time, volume."}},"required":["id","k"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":24,"description":"Command id; the device echoes it in its ack."},"k":{"type":"string","const":"set"},"c":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,16}$"},"a":{"type":"string","minLength":1,"maxLength":16,"description":"Action of the output kind."},"args":{"type":"object","additionalProperties":{},"description":"Action arguments: colour, pattern, ms, track, lines."}},"required":["id","k","c","a"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":24,"description":"Command id; the device echoes it in its ack."},"k":{"type":"string","const":"mode"},"mo":{"type":"string","minLength":1,"maxLength":24,"description":"The game mode it is about: capture, and later bomb, trigger, score."},"a":{"type":"string","minLength":1,"maxLength":16,"description":"What happened in the mode: owner (who holds the zone), answer (a hold accepted or refused)."},"args":{"type":"object","additionalProperties":{},"description":"owner: {own: slot or null}; answer: {ok, slot, reason?, have?, need?}."}},"required":["id","k","mo","a"],"description":"A game mode tells the device what happened in it; the device picks its own lights and sounds (freeze 4.4)."},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":24,"description":"Command id; the device echoes it in its ack."},"k":{"type":"string","const":"identify"},"ms":{"type":"integer","minimum":0,"maximum":60000,"description":"How long to blink and beep."}},"required":["id","k"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":24,"description":"Command id; the device echoes it in its ack."},"k":{"type":"string","const":"disable"},"on":{"type":"boolean","description":"true = all outputs off and inputs ignored for this game."}},"required":["id","k","on"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":24,"description":"Command id; the device echoes it in its ack."},"k":{"type":"string","const":"update"},"fw":{"type":"string","minLength":1,"maxLength":32,"description":"The firmware version available."},"url":{"type":"string","format":"uri","description":"Where to fetch it, when the device updates itself."}},"required":["id","k","fw"]}]}},"game":{"type":"object","properties":{"v":{"type":"number","const":1},"g":{"anyOf":[{"type":"string","maxLength":48},{"type":"null"}],"description":"Game id; null when not assigned (the device shows \"not in a game\")."},"ph":{"type":"string","enum":["draft","scheduled","live","paused","ended"],"description":"Phase."},"srv":{"type":"integer","description":"Server time, epoch ms."},"sa":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Scheduled kickoff."},"ea":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Scheduled or set ENDEX."},"tm":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":16},"l":{"type":"string","maxLength":40},"ea":{"type":"integer"},"phy":{"type":"boolean"}},"required":["id","l","ea"]},"maxItems":16},"pa":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Paused at, or null."}},"required":["v","g","ph","srv"]}},"required":["accepted","cmds","game"]}}}},"400":{"description":"Problem: `invalid_body`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Problem: `invalid_key`, `key_expired`, `key_required`, `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Problem: `forbidden`, `key_blocked`, `key_owner_lost`, `key_paused`, `mfa_required`, `wrong_key_kind`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Problem: `device_not_found`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Problem: `key_revoked`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Problem: `rate_limited`","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}},"components":{"schemas":{"ApiKey":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["play","team","dash","prop","link","gw"]},"label":{"type":"string"},"prefix":{"type":"string","description":"The public part of the key, e.g. gt_team_ab12cd34. Safe to show."},"gameId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"teamId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"status":{"type":"string","enum":["active","paused","blocked","revoked","expired"]},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"expiresAt":{"anyOf":[{"type":"string","format":"date-time","description":"ISO 8601 time"},{"type":"null"}],"description":"ISO 8601 time"},"pausedUntil":{"type":"string","format":"date-time","description":"Only while the key is paused."},"pausedReason":{"type":["string","null"],"description":"Only while the key is paused."}},"required":["id","kind","label","prefix","gameId","teamId","status","createdAt","lastUsedAt","expiresAt"],"description":"An API key as its owner sees it. Never the secret, except once in the create and rotate answers."},"Entity":{"type":"object","properties":{"uid":{"type":"string","minLength":1},"affiliation":{"type":"string","enum":["friend","hostile","neutral","unknown"]},"callsign":{"type":"string","minLength":1},"team":{"type":"string"},"squad":{"type":"string"},"point":{"$ref":"#/components/schemas/GeoPoint"},"status":{"type":"string","enum":["alive","hit","down","medic","out","respawn"],"default":"alive"},"battery":{"type":"number","minimum":0,"maximum":100},"speed":{"type":"number","minimum":0},"course":{"type":"number","minimum":0,"maximum":360},"src":{"type":"string","const":"beacon"},"time":{"type":"integer","minimum":0},"stale":{"type":"integer","minimum":0}},"required":["uid","affiliation","callsign","point","time","stale"]},"GeoPoint":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"hae":{"type":"number"},"ce":{"type":"number","minimum":0},"le":{"type":"number","minimum":0}},"required":["lat","lon"]},"Graphic":{"type":"object","properties":{"kind":{"type":"string","const":"graphic"},"uid":{"type":"string","minLength":1},"shape":{"type":"string","enum":["line","area","arrow","circle"]},"points":{"type":"array","items":{"$ref":"#/components/schemas/GeoPoint"},"minItems":1,"maxItems":200},"radius":{"type":"number","exclusiveMinimum":0,"maximum":100000},"sender":{"type":"string","minLength":1},"channel":{"type":"string","minLength":1},"teamId":{"type":["string","null"]},"label":{"type":"string","maxLength":120},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"time":{"type":"integer","minimum":0},"stale":{"type":"integer","minimum":0}},"required":["kind","uid","shape","points","sender","channel","time","stale"]},"Marker":{"type":"object","properties":{"kind":{"type":"string","const":"marker"},"uid":{"type":"string","minLength":1},"marker":{"type":"string","enum":["enemy","friendly","objective","hazard","bomb","spot","rally","vehicle","building","box","fob","hq","medevac","waypoint","sos"]},"point":{"$ref":"#/components/schemas/GeoPoint"},"sender":{"type":"string","minLength":1},"channel":{"type":"string","minLength":1},"teamId":{"type":["string","null"]},"label":{"type":"string","maxLength":120},"note":{"type":"string","maxLength":500},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"sidc":{"type":"string","maxLength":30},"svg":{"type":"string","maxLength":20000},"time":{"type":"integer","minimum":0},"stale":{"type":"integer","minimum":0},"deadline":{"type":"integer","minimum":0}},"required":["kind","uid","marker","point","sender","channel","time","stale"]},"Order":{"type":"object","properties":{"kind":{"type":"string","const":"order"},"uid":{"type":"string","minLength":1},"sender":{"type":"string","minLength":1},"channel":{"type":"string","minLength":1},"orderType":{"type":"string","enum":["move","waypoint","hold","rally","attack","recon","support"]},"point":{"$ref":"#/components/schemas/GeoPoint"},"waypoints":{"type":"array","items":{"$ref":"#/components/schemas/GeoPoint"},"maxItems":50},"text":{"type":"string","maxLength":500},"time":{"type":"integer","minimum":0},"stale":{"type":"integer","minimum":0},"deadline":{"type":"integer","minimum":0}},"required":["kind","uid","sender","channel","orderType","time","stale"]},"Problem":{"type":"object","properties":{"type":{"type":"string","format":"uri","description":"A link to this code on the errors page."},"title":{"type":"string","description":"For people; may be reworded."},"status":{"type":"integer"},"detail":{"type":"string","description":"For people; may be reworded."},"code":{"type":"string","description":"Stable machine code: branch on this."},"retryAfterSec":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Seconds until a retry can work (rate limits, pauses)."},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]},"description":"invalid_body only: each problem with the request body."}},"required":["type","title","status","code"],"description":"RFC 9457 problem details, sent as application/problem+json."}},"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Authorization: Bearer gt_<kind>_…"},"session":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"Signed in on gridtac.com."}}}}