# API Reference

{% hint style="warning" %}
The documentation is designed for Liker Land and LikeCoin v2. For information on [3ook.com](https://3ook.com/) and LikeCoin v3, please visit [docs.3ook.com](https://docs.3ook.com) and [dao.like.co](https://dao.like.co/).
{% endhint %}

## Base URL

Production: `https://mainnet-node.like.co`

Testnet: `https://node.testnet.like.co`

## LCD API

Please refer to [`x/nft` query definition](https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/proto/cosmos/nft/v1beta1/query.proto) and [likenft query definition](https://github.com/likecoin/likecoin-chain/blob/master/proto/likechain/likenft/v1/query.proto) for most updated LCD API

### Balance

queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721

`/cosmos/nft/v1beta1/balance/{owner}/{class_id}`

### Owner

queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 `/cosmos/nft/v1beta1/owner/{class_id}/{id}`

### Supply

queries the number of NFTs from the given class, same as totalSupply of ERC721. `/cosmos/nft/v1beta1/supply/{class_id}`

### NFTs

queries all NFTs of a given `class` or `owner`, choose at least one of the two, similar to tokenByIndex in ERC721Enumerable

`/cosmos/nft/v1beta1/nfts`

### NFT

queries an NFT based on its class and id.

`/cosmos/nft/v1beta1/nfts/{class_id}/{id}`

### Class

queries an NFT class based on its id

`/cosmos/nft/v1beta1/classes/{class_id}`

### Classes

queries all NFT classes

`/cosmos/nft/v1beta1/classes`

## Indexer API

Pagination params:

| Param   | Example | Description                                                                                |
| ------- | ------- | ------------------------------------------------------------------------------------------ |
| key     |         | Key of the last item of previous response for pagination, should not be used with `offset` |
| limit   |         | The size limit of response. Default & max: 100                                             |
| reverse |         | Sorting order                                                                              |
| offset  |         | Offset of response, should not be used with `key`                                          |

### Class API

`/likechain/likenft/v1/class`

<table><thead><tr><th>Param</th><th>Example</th><th width="276">Description</th></tr></thead><tbody><tr><td>iscn_id_prefix</td><td></td><td>ISCN prefix of NFT class (if minted via ISCN)</td></tr><tr><td>account</td><td></td><td>Account of NFT class (if minted via account)</td></tr><tr><td>iscn_owner</td><td></td><td>Query classes owned via ISCN by an address</td></tr><tr><td>expand</td><td></td><td>expand NFT info</td></tr></tbody></table>

### NFT API

`/likechain/likenft/v1/nft`

<table><thead><tr><th>Param</th><th>Example</th><th width="276">Description</th></tr></thead><tbody><tr><td>owner</td><td></td><td>Owner address</td></tr><tr><td>expand_classes</td><td></td><td>Expand class information</td></tr></tbody></table>

### Owner API

`/likechain/likenft/v1/owner`

<table><thead><tr><th>Param</th><th>Example</th><th width="276">Description</th></tr></thead><tbody><tr><td>class_id</td><td></td><td>NFT Class ID</td></tr></tbody></table>

### Event API

`/likechain/likenft/v1/event`

<table><thead><tr><th>Param</th><th>Example</th><th width="276">Description</th></tr></thead><tbody><tr><td>class_id</td><td></td><td>NFT Class ID</td></tr><tr><td>nft_id</td><td></td><td>NFT ID</td></tr><tr><td>iscn_id_prefix</td><td></td><td>ISCN ID Prefix (if minted via ISCN)</td></tr><tr><td>verbose</td><td></td><td>Expand events</td></tr><tr><td>action_type</td><td>/cosmos.nft.v1beta1.MsgSend</td><td>Filter event by action</td></tr><tr><td>sender</td><td></td><td>Get all events sent by an address</td></tr><tr><td>receiver</td><td></td><td>Get all events received by an address</td></tr><tr><td>creator</td><td></td><td>Get all events of NFT Classes created (ISCN owner) by an address</td></tr><tr><td>involver</td><td></td><td>Get all events involving an address (sender OR receiver OR creator)</td></tr><tr><td>ignore_from_list</td><td></td><td>Ignore events sent from address</td></tr><tr><td>ignore_to_list</td><td></td><td>Ignore events sent to address</td></tr></tbody></table>

### Ranking API

`/likechain/likenft/v1/ranking`

#### Request Params

<table><thead><tr><th>Param</th><th width="258.3333333333333">Example</th><th>Description</th></tr></thead><tbody><tr><td>creator</td><td><code>like13f4glvg80zvfrrs7utft5p68pct4mcq7t5atf6</code></td><td>The current owner of the ISCN</td></tr><tr><td>collector</td><td><code>like1vymrc5dxlfwff30m03prwlu08ql4vudn4lue8u</code></td><td>The current owner of NFT</td></tr><tr><td>type</td><td><code>CreativeWork</code></td><td>The <code>contentMetadata.@type</code> field in ISCN</td></tr><tr><td>stakeholder_id</td><td><code>did:like:1w6es6du93xmhms60gwwtczr2p2h4cdm8r7kc0f</code></td><td>The <code>stakeholders.entity.@id</code> field in ISCN</td></tr><tr><td>stakeholder_name</td><td><code>kin</code></td><td>The <code>stakeholders.entity.name</code> field in ISCN</td></tr><tr><td>created_after</td><td><code>1659283200</code></td><td>Get NFT class created after this UNIX second timestamp</td></tr><tr><td>created_before</td><td><code>1659801600</code></td><td>Get NFT class created before this UNIX second timestamp</td></tr><tr><td>sold_after</td><td><code>1659283200</code></td><td>Rank NFT class base on sales after this UNIX second timestamp</td></tr><tr><td>sold_before</td><td><code>1659801600</code></td><td>Rank NFT class base on sales before this UNIX second timestamp</td></tr><tr><td>include_owner</td><td><code>true</code></td><td>Whether to include owner of ISCN when counting sold_count</td></tr><tr><td>ignore_list</td><td><code>like17m4vwrnhjmd20uu7tst7nv0kap6ee7js69jfrs</code></td><td>The addresses to ignore when counting sold count</td></tr><tr><td>order_by</td><td></td><td>total_sold_value/sold_count</td></tr></tbody></table>

Result is order by the number of NFTs not owned by creator nor `ignore_list`

#### Example Response

`/likechain/likenft/v1/ranking?ignore_list=like17m4vwrnhjmd20uu7tst7nv0kap6ee7js69jfrs&limit=1`

```json
{
  "classes": [
    {
      "id": "likenft1yhsps5l8tmeuy9y7k0rjpx97cl67cjkjnzkycecw5xrvjjp6c5yqz0ttmc",
      "name": "Writing NFT - 分散式出版 DePub 的發展路徑，NFT 從移民到原住民",
      "description": "...",
      "symbol": "WRITING",
      "uri": "https://api.like.co/likernft/metadata?iscn_id=iscn%3A%2F%2Flikecoin-chain%2FIKI9PueuJiOsYvhN6z9jPJIm3UGMh17BQ3tEwEzslQo%2F3",
      "uri_hash": "",
      "config": {
        "burnable": false,
        "max_supply": "0",
        "blind_box_config": null
      },
      "metadata": {
        "url": "https://ckxpress.com/nft-immigrant-to-native/",
        "name": "分散式出版 DePub 的發展路徑，NFT 從移民到原住民",
        "@type": "Article",
        "image": "ar://_GJD1gNuIqXicYNWce__4B8Qqg5tN8FBRSUCXR8kuJE",
        "version": 1,
        "@context": "http://schema.org/",
        "keywords": "DePub,LikeCoin,nft,Numbers",
        "usageInfo": "",
        "description": "...",
        "nft_meta_collection_id": "likerland_writing_nft",
        "nft_meta_collection_name": "Writing NFT",
        "nft_meta_collection_description": "Writing NFT by Liker Land"
      },
      "parent": {
        "type": "ISCN",
        "iscn_id_prefix": "iscn://likecoin-chain/IKI9PueuJiOsYvhN6z9jPJIm3UGMh17BQ3tEwEzslQo",
        "account": ""
      },
      "price": 0,
      "created_at": "2022-08-01T06:33:21Z",
      "sold_count": 171
    }
  ],
  "pagination": {
    "count": 1
  }
}
```

*Note: Currently only like.co API can report the latest price. `price` in the response is always 0. Please refer to like.co API documentation for price information*

***

### Social Graph API

#### Get Collectors

`/likechain/likenft/v1/collector`

| Param          | Example                                       | Description                             |
| -------------- | --------------------------------------------- | --------------------------------------- |
| **creator**    | `like13f4glvg80zvfrrs7utft5p68pct4mcq7t5atf6` | Required. Account address of ISCN owner |
| ignore\_list   |                                               | The addresses to ignore                 |
| include\_owner |                                               | Whether to include owner of ISCN        |
| price\_by      |                                               | class/nft                               |
| order\_by      |                                               | price/count                             |

#### Get Creators

`/likechain/likenft/v1/creator`

| Param          | Example                                       | Description                            |
| -------------- | --------------------------------------------- | -------------------------------------- |
| **collector**  | `like13f4glvg80zvfrrs7utft5p68pct4mcq7t5atf6` | Required. Account address of NFT owner |
| ignore\_list   |                                               | The addresses to ignore                |
| include\_owner |                                               | Whether to include owner of ISCN       |
| price\_by      |                                               | class/nft                              |
| order\_by      |                                               | price/count                            |

Result is order by count of NFT collections.

#### Example Response

`/likechain/likenft/v1/collector?creator=like13f4glvg80zvfrrs7utft5p68pct4mcq7t5atf6`

```json
{
  "collectors": [
    {
      "account": "like17m4vwrnhjmd20uu7tst7nv0kap6ee7js69jfrs",             // The like.co NFT sales API wallet
      "count": 2928,
      "collections": [
        {
          "iscn_id_prefix": "iscn://likecoin-chain/IKI9PueuJiOsYvhN6z9jPJIm3UGMh17BQ3tEwEzslQo",
          "class_id": "likenft1yhsps5l8tmeuy9y7k0rjpx97cl67cjkjnzkycecw5xrvjjp6c5yqz0ttmc",
          "count": 443
        },
        {
          "iscn_id_prefix": "iscn://likecoin-chain/IKI9PueuJiOsYvhN6z9jPJIm3UGMh17BQ3tEwEzslQo",
          "class_id": "likenft1yzdfkf4fjjekqjmxen0czy5eyufapfrx5y3nd6d7wd6hmyy6zt3sk7ak4z",
          "count": 500
        },
        {
          "iscn_id_prefix": "iscn://likecoin-chain/OImbeoC6JTlEJrjVOJXAj4rF5uS04vuRGbittFGyQbc",
          "class_id": "likenft1h9efvdvj5m275w8sr2u0jsme2xlmpfexjp802ckda3fvuncw95tsnq2c7u",
          "count": 492
        },
        {
          "iscn_id_prefix": "iscn://likecoin-chain/Tz4l66fBAgEMk5IyEJ4_N0FBj2NjLCse3Uqnm8VxR-8",
          "class_id": "likenft1g0652jc6fns73r5ru6pwp6djp99975em576px88wxau7hrmn2d5qf06zs4",
          "count": 500
        },
        {
          "iscn_id_prefix": "iscn://likecoin-chain/Tz4l66fBAgEMk5IyEJ4_N0FBj2NjLCse3Uqnm8VxR-8",
          "class_id": "likenft1yhxut65wavj2jykq07xtm66dnmn75dm5y0tgq8f49azs3lff7ngqrw7kv6",
          "count": 500
        },
        {
          "iscn_id_prefix": "iscn://likecoin-chain/Tz4l66fBAgEMk5IyEJ4_N0FBj2NjLCse3Uqnm8VxR-8",
          "class_id": "likenft1ztyc5usfn36r2uuza86waa7xn9j7r8xjzagtpcesj3p2t7mmj9kssqlxwe",
          "count": 493
        }
      ]
    },
    {
      "account": "like126qel5qhcxnxy2nd0s43pjp2aqujnp60jeg27l",
      "count": 3,
      "collections": [
        {
          "iscn_id_prefix": "iscn://likecoin-chain/IKI9PueuJiOsYvhN6z9jPJIm3UGMh17BQ3tEwEzslQo",
          "class_id": "likenft1yhsps5l8tmeuy9y7k0rjpx97cl67cjkjnzkycecw5xrvjjp6c5yqz0ttmc",
          "count": 1
        },
        {
          "iscn_id_prefix": "iscn://likecoin-chain/OImbeoC6JTlEJrjVOJXAj4rF5uS04vuRGbittFGyQbc",
          "class_id": "likenft1h9efvdvj5m275w8sr2u0jsme2xlmpfexjp802ckda3fvuncw95tsnq2c7u",
          "count": 1
        },
        {
          "iscn_id_prefix": "iscn://likecoin-chain/Tz4l66fBAgEMk5IyEJ4_N0FBj2NjLCse3Uqnm8VxR-8",
          "class_id": "likenft1ztyc5usfn36r2uuza86waa7xn9j7r8xjzagtpcesj3p2t7mmj9kssqlxwe",
          "count": 1
        }
      ]
    },
    {
      "account": "like18q3dzavq7c6njw92344rf8ejpyqxqwzvhz9th5",
      "count": 3,
      "collections": [
        {
          "iscn_id_prefix": "iscn://likecoin-chain/IKI9PueuJiOsYvhN6z9jPJIm3UGMh17BQ3tEwEzslQo",
          "class_id": "likenft1yhsps5l8tmeuy9y7k0rjpx97cl67cjkjnzkycecw5xrvjjp6c5yqz0ttmc",
          "count": 3
        }
      ]
    }
  ],
  "pagination": {
    "count": 3
  }
}
```

### Example UI

<https://likecoin.github.io/likecoin-nft-dashboard/>

[source code](https://github.com/likecoin/likecoin-nft-dashboard)

\\


---

# 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.v2.like.co/developer/likenft/api-reference.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.
