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.
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.
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.
ApiKeyAuthx-apikey<token>Your unique API key. Pass it in the x-apikey request header.
code*stringYour affiliate code.
gt?integerStart of the date range as milliseconds since the Unix epoch (UTC), for example 1672531200000. Defaults to 0.
int64lt?integerEnd of the date range as milliseconds since the Unix epoch (UTC). Defaults to the current time.
int64by?stringField to sort results by. Accepted values: createdAt, deposited, name, wager.
"wager""createdAt""deposited""name""wager"sort?stringSort direction.
"desc""asc""desc"search?stringFilter results by username (partial match).
take?integerMaximum number of results to return, 50000 at most (also the default). count in the response is the total, so read further pages with skip.
0 <= value <= 5000050000skip?integerNumber of records to skip for pagination.
0 <= value0currency?stringThe 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.
"COINS""COINS""USD""EUR""GBP"Successful response with affiliate data.
application/json- response
success*booleanWhether the request was successful.
data*array<>count*integerTotal number of records matching the query (before pagination).
take*integerThe take value that was applied.
currency?Present only when currency was USD, EUR or GBP, what the amounts were converted to.
curl "https://api.csgowin.com/api/affiliate/external?code=YOUR_CODE&take=1000" \ -H "x-apikey: YOUR_API_KEY"{ "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
| Status | When | Body |
|---|---|---|
| 400 | A 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"} |
| 401 | Unauthorized. 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"} |
| 429 | Rate limit exceeded. | {"error":"too many requests for code YOUR_CODE"} |
| 500 | Internal server error. | |
| 503 | The site has no rate for the asked currency right now. Retry after Retry-After seconds, or ask in coins. |