Skip to Content
CSGOWINAPI
API v2 Coming soon

Moving from API v1

Where each v1 field is in API v2, and what to change.

Coming soon

API v2 is not open yet - every request to it answers 404 until it launches, and the details on this page may still change. Build on API v1 today - it keeps working. New keys and a one-step switch will arrive with v2.

Every v1 creator read has its v2 read. Per input, field and behaviour: where v2 answers it, and what an integration changes. A v1 field v2 does not send says why.

GET /api/leaderboard/{code} is GET /api/v2/leaderboards/{code} (leaderboard_get).

v1v2What changes
path code{code}Nothing - any code of the creator resolves to their board
header x-apikey-A key is optional: the board is public. A key sent must be the code owner's v2 key
leaderboardsperiodsRead periods
usercreatorRead creator (v1 sent null here)
error-An inactive board is a 404 with error.code leaderboard_inactive
viewerOnCode-The site page's own field, for a signed-in viewer: never sent to a key
leaderboards[].id-Not sent: an internal number, not a name to keep - the board is named by its code
leaderboards[].periodIdperiods[].periodIdNothing
leaderboards[].activeperiods[].statusactive is status === "live"
leaderboards[].affiliate.id-Not sent: an internal number, not a name to keep - the board is named by its code
leaderboards[].affiliate.codecodeRead code, once for the board
leaderboards[].dateStartperiods[].startsAtRead startsAt
leaderboards[].dateEndperiods[].endsAtRead endsAt
leaderboards[].daysperiods[].endsAtfloor((endsAt - startsAt) / 86400000)
leaderboards[].paidperiods[].paidNothing
leaderboards[].prizesperiods[].prizesNothing
leaderboards[].usersperiods[].standingsRead standings - send limit=100 for the whole list (the default is 10)
leaderboards[].entryUser-v1 never sent it to a key: nothing to change
leaderboards[].entryPlace-v1 never sent it to a key: nothing to change
leaderboards[].user.uuid?include creator.uuidcreator.uuid with include=uuid
leaderboards[].user.namecreator.namecreator.name
leaderboards[].user.socials[].typecreator.socials[].typecreator.socials
leaderboards[].user.socials[].urlcreator.socials[].urlcreator.socials
leaderboards[].users[].uuid?include periods[].standings[].uuidAdd include=uuid - null for a hidden player
leaderboards[].users[].rankperiods[].standings[].vipRankRead vipRank (the VIP tier). The position in the period is place
leaderboards[].users[].nameperiods[].standings[].nameNothing
leaderboards[].users[].avatar_selectedperiods[].standings[].avatarRead avatar
leaderboards[].users[].levelperiods[].standings[].levelNothing
leaderboards[].users[].wageredperiods[].standings[].wageredNothing
leaderboards[].users[].prizeperiods[].standings[].prizeNothing
leaderboards[].users[].exchanged?include periods[].standings[].exchangedAdd include=exchanged - v1 sent cents, v2 answers coins (v1 / 100)
leaderboards[].users[].xpBonus?include periods[].standings[].xpBonusAdd include=xpBonus - v1 sent cents, v2 answers coins (v1 / 100)
leaderboards[].users[].hidden-Not sent: a hidden player reads as Anonymous#### with a null avatar, and with include=uuid a null uuid
leaderboards[].users[].roles-Not sent: v1 only ever listed the site's streamer badge here, and v2 sends no badges
Standings per period: all v1 ranks (the top 100, or every place of a longer prize ladder)?limitSend limit=100 (up to 1000 for a longer ladder) - the default is 10
Periods: the live ones, then the latest ended onesperiodsNothing
Refusals: v1 answered 200 with an error text, or 400-v2 answers {"error": {"code", "message"}}: 404 not_found / leaderboard_inactive, 401 for a wrong key
Cache: the standings computed at most every 10 seconds-The same standings, and the answer is cached for 5 seconds on top (Cache-Control: public, max-age=5, stale-while-revalidate=25)
Rate limit: 60 a minute per IP-Nothing: 60 a minute per IP
CORS: the site's origins-Any origin may now read the board, without credentials

GET /api/leaderboard/{code}/raffle is GET /api/v2/leaderboards/{code}/raffles (leaderboard_raffles).

