Skip to main content

cs2-api: Counter-Strike 2 API client for JavaScript and Python

npm PyPI license

This is the official client for the CS2 API at cs2-api.org. It covers:

  • live Counter-Strike 2 match scores and round-level scoreboards
  • match results, schedules and streams
  • player stats (rating, ADR, KAST, K/D) and leaderboards
  • teams, rosters and head-to-head
  • the world ranking and Valve Regional Standings (VRS)
  • events, standings and brackets
  • transfers
  • CS2 skin prices across 25+ marketplaces, with price history

It has zero dependencies. The JavaScript client ships TypeScript types and works as ESM or CommonJS; the Python client needs only the standard library.

You need a free API key (500 requests/month, no card): Get your key

Install

npm install cs2-api
pip install cs2-api-client

JavaScript / TypeScript

import { CS2Api } from "cs2-api";            // or: const { CS2Api } = require("cs2-api")

const cs2 = new CS2Api();                     // reads process.env.CITO_API_KEY

const live = await cs2.live();                // every match being played right now
for (const m of live) {
  console.log(`${m.team1Name} ${m.team1Score}-${m.team2Score} ${m.team2Name} · ${m.currentMap}`);
}

const ranking = await cs2.worldRanking({ limit: 10 });
const vitality = await cs2.team("vitality");  // roster + recent results
const donk = await cs2.player("donk");
const prices = await cs2.skinPrices("ak-47-redline-field-tested-1ab1a2dc");

Python

from cs2_api import CS2Api

cs2 = CS2Api()  # reads CITO_API_KEY

for m in cs2.live():
    print(f"{m['team1Name']} {m['team1Score']}-{m['team2Score']} {m['team2Name']} · {m['currentMap']}")

ranking = cs2.world_ranking(limit=10)
vitality = cs2.team("vitality")
donk = cs2.player("donk")
prices = cs2.skin_prices("ak-47-redline-field-tested-1ab1a2dc")

Methods

JavaScript uses camelCase and Python uses snake_case (worldRanking / world_ranking). Teams, players and events accept an id or a slug (vitality, donk).

Area Methods
Live live(), liveScoreboard(matchId): sides, round, player K/D/ADR
Matches upcoming(), results(), today(), match(id), matchMaps(id), matchPlayerStats(id), matchStreams(id)
Teams team(slug), teamMatches(slug), teamStats(slug), teamMapStats(slug), headToHead(a, b)
Players player(slug), searchPlayers(q), playerStats(slug), playerMatches(slug)
Events events({ status }), event(slug), eventMatches(slug), eventStandings(slug), eventBracket(slug)
Rankings & stats worldRanking(), vrsRanking(), leaderboard(metric), transfers(), search(q)
Skins searchSkins(q), skin(slug), skinPrices(slug), skinHistory(slug), trendingSkins()
Anything else get(path, query, { raw }): any of the 140+ endpoints, with meta for pagination when raw: true

Errors throw CS2ApiError (JS) or raise CS2ApiError (Python), with status and the API's message.

Use cases

Keep your key safe

Keep it in an environment variable or .env (git-ignored). Call the API from your server, never from browser code. If a key leaks, revoke it in your dashboard and create a new one.

Not affiliated with Valve, HLTV, ESL, BLAST or PGL. MIT licensed.

Release files for cs2-api-client 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cs2-api-client 1.0.0
File Size Uploaded
cs2_api_client-1.0.0.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cs2-api-client 1.0.0
File Interpreter ABI Platform
cs2_api_client-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / cs2_api_client-1.0.0.tar.gz

Download URL cs2_api_client-1.0.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bfa6b11dba4587d5ee94d137ad69b94b6ae23c93bcaf57eb5ec5d4ca43e2c041
BLAKE2b-256 checksum
How to use checksums
495cad5b5562ffbeaa34be45ed374a5cef493d648e472251b2fd2f900980f758
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / cs2_api_client-1.0.0-py3-none-any.whl

Download URL cs2_api_client-1.0.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72fadd74f7d3a26b0970768cfe5af12b9fa5eb402f18373d66332b3679c8cd21
BLAKE2b-256 checksum
How to use checksums
c322a16571c1becc6a40fb14aeaecf660862a6524ff262287890e2679ffbcaa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page