> For the complete documentation index, see [llms.txt](https://docs.omgapi.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.omgapi.cc/en/game-apis/transfer-wallet/get-user-game-token.md).

# Get User Game Token

## Authorize

> This API is provided by the OMG platform and is called by the integrator.

<mark style="color:green;">`POST`</mark>  `{OMG_API_URL}/api/player/v1/authorize?trace_id=your_trace_id`

{% hint style="info" %}
`{OMG_API_URL}` is the OMG API domain, which can be obtained from the backend.
{% endhint %}

### **Headers**

<table><thead><tr><th width="263">Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Content-Type</code></td><td>"application/json; charset=utf-8"</td></tr><tr><td><code>sign</code></td><td>"your_sign_string"</td></tr></tbody></table>

{% hint style="info" %}
Please refer to the [**Signature Algorithm and Example**](/en/quick-start/quickstart.md#signature-algorithm-and-example) page for details on the signature algorithm.
{% endhint %}

### **Body**

<table><thead><tr><th width="172">Name</th><th width="211">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>The unique identifier for the merchant, available in the merchant backend.</td></tr><tr><td><code>uname</code></td><td>string</td><td>User ID must be unique</td></tr><tr><td><code>nickname</code></td><td>string</td><td> User's Nickname</td></tr><tr><td><code>timestamp</code></td><td>integer</td><td>Timestamp (in seconds)</td></tr><tr><td><code>cid</code></td><td>integer <code>optional</code></td><td>Currency ID. Required for multi-currency merchants and can be found in the multi-currency backend under the "API Access" section to view available currency IDs. For single-currency merchants, simply pass </td></tr></tbody></table>

### Integrator Request Parameter Example &#x20;

```json
{
    "app_id":"10013",
    "nickname": "Bill",
    "uname": "10032355",
    "cid":0
}
```

### OMG Platform Response Parameter Example

{% tabs %}
{% tab title="Success" %}

```json
{
    "code": 0,
    "msg": "ok",
    "data": {
        "token": "1003803",
        "balance": "42766.25",
        "app_id":10013
    }
}
```

{% endtab %}

{% tab title="Failed" %}

```json
{
    "code": 10002,
    "msg": "sign invalid"
}
```

{% endtab %}
{% endtabs %}

### Response Example Parameter Descriptions

<table><thead><tr><th width="135">Name</th><th width="122">Required</th><th width="159">Type</th><th>Description</th></tr></thead><tbody><tr><td>code</td><td>Yes</td><td>integer</td><td>Status Code</td></tr><tr><td>msg</td><td>Yes</td><td>string</td><td>Message</td></tr><tr><td>data</td><td>Yes</td><td>object</td><td>Response Data</td></tr><tr><td>token</td><td>Yes</td><td>string</td><td><a data-footnote-ref href="#user-content-fn-1">User Token In OMG Game</a></td></tr><tr><td>balance</td><td>Yes</td><td>string (decimal)</td><td>User Balance, supports up to 4 decimal places.</td></tr><tr><td>app_id</td><td>Yes</td><td>string</td><td>T<a data-footnote-ref href="#user-content-fn-2">he app_id of the merchant to which the player belongs</a></td></tr></tbody></table>

### Error Code

{% hint style="info" %}
For more error codes, please refer to the [**General Error Codes**](/en/quick-start/general-error-code.md) page description.
{% endhint %}

[^1]: All subsequent operations on this player's data must include this token, such as querying the player's balance, depositing funds, etc.

[^2]: If the `app_id` in the request parameters belongs to a multi-currency merchant, the response will return the `app_id` of the sub-merchant with a matching `cid` under the multi-currency merchant. Otherwise, it will return the value of the `app_id` from the request parameters.
