> For the complete documentation index, see [llms.txt](https://docs.wepin.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wepin.io/en/api/token-and-nft.md).

# Token and NFT

### Retrieve Account Information <a href="#retrieve-account-information" id="retrieve-account-information"></a>

This feature is available only after a successful login. It returns the account information for wallets used in the app.

```http
GET /v1/account?userId={userId}&walletId={walletId} HTTP/1.1
Host: sdk.wepin.io
X-API-KEY: ${APP_KEY}
X-API-DOMAIN: {APP_DOMAIN}
X-SDK-TYPE: {platform}_rest_api
Content-Type: application/json
Authorization: Bearer ${access_token}
```

#### Request

**Parameter**

<table><thead><tr><th width="136">Name</th><th width="105">Type</th><th width="371">Description</th><th>Required</th></tr></thead><tbody><tr><td>userId</td><td>String</td><td><code>userId</code> obtained from the <code>userInfo</code> during the <a href="/pages/EQaogmCNNR1GmRx6oihQ#login">Login</a> process.</td><td>O</td></tr><tr><td>walletId</td><td>String</td><td>Wallet ID received as a result of the <a href="/pages/EQaogmCNNR1GmRx6oihQ#login">Login</a>.</td><td>O</td></tr></tbody></table>

#### Response

**Success Response**

<table><thead><tr><th width="145">Name</th><th width="204">Type</th><th>Description</th></tr></thead><tbody><tr><td>walletId</td><td>String</td><td>The user's wallet ID.</td></tr><tr><td>accounts</td><td>Account(Object) []</td><td>List of retrieved accounts (<code>Account</code>)</td></tr></tbody></table>

* `Account`

  * `accountId` *String*
    * Unique identifier for the account
  * `accountTokenId` *String (Optional)*
    * Unique identifier for the token account. Returned only if it is a token account.
  * `address` *String*
    * Account address
  * `addressPath` *String*
    * Account address path
  * `label` *String*
    * Account label
  * `balance` *String*
    * Account balance
  * `coinId` *Integer (Optional)*
    * Identifier for the coin information of the account. Returned only for native coins.
  * `name` *String*
    * Name of the coin information of the account
  * `network` *String*
    * Network name of the account
  * `symbol` *String*
    * Symbol of the account
  * `decimals` *Integer*
    * Decimal value of the coin in the account
  * `contract` *String (Optional)*
    * Contract address of the token account. Returned only for token accounts.
  * `iconUrl` *String*
    * URL for the account's icon image
  * `ids` *String*
    * Identifier to retrieve the coin information of the account

***Example***

```json
// When there is a Klaytn main account and KCT (token) accounts
{
	"walletId": "999999999999999999999999999999999999999999999999999999999999999999",
  "accounts": [
    {
      "accountId": "90",
      "address": "0x9990000000000000000000000000000000000000",
      "addressPath": "m/44'/60'/0'/0/0",
      "coinId": 2,
      "symbol": "KLAY",
      "label": "KLAY-01",
      "name": "Klaytn",
      "network": "KLAYTN",
      "balance": "123407670918639753",
      "decimals": 18,
      "iconUrl": "<https://coin-img.wepin.io/coinlogo/klaytn.png>",
      "ids": "klay-token"
    },
    {
      "accountId": "90",
      "accountTokenId": "91",
      "address": "0x9990000000000000000000000000000000000000",
      "addressPath": "m/44'/60'/0'/0/0",
      "contract": "0x52CFDA3E278837d852C4315586C9464BE762647E",
      "symbol": "COSM",
      "label": "COSM",
      "name": "Cosmo Coin",
      "network": "KLAYTN",
      "balance": "20000000000000000",
      "decimals": 18,
      "iconUrl": "<https://coin-img.wepin.io/coinlogo/cosmo.png>",
      "ids": "cosmo-coin"
    }
  ]
}
```

***

### Refresh Account Balance <a href="#refresh-account-balance" id="refresh-account-balance"></a>

Refreshes the balance of the account. If the refresh is triggered by the user in the front-end service, it is recommended to implement UI/UX to prevent repeated requests within 1 minute.

```http
GET /v1/accountbalance/{accountId}/balance HTTP/1.1
Host: sdk.wepin.io
X-API-KEY: ${APP_KEY}
X-API-DOMAIN: {APP_DOMAIN}
X-SDK-TYPE: {platform}_rest_api
Content-Type: application/json
Authorization: Bearer ${access_token}
```

#### Request

**Parameter**

<table><thead><tr><th width="143">Name</th><th width="120">Type</th><th width="366">Description</th><th>Required</th></tr></thead><tbody><tr><td>accountId</td><td>String</td><td>accountId received from the <a href="#retrieve-account-information">account information retrieval</a></td><td>O</td></tr></tbody></table>

#### Response

**Success Response**

<table><thead><tr><th width="223">Name</th><th width="278">Type</th><th>Description</th></tr></thead><tbody><tr><td>balance</td><td>String</td><td>Account balance</td></tr><tr><td>decimals</td><td>Integer</td><td>Decimal value of the account</td></tr><tr><td>symbol</td><td>String</td><td>Symbol of the account</td></tr><tr><td>tokens</td><td>TokenBalance(Object) []</td><td>List of balances for the account's tokens (<code>TokenBalance</code>)</td></tr></tbody></table>

* `TokenBalance`
  * `balance` *String*
    * Token account balance
  * `decimals` *Integer*
    * Decimal value of the token account
  * `symbol` *String*
    * Symbol of the token account
  * `contract` *String*
    * Contract address of the token account

***Example***

```json
{
	"balance": "123407670918639753",
  "decimals": 18,
  "symbol": "KLAY",
  "tokens": [
		{
		  "balance": "20000000000000000",
			"decimals": 18,
			"symbol": "COSM",
			"contract": "0x52CFDA3E278837d852C4315586C9464BE762647E"
		}
	]
}
```

***

### Retrieve NFT Information <a href="#retrieve-nft-information" id="retrieve-nft-information"></a>

This function is available only after a successful login. It returns the NFT information of the wallet used in the app.

```http
GET /v1/nft?userId={userId}&walletId={walletId} HTTP/1.1
Host: sdk.wepin.io
X-API-KEY: ${APP_KEY}
X-API-DOMAIN: {APP_DOMAIN}
X-SDK-TYPE: {platform}_rest_api
Content-Type: application/json
Authorization: Bearer ${access_token}
```

#### Request

**Parameter**

<table><thead><tr><th width="144">Name</th><th width="99">Type</th><th width="401">Description</th><th>Required</th></tr></thead><tbody><tr><td>userId</td><td>String</td><td><code>userId</code> obtained from the <code>userInfo</code> during the <a href="/pages/EQaogmCNNR1GmRx6oihQ#login">Login</a> process.</td><td>O</td></tr><tr><td>walletId</td><td>String</td><td>Wallet ID received as a result of the <a href="/pages/EQaogmCNNR1GmRx6oihQ#login">Login</a>.</td><td>O</td></tr></tbody></table>

#### Response

**Success Response**

<table><thead><tr><th width="140">Name</th><th width="203">Type</th><th>Description</th></tr></thead><tbody><tr><td>nfts</td><td>NFT(Object) []</td><td>Retrieved NFT list (<code>NFT</code>)</td></tr></tbody></table>

* `NFT`

  * `id` *String*
    * Unique identifier of the NFT
  * `accountId` *String*
    * Unique identifier of the account holding the NFT
  * `name` *String*
    * NFT name
  * `description` *String*
    * NFT description
  * ### `tokenId` *String*
  * `externalLink` *String*
    * NFT external link
  * `imageUrl` *String*
    * NFT image URL
  * `quantity` *Integer*
    * Number of NFTs
  * `contentType` *Integer*
    * Type of NFT content
    * `1` : image
    * `2` : video
  * `contract` *Object*
    * Information about the NFT contract (`NFTContract`)

  *Example*

  ```json
  {
  	"nfts": []
  }
  ```
* `NFTContract`
  * `address` *String*
    * NFT Contract address
  * `scheme` *Integer*
    * NFT Contract Scheme
    * `1` : ERC721
    * `2` : ERC1155
  * `description` *String*
    * NFT Contract 설명
  * `network` *String*
    * Network
  * `externalLink` *String*
    * NFT contract external link
  * `imageUrl` *String*
    * NFT contract image URL

### Refresh NFT Information <a href="#refresh-nft-information" id="refresh-nft-information"></a>

Refreshes the NFT information. If the refresh is triggered by a user's request in the front-end service, it is recommended to design the UI/UX to prevent repeated requests within 1 minute.

```http
GET /v1/nft/refresh?userId={userId}&walletId={walletId} HTTP/1.1
Host: sdk.wepin.io
X-API-KEY: ${APP_KEY}
X-API-DOMAIN: {APP_DOMAIN}
X-SDK-TYPE: {platform}_rest_api
Content-Type: application/json
Authorization: Bearer ${access_token}
```

#### Request

**Parameter**

<table><thead><tr><th width="124">Name</th><th width="100">Type</th><th width="413">Description</th><th>Required</th></tr></thead><tbody><tr><td>userId</td><td>String</td><td><code>userId</code> obtained from the <code>userInfo</code> during the <a href="/pages/EQaogmCNNR1GmRx6oihQ#login">Login</a> process.</td><td>O</td></tr><tr><td>walletId</td><td>String</td><td>Wallet ID received as a result of the <a href="/pages/EQaogmCNNR1GmRx6oihQ#login">Login</a>.</td><td>O</td></tr></tbody></table>

#### Response

The response is identical to that of [Retrieve NFT Information](#retrieve-nft-information).
