---
title: Player view
section: API
order: 4
---

# Player view

What you see in the GridTac app, for your own device or script: your own unit and status, your
team on the map, the markers, drawings and orders you can see, the zones your side can see, the
score as far as the game master shows it, and the events meant for your team.

```http
GET /api/v1/play
Authorization: Bearer gt_play_…
```

Needs a **player key** (`gt_play_`) that you create yourself for a game you play in
([Authentication](authentication.md)). It is bound to you in that one game.

## Response

The same shape as the [team view](team.md), plus who you are:

```json
{
  "me": {
    "playerId": "…",
    "callsign": "HAWK",
    "role": "soldier",
    "platoon": "1st",
    "squad": "Alpha",
    "unit": { "callsign": "HAWK", "point": { "lat": 55.6, "lon": 13.0, "ce": 5 }, "status": "alive" }
  },
  "game": { "…": "…" },
  "team": { "id": "…", "name": "Blue", "color": "#6E9BD1" },
  "units": [],
  "markers": [],
  "orders": [],
  "zones": [],
  "score": [],
  "events": []
}
```

`me.unit` is your own latest position and status as the server holds it (`null` before your first
report).

## The same view as your app, never more

The orders, markers and chat channels you see depend on your squad, platoon and role, exactly as in
the app: a squad leader sees their squad's traffic, a platoon leader their platoon's. **A game
master who also plays gets their side's view through a player key, not the game master's view of
everything**: there is no key that sees the whole game.

Chat is not part of the API in this version.

## Freshness

Not cached. A player key may read 60 times a minute ([rate limits](authentication.md#rate-limits)).

## Writing: your position and status

A beacon or a script can report for you, through exactly the same path as your phone: the same
checks on who you are, on order, and on whether a position is believable before it counts for a
zone or a respawn.

A beacon's own key (a paired device) does what a beacon does: position, status and SOS. It does not
read this view, place marks or acknowledge orders (`device_key_scope`), so whoever holds the key of a
beacon you carry cannot see your side's map. A beacon a club lends you reports for you only once you
accept the loan ([Devices](devices.md)).

```http
POST /api/v1/play/position
Authorization: Bearer gt_play_…
Content-Type: application/json

{ "point": { "lat": 55.6012, "lon": 13.0034, "hae": 21, "ce": 6 }, "speed": 1.2, "course": 85, "battery": 77 }
```

```http
POST /api/v1/play/status
Authorization: Bearer gt_play_…
Content-Type: application/json

{ "status": "hit" }
```

| Field | Meaning |
|---|---|
| `point.lat`, `point.lon` | Position in WGS84 degrees. |
| `point.ce` | Horizontal accuracy in metres (the circle the true position is in). Be honest: a fix worse than the game's limit does not count for zones. |
| `point.hae` | Height in metres, optional. |
| `speed`, `course`, `battery` | Optional: m/s, degrees, percent. |
| `status` | `alive`, `hit`, `down`, `medic`, `out` or `respawn`, the same choices as the app. |

Both answer `202 Accepted`: the report is on its way into the game. The server stamps the time.
Budgets: position 30 a minute (one every 2 seconds), status 10 a minute.

The game master can turn off player devices for a game (game settings, Map permissions, "Player devices": Phones only); writes then answer `player_devices_off`
(reading still works). Use one position source at a time: your phone or your beacon, not both.

## Writing: SOS

A beacon can raise an SOS for you. It is the same SOS as the app's red button: everyone in the
game gets the alert and the map marker, whatever side they are on, and a push wakes their phones.

```http
POST /api/v1/play/sos
Authorization: Bearer gt_play_…
Content-Type: application/json

{ "point": { "lat": 55.6012, "lon": 13.0034 }, "approx": false }
```

Answers `201 Created` with the marker's `uid`, `point` and `time`.

- `approx`: set it when your fix is weak (worse than about 100 m). The marker then tells the helpers
  to search wider.
- **The server checks the point.** If it holds a fix of you from the last two minutes that is far
  from the point you send, the SOS is placed at the server's fix. An SOS cannot be dropped anywhere
  on the map.
- **One SOS per player.** A new one replaces your previous one.
- An SOS works before the game goes live, as in the app; only an ended game refuses it.

The player clears their own SOS when help has arrived or it was a mistake:

```http
DELETE /api/v1/play/sos
Authorization: Bearer gt_play_…
```

Answers `{ "cleared": 1 }` (how many were cleared; `0` if there was none). The game master can
clear anyone's SOS in the app.

Budget: 6 SOS calls a minute, shared by all of a player's keys and beacons. If the game master has turned off player devices, the key's SOS is
refused with `player_devices_off`: the phone's own SOS button always works.

## Writing: WILCO

Acknowledge an order, the same as tapping WILCO in the app:

```http
POST /api/v1/play/orders/{uid}/ack
Authorization: Bearer gt_play_…
```

`uid` is the order's `uid` from [`GET /api/v1/play`](#response). Answers `204 No Content` once the
acknowledgement is recorded; the leader who gave the order sees it at once. A player key acknowledges
as the player it belongs to, never as a game master, so only orders sent to that player can be
acknowledged. Any other `uid` answers `order_not_found`, whether the order exists on another side or
not at all. Budget: 60 a minute.

## Writing: marks

Put a mark on your side's map, the same as placing one in the app.

```http
POST /api/v1/play/marks
Authorization: Bearer gt_play_…
Content-Type: application/json

{ "marker": "enemy", "point": { "lat": 55.6012, "lon": 13.0034 }, "label": "MG nest", "note": "two players, facing north" }
```

| Field | Meaning |
|---|---|
| `marker` | The kind: `enemy`, `friendly`, `objective`, `hazard`, `bomb`, `spot`, `rally`, `vehicle`, `building`, `box`, `fob`, `hq`, `medevac` or `waypoint`. |
| `point` | Where, in WGS84 degrees. |
| `label`, `note` | Optional: a short name (120 characters) and a longer note (500). |
| `color` | Optional: `#rrggbb`. |
| `deadline` | Optional: a countdown target in epoch milliseconds; your side gets a push. |
| `uid` | Optional: your own id for the mark (letters, digits, `-` and `_`, up to 64). Send the same `uid` again to move or change your mark. Left out, the server makes one. |

Answers `201 Created` with the mark as your side sees it.

- **The game's marker rule decides.** The game master chooses who may place marks: the commander,
  the leaders, or everyone. A player who may not gets `marks_not_allowed`. A game master who also
  plays places marks as their player, not as the game master.
- **Your side only.** The mark is on your side's map, never the other side's. You cannot choose
  another side, and the sender is always you.
- **Only your own.** You cannot change or remove someone else's mark (`not_your_mark`).
- An SOS is not a mark: use [`POST /api/v1/play/sos`](#writing-sos).

Remove your own mark:

```http
DELETE /api/v1/play/marks/{uid}
Authorization: Bearer gt_play_…
```

Answers `204 No Content`. Budget: 20 mark calls a minute.
