# NFT and Wallet Portfolio

## Get NFT Portfolio

<mark style="color:blue;">`GET`</mark> `[endpoint]/v3/wallet/nft`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

{% tabs %}
{% tab title="200: OK Portfolio successfully retrieved" %}

```javascript
{
    "status": "success",
    "data": [
        {
            "inventory_id": 117756,
            "nft_id": null,
            "name": "Mark 14 #1",
            "image_uri": "https://cdn.alphagames.id/nft-storage/devnet/wows/torpedo-collection/mark-14.png",
            "collection": {
                "address": "BCa8Q2Co3hpceuaBJk8mYZ4ZVQnYs8Dv8iE8EJ7v2yjH",
                "name": "Torpedo Collection"
            },
            "attributes": {
                "Category": "Torpedo",
                "Usage": "Unlimited"
            }
        },
....
        {
            "inventory_id": 118214,
            "nft_id": null,
            "name": "Mark 18 #59",
            "image_uri": "https://cdn.alphagames.id/nft-storage/devnet/wows/torpedo-collection/mark-18.png",
            "collection": {
                "address": "BCa8Q2Co3hpceuaBJk8mYZ4ZVQnYs8Dv8iE8EJ7v2yjH",
                "name": "Torpedo Collection"
            },
            "attributes": {
                "Category": "Torpedo",
                "Usage": "Unlimited"
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get Item Rarity and Stock Based on Collection

<mark style="color:green;">`GET`</mark> `/v3/nft/stock`

**Headers**

| Name          | Value            |
| ------------- | ---------------- |
| X-Api-Key     | `API Key`        |
| Authorization | `Bearer <token>` |

**Query**

| Name                                                   | Type               | Description                                                                                                                                                             |
| ------------------------------------------------------ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `collection_address`<mark style="color:red;">\*</mark> | string             | Collection Address                                                                                                                                                      |
| `rarity`                                               | integer (opsional) | Integer of rarity which set on admin when creating NFT. <mark style="color:purple;">e.g. 1 for common, 2 for common, 3 for rare, 4 for legendary, 5 for mythical</mark> |

**Response**

{% tabs %}
{% tab title="200 (without rarity)" %}

```json
{
    "status": "success",
    "data": [
        {
            "stock": 800,
            "rarity": 1
        },
        {
            "stock": 200,
            "rarity": 2
        }
    ]
}
```

{% endtab %}

{% tab title="200 (with rarity)" %}

```json
{
    "status": "success",
    "data": [
        {
            "stock": 400,
            "group_item": "Mark 14"
        },
        {
            "stock": 400,
            "group_item": "Mark 18"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Assign Item NFT

<mark style="color:green;">`POST`</mark> `/v3/nft/assign`

**Headers**

| Name          | Value            |
| ------------- | ---------------- |
| X-Api-Key     | `API Key`        |
| Authorization | `Bearer <token>` |

**Body**

| Name                                                   | Type   | Description        |
| ------------------------------------------------------ | ------ | ------------------ |
| `collection_address`<mark style="color:red;">\*</mark> | string | Collection Address |
| `group_item`<mark style="color:red;">\*</mark>         | string | Group Item Name    |

**Response**

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

```json
{
    "status": "success",
    "messages": "NFT Assigned to User",
    "data": {
        "inventory_id": 118214
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": "error",
    "messages": {
        "assignNFTFailed": "Failed to Assign NFT. Possible Empty Stock."
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.komoverse.io/player-api-reference/nft-and-wallet-portfolio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
