# Booster Codes API

The Booster Codes API feature enables the automatic distribution of booster codes through API requests.

### Getting Started

To use this feature, please follow the steps below:&#x20;

1. Create a Tournament game with Booster Codes enabled.&#x20;
2. Navigate to the Tournament Details page, open the Published Links tab, and find **Game ID** (you will need it later to enable automatic distribution of booster codes through API requests).&#x20;

<figure><img src="https://4030329530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTP9pFZ2vkhu9r1UmFiPi%2Fuploads%2FHVv7gGeZjSEkhnnCMpIZ%2Fbooster-codes-api-img1.png?alt=media&#x26;token=422e792a-2c53-4492-99ac-3da446502e8d" alt=""><figcaption></figcaption></figure>

3. Then, open the Integration tab and click the Setup button in the Booster Codes API section.

<figure><img src="https://4030329530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTP9pFZ2vkhu9r1UmFiPi%2Fuploads%2FNQy6PCSKbeFKOwYHxbNr%2Fbooster-codes-api-img2.png?alt=media&#x26;token=29f7c7ef-b776-4822-b813-5d6cd3ca2886" alt=""><figcaption></figcaption></figure>

4. Copy the **secret key\*** provided in the popup, and use the detailed instructions in our Help Center.

<figure><img src="https://4030329530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTP9pFZ2vkhu9r1UmFiPi%2Fuploads%2F1FAak1QIZyqvPrU2mtrb%2Fbooster-codes-api-img3.png?alt=media&#x26;token=f020ea1c-ddce-4b13-a7ed-94db022798f6" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
\*Please note that the secret key automatically updates when a game is published or republished. You can also manually reset the secret key at any time. Once reset, a new secret key will be generated and assigned to the game, making the previous key invalid.
{% endhint %}

## Developer Guide

#### API host

{% embed url="<https://discounter-mania-api.com/api>" %}

### Retrieve Game Secret Key

Returns the current game secret key for external integrations.

```cpp
GET {apiHost}/Games/{gameId}/secret-key
```

```cpp
HTTP 200 - Returns the decrypted secret key { data: “secret-key-goes-here” }
HTTP 404 - Game not found
HTTP 403 - User does not have access to this brand, or the brand creation is not completed
HTTP 400 (inner code 1083) - Game secret key error
HTTP 400 (inner code 1048) - Payment plan restriction
```

### Set New Game Secret Key

A new secret key is generated and assigned to the game, and an old key becomes invalid.

```
PUT {apiHost}/Games/{gameId}/secret-key
```

```cpp
HTTP 200 - Returns the decrypted secret key { data: “secret-key-goes-here” }
HTTP 404 - Game not found
HTTP 403 - User does not have access to this brand, or the brand creation is not completed
HTTP 400 (inner code 1083) - Game secret key error
HTTP 400 (inner code 1048) - Payment plan restriction
```

### Requests for external integration

#### Check the number of boosters left

This request is recommended to make sure that there are available boosters in the tournament.&#x20;

If no boosters are left, it will be impossible to claim a booster code.

```cpp
GET {apiHost}/tournamentGames/external/{gameId}/boosters/amount
```

Parameters:

**gameId** (string) — Game ID

Headers:

**X-Api-Key** (string) — Game secret key, used for authorization (can be retrieved from the Game details in the Games Admin Panel)

Responses:

```cpp
HTTP 200  { amount: number }
HTTP 400  { status: “1078”, message: “Game is not active” }
HTTP 403  { status: “1082”, message: “Invalid Secret Key” }
HTTP 404  { status: “1044”, message: “Game not found” }
HTTP 500 - Internal Server Error (General server error, retry later)
HTTP 400 (inner code 1048) - Payment plan restriction
```

#### Claim booster

It is used to receive a booster code.&#x20;

This booster code should be passed to the user in any appropriate way:&#x20;

* sent by email,&#x20;
* printed on a receipt, etc. &#x20;

```cpp
PUT {apiHost}/tournamentGames/external/{gameId}/boosters/claim
```

Body:  empty object or null

Parameters: **gameId** (string) — Game ID

Headers: **X-Api-Key** (string) — Game secret key, used for authorization (can be retrieved from the Game details in the Games Admin Panel)

Responses:

**HTTP 200  { code: string, boostMultiplier: number }**

* **code** - a code string, that should be used to play tournament game.
* **boostMultiplier** - a multiplier that will be applied to the player’s points after the game played with a booster.

```cpp
HTTP 400  { status: “1078”, message: “Game is not active” }
HTTP 400  { status: “1079”, message: “No promo codes left” }
HTTP 403  { status: “1082”, message: “Invalid Secret Key” }
HTTP 404  { status: “1044”, message: “Game not found” }
HTTP 500 - Internal Server Error (General server error, retry later)
HTTP 400 (inner code 1048) - Payment plan restriction
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.winday.co/api/booster-codes-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
