> For the complete documentation index, see [llms.txt](https://ton-play-1.gitbook.io/ton-play-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ton-play-1.gitbook.io/ton-play-1/digital-assets-api/users-api.md).

# Users API

## Public API

{% hint style="success" %}
**API Key** is required for all Public API requests&#x20;
{% endhint %}

The user data might be cashed and differ from the real-time data. It updates every 5 minutes.

## Get a user by TON Play identifier

<mark style="color:blue;">`GET`</mark> `https://external.api.tonplay.io/x/auth/v1/user/{identifier}`

#### Path Parameters

| Name       | Type   | Description                                                                    |
| ---------- | ------ | ------------------------------------------------------------------------------ |
| identifier | String | Unique user identifier on TON Play. You can get it from JWT (name object: sub) |

#### Headers

| Name                                             | Type   | Description |
| ------------------------------------------------ | ------ | ----------- |
| X-Auth-Tonplay<mark style="color:red;">\*</mark> | String | API Key     |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "username": "username",
    "identifier": "identifier",
    "created": 1667549600000,
    "avatar": "https://t.me/i/userpic/320/jQO92DKy2fCO48G2zT0PNIt6yuUSUvaO8bY_ud5xkYA.jpg",
    "bio": null,
    "wallet": {
        "address": "TON wallet address",
        "balance": 1000.1
    },
    "telegram": "telegramUsername",
    "telegramId": 1234567890
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```json
{
    "timestamp": "2022-12-12T05:18:31.484+00:00",
    "path": "/x/auth/v1/whoami",
    "status": 404,
    "error": "Not Found",
    "message": null,
    "requestId": "fbfb2337-1108539"
}
```

{% endtab %}
{% endtabs %}

## Get all users by TON Play identifiers

<mark style="color:blue;">`GET`</mark> `https://external.api.tonplay.io/x/auth/v1/user/?identifiers=`

#### Query Parameters

| Name        | Type      | Description                |
| ----------- | --------- | -------------------------- |
| identifiers | \[String] | List of users identifiers. |

#### Headers

| Name                                             | Type   | Description |
| ------------------------------------------------ | ------ | ----------- |
| X-Auth-Tonplay<mark style="color:red;">\*</mark> | String | API Key     |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "username": "user",
        "identifier": "identifier_1",
        "created": 1667549600000,
        "avatar": "https://t.me/i/userpic/320/jQO92DKy2fCO48G2zT0PNIt6yuUSUvaO8bY_ud5xkYA.jpg",
        "bio": null,
        "wallet": null
    },
    {
        "username": "user_2",
        "identifier": "identifier_2",
        "created": 1667549600000,
        "avatar": "https://t.me/i/userpic/320/jQO92DKy2fCO48G2zT0PNIt6yuUSUvaO8bY_ud5xkYA.jpg",
        "bio": null,
        "wallet": null
    }
]
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```json
{
    "timestamp": "2022-12-12T05:18:31.484+00:00",
    "path": "/x/auth/v1/whoami",
    "status": 404,
    "error": "Not Found",
    "message": null,
    "requestId": "fbfb2337-1108539"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
    "timestamp": "2022-12-12T06:43:26.035+00:00",
    "path": "/x/auth/v1/user/",
    "status": 400,
    "error": "Bad Request",
    "requestId": "01c89207-1122172"
}
```

{% endtab %}
{% endtabs %}
