Metadata-Version: 2.4
Name: valorant-esports-api
Version: 1.0.0
Summary: Official Valorant esports API client for live VCT scores, WebSocket rooms, historical matches, per-map player stats, rankings, teams, events, and sample CSVs. Standard library only.
Author: Cito API
License-Expression: MIT
Project-URL: Homepage, https://valorant-api.org/
Project-URL: Documentation, https://citoapi.com/docs/api/valorant/live/
Project-URL: Source, https://github.com/Cito-GG/valorant-esports-api
Project-URL: Issues, https://github.com/Cito-GG/valorant-esports-api/issues
Project-URL: Get a free API key, https://citoapi.com/signup?game=valorant&utm_source=npm-pypi&utm_medium=referral&utm_campaign=valorant-esports-api
Keywords: valorant,valorant-api,valorant-esports,vct,live-valorant-api,historical-valorant-api,websocket,esports
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# valorant-esports-api (Python)

[![PyPI](https://img.shields.io/pypi/v/valorant-esports-api)](https://pypi.org/project/valorant-esports-api/) [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

Official Python client for the **Valorant esports API** at [valorant-api.org](https://valorant-api.org/) and [citoapi.com/valorant/](https://citoapi.com/valorant/). Zero runtime dependencies (Python 3.8+ standard library only).

Use one client as both a **live Valorant API** and a **historical Valorant API** across `71,596` matches, `6,081` teams, `43,029` players, and `3,099` events (VCT 2021-2026, Challengers, and Ascension):

- Live match scores, schedules, results, and match detail (`veto`, `streams`, `games`)
- Per-map game telemetry: round timelines, economy conversions, ACS, K/D/A, ADR, KAST, HS%, and FK/FD
- Teams, active rosters, coaching staff, and regional rankings
- Player profiles (`career_summary` and `agents` stats) and match logs
- Events/tournaments and roster transfers
- **VCT WebSocket** URL and `"rooms"` subscription payload builders (`wss://api.citoapi.com/api/v1/valorant/live/ws`)
- Public sample CSV downloads (`matches.csv` and `players.csv`, no API key required)

> **Get a free API key** (500 requests/month, no card): **[Sign up for Valorant API](https://citoapi.com/signup?game=valorant&utm_source=npm-pypi&utm_medium=referral&utm_campaign=valorant-esports-api)**

## Install

```bash
pip install valorant-esports-api
```

## Quickstart

```python
import json
from valorant_esports_api import ValorantApi

api = ValorantApi()  # reads CITO_API_KEY from environment

# 1. Live Valorant matches
live = api.live()
for m in live["matches"]:
    t = m["teams"]
    s = m["score"]
    print(f"{t['team1_name']} {s['team1']}-{s['team2']} {t['team2_name']} ({m['event_name']})")

# 2. Historical Valorant matches with filters
history = api.matches(
    status="Completed",
    date_from="2026-01-01",
    date_to="2026-03-01",
    limit=25,
)
first_match = history["matches"][0]
games = api.match_games(first_match["id"])

# 3. Player career summary and per-agent stats
player = api.player("tenz")
print(player["career_summary"])
print(player["agents"][:3])

# 4. Regional team rankings and transfers
emea_rankings = api.rankings(region="europe", limit=10)
recent_transfers = api.transfers(limit=20)
```

## Public Sample CSVs (No API Key Required)

```python
matches_csv = api.sample_matches_csv()
players_csv = api.sample_players_csv()
print(matches_csv.splitlines()[:5])
```

Direct URLs:

- `https://api.citoapi.com/api/v1/exports/sample/valorant/matches.csv`
- `https://api.citoapi.com/api/v1/exports/sample/valorant/players.csv`

## Live VCT WebSocket Helper

The **VCT WebSocket** endpoint is `wss://api.citoapi.com/api/v1/valorant/live/ws` (available on Pro + `$15/mo` Live WebSockets add-on, Scale, and Business CSV). Authenticate via the `X-API-Key` header for servers/bots, or `?api_key=<key>` for browser sources.

```python
import json

ws_url = api.ws_url()  # or api.ws_url("your_key") for ?api_key=... query auth
subscribe_msg = api.ws_subscribe_payload(["all"])  # {"action": "subscribe", "rooms": ["all"]}
match_msg = api.ws_subscribe_payload(["match:val-match-12345"])

print(ws_url)
print(json.dumps(subscribe_msg))
print(json.dumps(match_msg))
```

Note: Subscribe messages use the `"rooms"` key (`{"action": "subscribe", "rooms": ["all"]}`). Metering is `0` requests per pushed event, `1` request on upgrade + `1` request per `15s` open.

## Methods

All methods return the unwrapped `data` object by default; pass `raw=True` to `api.get(path, params, raw=True)` for the full `{success, data, meta}` envelope.

| Area | Methods |
|---|---|
| Overview | `overview()` |
| Matches | `live(...)`, `upcoming(...)`, `results(...)`, `matches(status=..., event_id=..., team_id=..., date_from=..., date_to=..., limit=..., offset=...)`, `match(match_id)`, `match_games(match_id)` |
| Teams | `teams(...)`, `team(team_id)`, `team_matches(team_id, ...)` |
| Players | `players(...)`, `player(player_id)`, `player_matches(player_id, ...)` |
| Events | `events(...)`, `event(event_id)`, `event_matches(event_id, ...)` |
| Rankings & Transfers | `rankings(region=..., date=..., limit=...)`, `transfers(...)` |
| Sample CSVs | `sample_matches_csv()`, `sample_players_csv()` |
| WebSocket | `ws_url(api_key=None)`, `ws_subscribe_payload(rooms=None)` |
| Escape hatch | `get(path, params=None, raw=False)` |

Errors raise `ValorantApiError` with `.status`, `.code`, and `.body`.

## Pricing & Tiers

- **Free** (`$0/mo`, `500` reqs/mo) & **Starter** (`$15/mo`, `10,000` reqs/mo): REST with `60s` live delay, full historical access.
- **Pro** (`$59/mo`, `250,000` reqs/mo): `0s` live REST + optional `+$15/mo` Live WebSockets add-on (unlocks `/live/ws` and `/live/stream`).
- **Scale** (`$100/mo`, `1,000,000` reqs/mo): `0s` live REST + WebSocket & SSE included.
- **Business CSV** (`$299/mo`, `3,000,000` reqs/mo): `0s` live REST + WebSocket & SSE included + full historical CSV exports.

## Links

- Live Valorant API Docs: https://citoapi.com/docs/api/valorant/live/
- Live WebSocket Docs: https://citoapi.com/docs/api/valorant/live/websocket/
- Historical Valorant API Docs: https://citoapi.com/docs/api/valorant/historical/
- Historical CSV Dataset: https://valorant-api.org/historical-csv-dataset/
- Pricing: https://citoapi.com/pricing/
- GitHub Monorepo: https://github.com/Cito-GG/valorant-esports-api

MIT licensed.
