Host a giveaway from your balance
API v2 - coming soon.
Coming soon
Hosts a community giveaway as the site's Giveaways page does: the prize is paid from your real balance at once and counts against the key's daily limit. The site's own rules apply (a prize of at least 10 coins and 1 per winner, 1 to 50 winners, entries closing 1 minute to 31 days from now) and its refusals answer 400 with its text (an insufficient balance, a block). affiliateOnly limits entries to players referred by the code in the path. In the example, replace YOUR_END_TIME with the time entries close, written as endsAt is in the answer. 10 a day.
Rate limits: 5 actions a minute per account (429 rate_limited), this action’s count per UTC day (429 action_limit_reached, Retry-After to 00:00 UTC), and 120 actions a minute across the site (503 unavailable with Retry-After).
partnerKeyx-apikey<token>Your API v2 key (cgw2_...)
code*stringThe affiliate code (letter case ignored)
1 <= length <= 191Idempotency-Key*stringA new value per action (a UUID): a resend with the same value answers the first answer and does nothing again
^[A-Za-z0-9_-]{8,64}$application/json- body
prize*numberThe prize, paid from your real balance at once: at least 10 and 1 per winner, in coins with at most two decimals
10 <= value <= 10000000winners*integer1 <= value <= 50endsAt*stringWhen entries close: 1 minute to 31 days from now (ISO 8601, UTC)
date-timename*stringShown on the giveaway
^[\w\s\-.,!?@#$%&*()+=:;^'"/\\|<>[\]{}~`]*$1 <= length <= 64minLevel?integerThe level an entrant needs
0 <= value <= 1000minDeposit?numberWhat an entrant must have deposited in the timeframe, in coins with at most two decimals
0.01 <= value <= 10000000minWager?numberWhat an entrant must have wagered in the timeframe, in coins with at most two decimals
0.01 <= value <= 10000000timeframeDays?integerThe days minDeposit and minWager count over
1 <= value <= 365affiliateOnly?booleanOnly players referred by the code in the path may enter
Done: what it made
application/json- response
giveawayId*integerprize*numberThe prize, in coins with two decimals
winners*integerendsAt*stringWhen entries close (ISO 8601, UTC)
date-timeurl*stringThe giveaway's page
actionId*integerThis action, as support finds it (also the X-Request-Id header)
spentToday*numberWhat actions spent today (UTC) against the daily limit, this one included, in coins with two decimals
dailyLimit*numberThe daily limit in force, in coins with two decimals
curl -X POST "https://api.csgowin.com/api/v2/creators/YOUR_CODE/giveaways" \ -H "x-apikey: YOUR_V2_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"prize":50,"winners":2,"endsAt":"YOUR_END_TIME","name":"Stream giveaway","minLevel":5}'{ "giveawayId": 42, "prize": 50, "winners": 2, "endsAt": "2030-11-16T20:00:00.000Z", "url": "https://csgowin.com/giveaways?id=42", "actionId": 1201, "spentToday": 50, "dailyLimit": 100}Errors
| Status | When | Body |
|---|---|---|
| 400 | bad_request: an input outside its rules, a cookie sent, or a refusal by the site (the message says which). | {"error":{"code":"bad_request","message":"send an Idempotency-Key header: 8 to 64 letters, digits, - or _ (a new UUID per action)"}} |
| 401 | missing_key: no key in the x-apikey header. legacy_key: a v1 key - switch to API v2 for a v2 key. invalid_key: not a live API v2 key, or the code is not one of its account’s codes. | {"error":{"code":"missing_key","message":"send your API v2 key in the x-apikey header"}}{"error":{"code":"legacy_key","message":"this is a v1 key: switch to API v2 in Profile > Affiliates > API key to get a v2 key"}}{"error":{"code":"invalid_key","message":"the key is not a live API v2 key of this code"}} |
| 403 | key_blocked: API v2 is blocked for the account - contact support (a new key does not lift it). account_restricted: the account is restricted - contact support. actions_not_enabled: "Let tools act for me" is not ticked for this key. second_factor_required: the account has no two-factor authentication. staff_account: a staff account never acts through a key. | {"error":{"code":"key_blocked","message":"this key is blocked: contact support"}}{"error":{"code":"account_restricted","message":"this account is restricted: contact support"}}{"error":{"code":"actions_not_enabled","message":"this key may not act: tick \"Let tools act for me\" in Profile > Affiliates > API key"}}{"error":{"code":"second_factor_required","message":"set up two-factor authentication on your account to let tools act for you"}}{"error":{"code":"staff_account","message":"a staff account never acts through a key"}} |
| 404 | not_found: no such giveaway, case or period, or the code has no board or giveaways (also every request while API v2 is not open, and every action while actions are not open). | {"error":{"code":"not_found","message":"not found"}} |
| 409 | idempotency_in_progress: the action with this Idempotency-Key is still running. outcome_unknown: the action with this Idempotency-Key has an unknown outcome - do not resend, contact support. | {"error":{"code":"idempotency_in_progress","message":"the action with this Idempotency-Key is still running"}}{"error":{"code":"outcome_unknown","message":"the action with this Idempotency-Key ended in an unexpected error: contact support with its request id, do not resend"}} |
| 422 | idempotency_mismatch: this Idempotency-Key came with another request - use a new one. | {"error":{"code":"idempotency_mismatch","message":"this Idempotency-Key was sent with another request: use a new Idempotency-Key"}} |
| 429 | rate_limited: past a rate limit - wait the Retry-After seconds. daily_limit_reached: the giveaway’s prize would pass the daily limit - Retry-After counts down to 00:00 UTC. action_limit_reached: this action’s count for today is used up - Retry-After counts down to 00:00 UTC. | {"error":{"code":"rate_limited","message":"more than 5 actions a minute for this account"}}{"error":{"code":"daily_limit_reached","message":"the daily limit of 100 coins would be passed (80 spent today) - it resets at 2030-11-17T00:00:00.000Z"}}{"error":{"code":"action_limit_reached","message":"this action's count for today is used up - it resets at 2030-11-17T00:00:00.000Z"}} |
| 500 | internal: the action’s outcome is unknown - do not resend, contact support with the X-Request-Id. | {"error":{"code":"internal","message":"the outcome of this action is unknown: contact support with its request id, do not resend"}} |
| 503 | unavailable: not available for a moment and nothing was done - try again after the Retry-After seconds. | {"error":{"code":"unavailable","message":"actions are paused for a moment, try again in a minute"}} |
The giveaways a creator hosts GET
The giveaways the code's owner hosts, live (open or being drawn, ending soonest first) or ended (drawn or cancelled, the latest first): the prize, when entries close, the entries, the requirements and, once drawn, the winners, as the site shows them to everyone. The same answer for every caller, so a stream overlay may poll it from any origin without a key. It is cached for 5 seconds and secondsLeft is counted from serverTime. A code whose owner hides their account answers 404, as the site names a hidden account as the host of nothing. Rate limits: 60 reads a minute per IP across /api/v2 and at most 25 to one path in 2 seconds (429 with Retry-After).
One giveaway GET
One giveaway by its id, as its share link shows it to everyone: for an overlay that follows one giveaway to its winners. Takes no key. Rate limits: 60 reads a minute per IP across /api/v2 and at most 25 to one path in 2 seconds (429 with Retry-After).