> For the complete documentation index, see [llms.txt](https://docs.miniton.games/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.miniton.games/developer-success/miniton-gaming-sdk/initialize-and-load-your-game.md).

# Initialize and load your game

### Integrate your JS URL

Place the following code inside the `<head></head>` of the page where SDK integration is needed.

```javascript
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<script src="https://h5.miniton.games/sdk/js/miniton_2.0.js"></script>
```

### **Initialize your game in MiniTon**

After integrating the SDK, the first step is to call the init function. This function returns data related to the match.&#x20;

The SDK object can be accessed via `MINITONSDK`, `window.MINITONSDK`, or `window['MINITONSDK']`

```javascript
<initData> MINITONSDK.init(game_id);
```

**Parameters: `game_id`**

| Property | Type    | Description |
| -------- | ------- | ----------- |
| game\_id | Integer | The game ID |

**Return Value: `initData`**

<table><thead><tr><th width="188">Property</th><th width="106">Type</th><th width="199">Signature Verification</th><th>Description</th></tr></thead><tbody><tr><td>game_id</td><td>Integer</td><td>Y</td><td>ID of the game.</td></tr><tr><td>game_name</td><td>String</td><td>Y</td><td>Game Name</td></tr><tr><td>match_id</td><td>Integer</td><td>Y</td><td>Match ID</td></tr><tr><td>match_token</td><td>String</td><td>Y</td><td>Token associated with the ongoing match</td></tr><tr><td>user_ticket</td><td>String</td><td>Y</td><td>Ticket identifying the user.</td></tr><tr><td>first_experience</td><td>Integer</td><td>Y</td><td>Indicates if it is the player’s first experience (0 = No, 1 = Yes). If the value is 1, a tutorial should be displayed.</td></tr><tr><td>taste</td><td>Integer</td><td>Y</td><td>Indicates if it is a trial play (0 = No, 1 = Yes)</td></tr><tr><td>auth_date</td><td>Integer</td><td>Y</td><td>Data Verification Timestamp</td></tr><tr><td>auth_sign</td><td>String</td><td>N</td><td>Data Verification Signature</td></tr><tr><td>language</td><td>String</td><td>N</td><td><p>These are abbreviations used to identify languages. Each abbreviation represents a specific language, such as:</p><ul><li>en: English</li><li>zh: Chinese</li><li>ja: Japanese</li><li>ko: Korean</li><li>ar: Arabic</li><li>ru: Russian</li><li>id: Indonesian</li><li>th: Thai</li><li>es: Spanish</li><li>fr: French</li></ul></td></tr><tr><td>user</td><td><em><strong>UserInfo</strong></em></td><td>N</td><td>User information including user ID, nickname, avatar URL, region, region code, and region icon URL.</td></tr><tr><td>status</td><td>Integer</td><td>N</td><td><p>Status </p><ul><li>0=failed</li><li>1=match ready</li><li>2=match ended</li></ul></td></tr><tr><td>error_msg</td><td>String</td><td>N</td><td>Error message (if any).</td></tr><tr><td>return_url</td><td>String</td><td>N</td><td>URL to return to MiniTon page after the game ends.</td></tr></tbody></table>

***UserInfo***

| Property     | Type    | Description                             |
| ------------ | ------- | --------------------------------------- |
| uid          | Integer | User's Telegram ID                      |
| nickname     | String  | Nick name                               |
| avatar       | String  | User Avatar URL                         |
| region       | String  | Region Name                             |
| region\_code | String  | Region Code (ISO Alpha2 code), e.g., RU |
| region\_icon | String  | Region Icon URL                         |

#### Response  Example

#### **`initData`**

```json
{
    "game_id": 1,
    "game_name": "",
    "match_id": 1,
    "match_token": "",
    "user_ticket": "",
    "first_experience": 0,
    "taste": 0,
    "auth_date": 1704816000,
    "auth_sign": "",
    "user": 
        "uid": 1,
        "nickname": "",
        "avatar": "",
        "region": "",
        "region_code": "",
        "region_icon": ""
    },
    "status": 1,
    "error_msg": "",
    "return_url": ""
}
```

### Set Progress Bar Value

During the loading of game resources, this function should be called multiple times to control the progress bar display on the main game page. When the num value reaches 100, the progress bar will no longer accept changes.

```javascript
MINITONSDK.setProgressValue(num);
```

**Parameters: `num`**

<table><thead><tr><th>Property</th><th width="124">Tyep</th><th>Description</th></tr></thead><tbody><tr><td>num</td><td>Integer</td><td>Progress value (range: 0 &#x3C;= num &#x3C;= 100)</td></tr></tbody></table>
