> ## 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.

# Quickstart

> Get a key, make a first call with curl and with Python.

**1. Get a key**

Sign up at [www.granuleux.com/login](https://www.granuleux.com/login). The dashboard issues a free
key. It is shown once: store it in a secret manager or an environment variable.

```bash theme={null}
export CS2API_KEY="cs2_live_..."
```

**2. Check the API is up**

`GET /v1/health` needs no key and returns the number of matches and games loaded.

```bash theme={null}
curl https://api.granuleux.com/v1/health
```

**3. First call with curl**

```bash theme={null}
curl -H "Authorization: Bearer $CS2API_KEY" \
  "https://api.granuleux.com/v1/matches?map=mirage&limit=5"

# kills of round 5 of map 1 of match 2398724, as CSV
curl -H "Authorization: Bearer $CS2API_KEY" \
  "https://api.granuleux.com/v1/games/2398724:1/kills?round=5&format=csv"
```

**4. First call with Python**

```python theme={null}
import os, requests

API = "https://api.granuleux.com"
H = {"Authorization": f"Bearer {os.environ['CS2API_KEY']}"}

# page through every match on Mirage
params, matches = {"map": "mirage", "limit": 200}, []
while True:
    r = requests.get(f"{API}/v1/matches", headers=H, params=params)
    r.raise_for_status()
    body = r.json()
    matches += body["data"]
    if not body["meta"]["next_cursor"]:
        break
    params["cursor"] = body["meta"]["next_cursor"]

# one game (map), its rounds, and the player state of round 5
game = requests.get(f"{API}/v1/games/2398724:1", headers=H).json()["data"]
rounds = requests.get(f"{API}/v1/games/2398724:1/rounds", headers=H).json()["data"]
states = requests.get(f"{API}/v1/games/2398724:1/states", headers=H, params={"round": 5}).json()["data"]
s = states[0]
print(s["steamid"], s["x"], s["y"], s["yaw"], s["hp"])   # steamid is a string

# tick-level parquet: signed links valid 15 minutes
files = requests.get(f"{API}/v1/games/2398724:1/files", headers=H).json()["data"]
```

> [!NOTE]
>
> `https://api.granuleux.com` is a placeholder for the production base URL.

## Next

* Every response is `{"data": ..., "meta": ...}`. Lists page with `cursor`; see [Pagination](https://cs2-data-api.mintlify.site/concepts/pagination.md).
* A game id is `match_id*10 + map_no` or `"match_id:map_no"`; see [IDs](https://cs2-data-api.mintlify.site/concepts/ids.md).
* `/states` costs 5 units and `/files` 10; see [Rate limits](https://cs2-data-api.mintlify.site/concepts/rate-limits.md).


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