Skip to Content
CSGOWINAPI
API v1 (legacy)Referral stats

Your referral stats

API v1 (legacy).

API v1 (legacy)

This endpoint keeps working and nothing expires. New integrations should use API v2 once it opens - it is coming soon. Its counterpart there is the v2 referrals read.

What you keep if you do not switch

Opt-in: switched on per affiliate code

This endpoint is opt-in per affiliate code. It is off until CSGOWIN switches it on for your code - having an API key does not switch it on. To ask for it, open Live Support on csgowin.com and give your affiliate code.

Until it is on, every call with your key answers 401:

{ "error": "External API not enabled for this affiliate, check https://docs.csgowin.com on how to use the leaderboard endpoint /leaderboard/YOUR_CODE" }

Your leaderboard and your raffles need no opt-in.

GET
/affiliate/external

Retrieves affiliate referral data for a given code, with optional date range filtering, sorting, searching, and pagination.

Opt-in per affiliate code: this endpoint is off until CSGOWIN switches it on for your code - having an API key does not switch it on. To ask for it, open Live Support on csgowin.com and give your affiliate code. Until then every call answers 401 External API not enabled for this affiliate.

Authorization

ApiKeyAuth
headerx-apikey<token>

Your unique API key. Pass it in the x-apikey request header.

Query Parameters

code*string

Your affiliate code.

gt?integer

Start of the date range as milliseconds since the Unix epoch (UTC), for example 1672531200000. Defaults to 0.

Formatint64
lt?integer

End of the date range as milliseconds since the Unix epoch (UTC). Defaults to the current time.

Formatint64
by?string

Field to sort results by. Accepted values: createdAt, deposited, name, wager.

Default"wager"
Value in"createdAt""deposited""name""wager"
sort?string

Sort direction.

Default"desc"
Value in"asc""desc"
search?string

Filter results by username (partial match).

take?integer

Maximum number of results to return, 50000 at most (also the default). count in the response is the total, so read further pages with skip.

Range0 <= value <= 50000
Default50000
skip?integer

Number of records to skip for pagination.

Range0 <= value
Default0
currency?string

The currency of the amounts (deposited, wagered, commission): COINS, the default and the answer as it always was, or USD, EUR or GBP, converted at the rate the site shows and rounded to two decimals as the site writes them. The answer then also carries currency. Anything else is a 400.

Default"COINS"
Value in"COINS""USD""EUR""GBP"

Response Body

Successful response with affiliate data.

application/json
  1. response
success*boolean

Whether the request was successful.

data*array<>
count*integer

Total number of records matching the query (before pagination).

take*integer

The take value that was applied.

currency?

Present only when currency was USD, EUR or GBP, what the amounts were converted to.

Example Request
curl "https://api.csgowin.com/api/affiliate/external?code=YOUR_CODE&take=1000" \  -H "x-apikey: YOUR_API_KEY"
Example Response
{  "success": true,  "count": 42,  "take": 1000,  "data": [    {      "id": 123,      "commission": 0.5,      "createdAt": "2023-01-15T08:30:00.000Z",      "deposited": 10,      "level": 5,      "name": "example_player_one",      "status": "active",      "avatar_selected": "https://example.invalid/avatars/1.webp",      "uuid": "example-player-id",      "wagered": 25    }  ]}

Errors

StatusWhenBody
400A parameter the API cannot use: a gt or lt that is not a time in milliseconds, a by outside the list, by=deposited on a code it is not available for yet, or a currency outside the list.{"error":"invalid gt or lt, send a unix time in milliseconds"}{"error":"invalid by parameter, try createdAt, deposited, name or wager"}{"error":"by=deposited is not available for this code yet, try createdAt, name or wager"}{"error":"unknown currency, send one of COINS, USD, EUR, GBP"}
401Unauthorized. External API not enabled for this affiliate: the key is right, but this endpoint is opt-in per affiliate code and not switched on for this code yet - open Live Support on csgowin.com and give your affiliate code. Other reasons: missing or invalid API key, missing code parameter, or affiliate not found (a wrong key and an unknown code answer the same).{"error":"affiliate not found"}{"error":"External API not enabled for this affiliate, check https://docs.csgowin.com on how to use the leaderboard endpoint /leaderboard/YOUR_CODE"}
429Rate limit exceeded.{"error":"too many requests for code YOUR_CODE"}
500Internal server error.
503The site has no rate for the asked currency right now. Retry after Retry-After seconds, or ask in coins.