> 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/assets-api.md).

# Assets API

## Open API

{% hint style="warning" %}
Open API **with** API Key will automatically add your assets on TON Play and allow you to use **Public API methods.**
{% endhint %}

Check out how to create a correct metadata URL here: [Metadata](/ton-play-1/digital-assets-api/metadata.md)&#x20;

Make sure that you use **valid** links and **correct** JSON files.

When you get the transaction link, please sign it in Tonkeeper or TonHub. Otherwise, your collection and assets will not be deployed.&#x20;

Check the transactions at [**https://ton.cx**](https://ton.cx)

## Deploy single asset (NFT Item/SFT Minter)

<mark style="color:green;">`POST`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/deploy/single`

You can create an item on the blockchain

#### Query Parameters

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| type<mark style="color:red;">\*</mark> | String | NFT/SFT     |

#### Request Body

| Name                                       | Type   | Description                         |
| ------------------------------------------ | ------ | ----------------------------------- |
| owner<mark style="color:red;">\*</mark>    | String | NFT/SFT  owner's TON Wallet Address |
| metadata<mark style="color:red;">\*</mark> | String | Item's metadata URL                 |

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

```javascript
{
  "owner": "ton wallet address",
  "metadata": "Confirmation link in Tonkeeper"
}
```

{% endtab %}
{% endtabs %}

## Deploy Collection

<mark style="color:green;">`POST`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/deploy/collection`

You can create your Collection with items

#### Query Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| type | String | NFT / SFT   |

#### Request Body

| Name                                                    | Type   | Description                                   |
| ------------------------------------------------------- | ------ | --------------------------------------------- |
| owner<mark style="color:red;">\*</mark>                 | String | NFT/SFT Collection owner's TON Wallet Address |
| collectionMetadataUrl<mark style="color:red;">\*</mark> | String | Collection metadata URL                       |
| itemMetadataCommonUrl<mark style="color:red;">\*</mark> | String | Main part of assets metadata URL              |
| royalty<mark style="color:red;">\*</mark>               | String | n% of royalty (secondary market)              |
| numerator<mark style="color:red;">\*</mark>             | uint16 | if n = 5%, so it will be 50                   |
| denominator<mark style="color:red;">\*</mark>           | uint16 | if n = 5%, so it will be 1000                 |
| beneficiaryAddress<mark style="color:red;">\*</mark>    | String | TOTON Wallet Address to get royalty           |

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

```javascript
{
    "address": "Address of the recipient",
    "url": "Confirmation link in Tonkeeper"
}
```

{% endtab %}
{% endtabs %}

## Mint NFT or SFT Minter &#x20;

<mark style="color:green;">`POST`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/mint/collection/{address}`

You can mint NFT or SFT to Collection

#### Path Parameters

| Name                                      | Type   | Description        |
| ----------------------------------------- | ------ | ------------------ |
| address<mark style="color:red;">\*</mark> | String | Collection Address |

#### Query Parameters

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| type<mark style="color:red;">\*</mark> | String | NFT/SFT     |

#### Request Body

| Name                                                    | Type   | Description                        |
| ------------------------------------------------------- | ------ | ---------------------------------- |
| owner<mark style="color:red;">\*</mark>                 | String | NFT/SFT owner's TON Wallet Address |
| itemMetadataPartOfUrl<mark style="color:red;">\*</mark> | String | Second part of your metadata URL   |
| amount<mark style="color:red;">\*</mark>                | ulong  | Amount of assets (only 1)          |

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

```javascript
{
    "address": "asset address", 
    "url": "Confirmation link in Tonkeeper"
}
```

{% endtab %}
{% endtabs %}

## Mint SFT from SFT Minter

<mark style="color:green;">`POST`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/mint/sft/{SFTMinterAddress}`

You can mint semi-fungible tokens to SFT Minter.&#x20;

#### Path Parameters

| Name                                               | Type   | Description        |
| -------------------------------------------------- | ------ | ------------------ |
| SFTMinterAddress<mark style="color:red;">\*</mark> | String | SFT Minter Address |

#### Request Body

| Name                                     | Type   | Description                    |
| ---------------------------------------- | ------ | ------------------------------ |
| owner<mark style="color:red;">\*</mark>  | String | SFT owner's TON Wallet Address |
| amount<mark style="color:red;">\*</mark> | String | Amount SFT                     |

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

```javascript
"Confirmation link in Tonkeeper"
```

{% endtab %}
{% endtabs %}

## Token transfer

<mark style="color:green;">`POST`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/transfer/{address}`

You can transfer assets (NFT items / SFT wallet).

#### Path Parameters

| Name                                      | Type   | Description                              |
| ----------------------------------------- | ------ | ---------------------------------------- |
| address<mark style="color:red;">\*</mark> | String | NFT Asset's Address / SFT Minter Address |

#### Request Body

| Name                                       | Type   | Description                                              |
| ------------------------------------------ | ------ | -------------------------------------------------------- |
| newOwner<mark style="color:red;">\*</mark> | String | NFT/SFT owner's TON Wallet Address                       |
| amount<mark style="color:red;">\*</mark>   | ulong  | Assets' amount, you want to send (for NFT item always 1) |
| currentOwnerAddress                        | String | current owner (required for SFT)                         |
| type<mark style="color:red;">\*</mark>     | String | NFT/SFT                                                  |

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

```javascript
"Confirmation link in Tonkeeper"
```

{% endtab %}
{% endtabs %}

## Burn selected asset

<mark style="color:red;">`DELETE`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/burn/{assetAddress}`

#### Path Parameters

| Name                                           | Type   | Description     |
| ---------------------------------------------- | ------ | --------------- |
| assetAddress<mark style="color:red;">\*</mark> | String | Asset's Address |

#### Request Body

| Name                                     | Type   | Description       |
| ---------------------------------------- | ------ | ----------------- |
| amount<mark style="color:red;">\*</mark> | String | Amount (for SFT)  |
| type                                     | String | SFT or NFT        |
| ownerAddress                             | String | SFT owner address |

## Get information about any contract

<mark style="color:blue;">`GET`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/{address}/status`

It could be a user wallet, an asset, or a collection

#### Path Parameters

| Name                                      | Type             | Description |
| ----------------------------------------- | ---------------- | ----------- |
| address<mark style="color:red;">\*</mark> | contract address |             |

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

```javascript
{
  "status": "string",
  "balance": 0,
  "address": "string",
  "addressRaw": "string",
  "code": "string",
  "data": "string"
}
```

{% endtab %}
{% endtabs %}

## Get asset's owner (NFT only)

<mark style="color:blue;">`GET`</mark> `https://external.api.tonplay.io/x/tondata/v1/ton/{address}/owner`

#### Path Parameters

| Name                                      | Type            | Description |
| ----------------------------------------- | --------------- | ----------- |
| address<mark style="color:red;">\*</mark> | asset's address |             |

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

```javascript
User wallet address
```

{% endtab %}
{% endtabs %}

## Public API

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

## Get all assets related to the game

<mark style="color:blue;">`GET`</mark> `https://external.api.tonplay.io/x/tondata/v1/assets/game`

#### Headers

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

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

```json
{
    "content": [
        {
            "address": "EQBqcs_XlfOiCw65Plasor53RWb7VcsPZ55BF4K0edOG1Udw",
            "name": "Membership Card",
            "description": "Membership card gives various bonuses during resource extraction in the Escape from Zeya. Membership cards were given only to the most active members of the community.",
            "image": "https://assets.tonplay.io/idximg/1/1.png",
            "quantity": null,
            "supply": 1,
            "index": 2,
            "type": "NFT",
            "collection": {
                "address": "EQBLAcMnTcyx-_mWQtrVEC1eyDfK2nHI-A54P5eL7y-uE2Ht",
                "name": "Membership Cards | Escape from Zeya",
                "description": "NFT membership cards give various bonuses during resource extraction in the Escape from Zeya. Membership cards were given only to the most active members of the community.",
                "image": "https://storage.googleapis.com/zeya-assets-storage-bucket-18e9bbb/MembershipCards/nft_collection_membership_avatar.png",
                "owner": "EQBAXUIEg5ioFiNCUcMQ_lomlpPN5NVNy2iq3baUrnjZxnab",
                "ownerProfile": {
                    "identifier": "d004f910-fff7-3ff4-b922-8ab1fec41b1b",
                    "username": "unknown",
                    "avatar": null
                },
                "size": 906,
                "social": {
                    "likes": 0,
                    "views": 1,
                    "youLikeIt": false
                }
            },
            "rarity": null,
            "category": null,
            "social": {
                "likes": 0,
                "views": 0,
                "youLikeIt": false
            },
            "gameKey": "DZmrVk1mJ5",
            "game": {
                "key": "DZmrVk1mJ5",
                "name": null,
                "image": null
            },
            "market": {
                "status": null,
                "isOwner": false,
                "price": null,
                "sellPrice": null,
                "seller": null,
                "fee": {
                    "networkFee": 1,
                    "royaltyFee": 0,
                    "serviceFee": 0.035
                },
                "notForSale": true,
                "availableForBuy": 0,
                "mySellingCount": 0,
                "sellers": null
            },
            "properties": {
                "category": null,
                "owner": "EQDRt8qogefagvLnOG57Nz3WUQVQNIw3vrFIDQ0w0lKQQYFA",
                "ownerProfile": null,
                "collection": {
                    "name": "Membership Cards | Escape from Zeya",
                    "avatar": "https://storage.googleapis.com/zeya-assets-storage-bucket-18e9bbb/MembershipCards/nft_collection_membership_avatar.png",
                    "address": "EQBLAcMnTcyx-_mWQtrVEC1eyDfK2nHI-A54P5eL7y-uE2Ht"
                },
                "attributes": null
            }
        }
    ]
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Get assets belonging to users' account

<mark style="color:blue;">`GET`</mark> `https://external.api.tonplay.io/x/tondata/v2/assets/{walletAddress}`

#### Path Parameters

| Name                                            | Type   | Description                                                                                                               |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| walletAddress<mark style="color:red;">\*</mark> | String | User's TON wallet address. All users who connected wallet on the platform will have this parameter from Extended User JWT |

#### Headers

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

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

```json
{
    "content": [
        {
            "address": "EQCChRd_RmXU4326EhGy62qRzAYuQ1WawjdKuIJwwfbvxBBe",
            "name": "Power Charges Pack",
            "description": "Power Charges Pack contains a certain number of power charges that can be used in the Escape from Zeya game!",
            "image": "https://storage.googleapis.com/tonplay-assets-storage-bucket-d8d0aa4/assets/Zeya/Images/Resource%20Pack/zeya_power_pack.png",
            "quantity": 0,
            "supply": 10,
            "index": 4,
            "type": "SFT",
            "rarity": "Uncommon",
            "category": "Resources",
            "gameKey": "DZmrVk1mJ5",
            "game": {
                "key": "DZmrVk1mJ5",
                "name": null,
                "image": null
            },
            "market": {
                "status": null,
                "isOwner": false,
                "price": null,
                "sellPrice": null,
                "seller": null,
                "fee": {
                    "networkFee": 1,
                    "royaltyFee": 0,
                    "serviceFee": 0.035
                },
                "notForSale": true,
                "availableForBuy": 0,
                "mySellingCount": 0,
                "sellers": []
            },
            "collectionName": "Resource Packs | Escape from Zeya",
            "locked": false
        }
    ]
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}
