> ## Documentation Index
> Fetch the complete documentation index at: https://cs2-data-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Player state

> Data dictionary for GET /v1/games/{game}/states.

`GET /v1/games/{game}/states` returns one row per player per sample, sampled every 32 ticks from freeze end to
round end, plus the round end tick. It costs 5 units.

| Parameter | Meaning |
| - | - |
| `round` | Round number. Either `round`, or both `tick_from` and `tick_to`, is required |
| `tick_from`, `tick_to` | Inclusive tick range, at most 15,360 ticks (240 s), or `413` |
| `player_id` | Only this player (Steam64 string) |
| `fields` | Comma-separated subset of the columns below. `round_no`, `tick` and `steamid` are always included |
| `format` | `json` (default) or `csv` |

Rows are ordered by `tick`, then `steamid`. A game without player state (`has_state: false`) returns `404`.

```bash theme={null}
curl -H "Authorization: Bearer $CS2API_KEY" \
  "https://api.granuleux.com/v1/games/2398724:1/states?round=5&fields=side,alive,x,y,yaw,hp,weapon"
```

## Columns

Positions are in Hammer world units of the map. Angles are
in degrees.

| Column | Type | Unit | Meaning |
| - | - | - | - |
| `round_no` | integer | | Round number (`round` in the `fields` parameter) |
| `tick` | integer | tick | Sample tick (64 per second) |
| `t_round` | number | s | Seconds since freeze end |
| `steamid` | string | | Player's Steam64 id |
| `name` | string | | In-game player name |
| `side` | string | | `CT` or `T` |
| `alive` | boolean | | Alive and hp above 0 |
| `x`, `y`, `z` | number | units | World position. `z` is height |
| `vx`, `vy` | number | units/s | Horizontal velocity, computed from the change in `x` / `y` since the player's previous sample in the round. `null` on the player's first sample of each round. An average over 0.5 s, not the instantaneous velocity (the `ticks` file has `velocity_X/Y/Z`) |
| `pitch` | number | degrees | Vertical view angle. Source engine convention: negative looks up, positive looks down, range about -89 to 89 |
| `yaw` | number | degrees | Horizontal view angle, -180 to 180. 0 faces +x, 90 faces +y (counter-clockwise seen from above) |
| `hp` | integer | | Health, 0 to 100 |
| `armor` | integer | | Armor, 0 to 100 |
| `helmet` | boolean | | Has a helmet |
| `kit` | boolean | | Has a defuse kit (CT only) |
| `weapon` | string | | Active (held) weapon, display name, e.g. `AK-47`, `USP-S`, `M9 Bayonet` |
| `inventory` | string | | Every item carried, display names joined by a pipe character (example below the table) |
| `cash` | integer | \$ | Money in the bank |
| `equip` | integer | \$ | Value of the equipment the player carries now |
| `flash` | number | s | The game's flash duration for the player: the length of the flash currently blinding them, 0 when not flashed. See the note below |
| `scoped` | boolean | | Scoped in |
| `defusing` | boolean | | Defusing the bomb |
| `walking` | boolean | | Walking (holding the walk key) |
| `ducking` | boolean | | Crouching |
| `airborne` | boolean | | Off the ground |
| `in_bomb_zone` | boolean | | Inside a bomb site's plant zone |
| `spotted` | boolean | | The game's own spotted flag (the one that shows players on the radar) |
| `spotted_by` | integer | count | Number of players in the game's `approximate_spotted_by` list for this player (players who see them). 0 when not spotted |
| `place` | string | | Map callout from the map's navigation mesh, e.g. `BombsiteA`, `CTSpawn`, `Middle` |
| `clip` | integer | rounds | Ammo in the current magazine |
| `ammo` | integer | rounds | Reserve ammo for the active weapon |

Example `inventory`: `M9 Bayonet|Smoke Grenade|USP-S`. Split on `|`.

> [!NOTE]
>
> **`flash` is not a countdown.** In the data it holds a constant value (for example 1.85) for the whole time it is
> non-zero, then drops to 0; it does not decrease sample by sample. Treat `flash > 0` as "currently flashed" and the
> value as the total length of that flash. Its exact reset behaviour (for example on death) has not been verified.

## Things to know

* **Dead players keep appearing** with `alive: false` and `hp: 0`. Ignore their other columns.
* **Coaches** can appear: they occupy a team slot but are never alive. Drop any player who is never
  `alive` in the round, or keep only players in the game's `roster` (`GET /v1/games/{game}`).
* **Missing values are filled**: `hp`, `armor`, `clip`, `ammo`, `cash` and `equip` are 0, and the booleans are
  `false`, when the game did not record them. Older games may not carry `clip`.
* `weapon` and `inventory` use display names (`AK-47`), while `weapon` in kills and damage uses engine names
  (`ak47`).
* `spotted` and `spotted_by` are the game's own approximate visibility flags, not a computed line of sight.

## Every tick

The same signals, plus key presses (`FORWARD`, `FIRE`, `JUMP`, ...), 3D velocity, `duck_amount`, `zoom_lvl`,
`shots_fired`, `flash_max_alpha`, `in_buy_zone` and per-player running totals, are in the `ticks` parquet file at every
tick. See [Files](https://cs2-data-api.mintlify.site/data/files.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.