v1v2What changes
path code{code}Nothing
header x-apikey-Send your API v2 key (cgw2_...) in x-apikey: one key reads every code you own. A v1 key is refused (401 legacy_key)
query take?limitSend limit (1 to 20, default 3), as take
rafflesrafflesNothing
error-A code with no board is a 404 with error.code not_found
raffles[].id-Not sent: an internal number, not a name to keep - the board is named by its code
raffles[].periodIdraffles[].periodIdNothing
raffles[].activeraffles[].statusv1 always sent false: status says live or ended
raffles[].affiliate.id-Not sent: an internal number, not a name to keep - the board is named by its code
raffles[].affiliate.code{code}Not repeated per raffle: it is the code in your request
raffles[].dateStartraffles[].startsAtRead startsAt
raffles[].dateEndraffles[].endsAtRead endsAt
raffles[].daysraffles[].endsAtfloor((endsAt - startsAt) / 86400000)
raffles[].paidraffles[].paidNothing
raffles[].prizesraffles[].prizesv1 sent cents, v2 answers coins (v1 / 100)
raffles[].usersraffles[].entriesRead entries
raffles[].users[].tickets.countraffles[].entries[].tickets.countNothing
raffles[].users[].tickets.startraffles[].entries[].tickets.startNothing
raffles[].users[].tickets.endraffles[].entries[].tickets.endNothing
raffles[].users[].xpLeft?include raffles[].entries[].xpLeftAdd include=xpLeft - v1 sent cents, v2 answers coins (v1 / 100)
raffles[].user.uuid?include creator.uuid (leaderboard_get)Not repeated per raffle: the creator is your key's own account. GET /api/v2/leaderboards/{code} answers creator.uuid with include=uuid
raffles[].user.namecreator.name (leaderboard_get)Not repeated per raffle: the creator is your key's own account. GET /api/v2/leaderboards/{code} answers creator.name
raffles[].user.socials[].typecreator.socials[].type (leaderboard_get)Not repeated per raffle: the creator is your key's own account. GET /api/v2/leaderboards/{code} answers creator.socials
raffles[].user.socials[].urlcreator.socials[].url (leaderboard_get)Not repeated per raffle: the creator is your key's own account. GET /api/v2/leaderboards/{code} answers creator.socials
raffles[].users[].uuid?include raffles[].entries[].uuidAdd include=uuid - null for a hidden player
raffles[].users[].rankraffles[].entries[].vipRankRead vipRank (the VIP tier). The position in the period is place
raffles[].users[].nameraffles[].entries[].nameNothing
raffles[].users[].avatar_selectedraffles[].entries[].avatarRead avatar
raffles[].users[].levelraffles[].entries[].levelNothing
raffles[].users[].wageredraffles[].entries[].wageredv1 sent cents, v2 answers coins (v1 / 100)
raffles[].users[].prizeraffles[].entries[].prizev1 sent cents, v2 answers coins (v1 / 100)
raffles[].users[].exchanged?include raffles[].entries[].exchangedAdd include=exchanged - v1 sent cents, v2 answers coins (v1 / 100)
raffles[].users[].xpBonus?include raffles[].entries[].xpBonusAdd include=xpBonus - v1 sent cents, v2 answers coins (v1 / 100)
raffles[].users[].hidden-Not sent: a hidden player reads as Anonymous#### with a null avatar, and with include=uuid a null uuid
raffles[].users[].roles-Not sent: v1 only ever listed the site's streamer badge here, and v2 sends no badges
A signed-in owner's own raffles without a key-The site page's own mode: v2 reads a key, never a cookie
Refusals: v1 answered 400 with an error text-v2 answers {"error": {"code", "message"}}: 401 missing_key / invalid_key, 404 not_found
Rate limit: 60 a minute per IP-And 60 a minute per account across its keyed reads

GET /api/affiliate/external is GET /api/v2/affiliates/{code}/referrals (affiliate_referrals).

v1v2What changes
header x-apikey-Send your API v2 key (cgw2_...) in x-apikey: one key reads every code you own. A v1 key is refused (401 legacy_key). No opt-in per code is needed
query code{code}The code is in the path: /api/v2/affiliates/{code}/referrals
query gt?fromSend from as an ISO 8601 time, not milliseconds
query lt?toSend to as an ISO 8601 time - alone it starts at the beginning, as lt
query take?limitSend limit=50000 for the whole table (the default is 50). For the count alone (take=0), send limit=1 and read total
query skip?cursorRows N..M (counting from 1): send limit=M (a bulk read when M is over 100) and keep rows N..M, or page from the first page with cursor
query search?searchNothing (at most 64 characters)
query sort?orderSend order (asc or desc)
query by?sortSend sort: createdAt is joinedAt, wager is wagered, deposited and name as they were
query currency?currencyNothing
success-A 200 is a success: v2 answers errors with their status
datareferralsRead referrals
counttotalRead total
take?limitThe limit sent
currencycurrencyNothing
error-v2 answers {"error": {"code", "message"}} with the status
data[].id-Not sent: an internal number that could change between reads - uuid names the referral
data[].uuidreferrals[].uuidFor a hidden referral, an id stable for this code that is not the account's (v1 sends the account id). Every other referral's uuid is the same
data[].namereferrals[].namev1 left the field out for a nameless account, v2 sends ""
data[].avatar_selectedreferrals[].avatarRead avatar: null where v1 left the field out
data[].levelreferrals[].levelNothing
data[].createdAtreferrals[].joinedAtRead joinedAt
data[].status-v1 always sent "active": the referral is listed
data[].activereferrals[].activeNothing
data[].wageredreferrals[].wageredNothing
data[].depositedreferrals[].depositedNothing
data[].commissionreferrals[].commissionNothing
A window of any length?fromOver 366 days it is a bulk read
Rate limit: one call a minute per key, up to 50,000 rows?limitA bulk read (limit over 100, or a window over 366 days) once a minute per account - pages of 100 at 60 a minute
The same figures for the same window-Nothing: v1 and v2 answer the same figures
A code whose figures are still being prepared-v1 answered at once. v2 answers 409 stats_not_ready while they are prepared (minutes): try again. Switching to v2 and each new key start preparing every code you own

Get your key - If you do not switch