> 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/in-game-marketplace-api.md).

# In-game marketplace API

## Public API

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

## Put asset on sale

<mark style="color:orange;">`PUT`</mark> `https://external.api.tonplay.io/x/market/v1/sale`

#### Headers

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

#### Request Body

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| address<mark style="color:red;">\*</mark>       | String | Asset's address       |
| price<mark style="color:red;">\*</mark>         | String | Asset's price in $TON |
| amount                                          | String | For SFT only          |
| type<mark style="color:red;">\*</mark>          | String | NFT or SFT            |
| sellerAddress<mark style="color:red;">\*</mark> | String | Asset's owner address |

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

```javascript
{
  "address": "string",
  "url": "string"
}
```

{% endtab %}
{% endtabs %}

## Buy asset

<mark style="color:green;">`POST`</mark> `https://external.api.tonplay.io/x/market/v1/sale`

#### Headers

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

#### Request Body

| Name                                           | Type   | Description                              |
| ---------------------------------------------- | ------ | ---------------------------------------- |
| address<mark style="color:red;">\*</mark>      | String | Asset's address                          |
| amount                                         | String | Assets amount                            |
| type<mark style="color:red;">\*</mark>         | String | NFT or SFT                               |
| buyerAddress<mark style="color:red;">\*</mark> | String | Asset's buyer address                    |
| sellerAddress                                  | String | Asset's sellerAddress (required for SFT) |

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

```javascript
{
  "address": "string",
  "url": "string"
}
```

{% endtab %}
{% endtabs %}

## Remove asset from sale

<mark style="color:red;">`DELETE`</mark> `https://external.api.tonplay.io/x/market/v1/sale`

#### Headers

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

#### Request Body

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| address<mark style="color:red;">\*</mark>       | String | Asset's address       |
| amount                                          | String | Assets amount         |
| type<mark style="color:red;">\*</mark>          | String | NFT or SFT            |
| sellerAddress<mark style="color:red;">\*</mark> | String | Asset's owner address |

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

```javascript
{
  "address": "string",
  "url": "string"
}
```

{% endtab %}
{% endtabs %}

## Get assets on sale

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

#### Headers

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

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

```javascript
[
  {
    "price": 0,
    "sellPrice": 0,
    "seller": {
      "identifier": "string",
      "username": "string",
      "avatar": "string"
    },
    "serviceFee": 0,
    "royaltyFee": 0,
    "quantity": 0
  }
]
```

{% endtab %}
{% endtabs %}
