2

I used the below API for getting NFT owned by a specific address but it returns both NFT and tokens in the result:

API:

https://api.ithacanet.tzkt.io/v1/tokens/balances?account=tz1cx3HD7Yy5XaHjY7T2NVw9zed7aWJU5e3E

result:

[
    {
        "id": 87998,
        "account": {
            "address": "tz1cx3HD7Yy5XaHjY7T2NVw9zed7aWJU5e3E"
        },
        "token": {
            "id": 63803,
            "contract": {
                "address": "KT1KHn1dUJkLiYy6txono8S1dPjs1zAgGCSL"
            },
            "tokenId": "0",
            "standard": "fa2"
        },
        "balance": "0",
        "transfersCount": 6,
        "firstLevel": 670408,
        "firstTime": "2022-06-10T09:57:20Z",
        "lastLevel": 670964,
        "lastTime": "2022-06-10T12:20:20Z"
    },
    {
        "id": 108019,
        "account": {
            "address": "tz1cx3HD7Yy5XaHjY7T2NVw9zed7aWJU5e3E"
        },
        "token": {
            "id": 69959,
            "contract": {
                "address": "KT1Esg5WPJSshbPZ2k3GLuf5oksUnEcByVLM"
            },
            "tokenId": "0",
            "standard": "fa2",
            "metadata": {
                "date": "2022-06-29 20:00:00",
                "name": "Compellio Poster",
                "type": "Digital Collectable Compellio Tour Poster",
                "creators": [
                    "Venue Tickets Inc."
                ],
                "decimals": "0",
                "language": "en",
                "displayUri": "ipfs://QmRkerfX5sASCXeGwXqmkCV6s6ySvSuoH2TqXKRMfZLsDL",
                "description": "Digital Collectable Compellio Tour Poster",
                "thumbnailUri": "ipfs://QmZ9MuG5tnuShfhncSdQzpjv6bAHJngsnwLn7mTqt2ymtJ"
            }
        },
        "balance": "0",
        "transfersCount": 10,
        "firstLevel": 702297,
        "firstTime": "2022-06-16T12:41:45Z",
        "lastLevel": 722060,
        "lastTime": "2022-06-20T11:49:45Z"
    },
    {
        "id": 109385,
        "account": {
            "address": "tz1cx3HD7Yy5XaHjY7T2NVw9zed7aWJU5e3E"
        },
        "token": {
            "id": 70293,
            "contract": {
                "address": "KT1Esg5WPJSshbPZ2k3GLuf5oksUnEcByVLM"
            },
            "tokenId": "1",
            "standard": "fa2",
            "metadata": {
                "date": "2022-06-29 20:00:00",
                "name": "Compellio Poster",
                "type": "Digital Collectable Compellio Tour Poster",
                "creators": [
                    "Venue Tickets Inc."
                ],
                "decimals": "0",
                "language": "en",
                "displayUri": "ipfs://QmRkerfX5sASCXeGwXqmkCV6s6ySvSuoH2TqXKRMfZLsDL",
                "description": "Digital Collectable Compellio Tour Poster",
                "thumbnailUri": "ipfs://QmZ9MuG5tnuShfhncSdQzpjv6bAHJngsnwLn7mTqt2ymtJ"
            }
        },
        "balance": "0",
        "transfersCount": 2,
        "firstLevel": 705793,
        "firstTime": "2022-06-17T07:59:15Z",
        "lastLevel": 713261,
        "lastTime": "2022-06-18T18:37:50Z"
    },
    {
        "id": 109438,
        "account": {
            "address": "tz1cx3HD7Yy5XaHjY7T2NVw9zed7aWJU5e3E"
        },
        "token": {
            "id": 70350,
            "contract": {
                "address": "KT1VEiUA7kaf4h3zY7P65gvumJ9HGgRKxmGp"
            },
            "tokenId": "0",
            "standard": "fa2",
            "metadata": {
                "date": "2022-06-29 20:00:00",
                "name": "Compellio Poster",
                "type": "Digital Collectable Compellio Tour Poster",
                "creators": [
                    "Venue Tickets Inc."
                ],
                "decimals": "0",
                "language": "en",
                "displayUri": "ipfs://QmRkerfX5sASCXeGwXqmkCV6s6ySvSuoH2TqXKRMfZLsDL",
                "description": "Digital Collectable Compellio Tour Poster",
                "thumbnailUri": "ipfs://QmZ9MuG5tnuShfhncSdQzpjv6bAHJngsnwLn7mTqt2ymtJ"
            }
        },
        "balance": "0",
        "transfersCount": 2,
        "firstLevel": 705922,
        "firstTime": "2022-06-17T08:33:30Z",
        "lastLevel": 713263,
        "lastTime": "2022-06-18T18:38:20Z"
    },
    {
        "id": 109441,
        "account": {
            "address": "tz1cx3HD7Yy5XaHjY7T2NVw9zed7aWJU5e3E"
        },
        "token": {
            "id": 67485,
            "contract": {
                "address": "KT1G6CSuWyzJf8nFxnAeUPAHq9erWjWi3XLP"
            },
            "tokenId": "0",
            "standard": "fa2",
            "metadata": {
                "date": "2021-04-25T01:33:53.451Z",
                "name": "World Tour Poster",
                "type": "Digital Collectable World Tour Poster",
                "creators": [
                    "Venue Tickets Inc."
                ],
                "decimals": "0",
                "language": "en",
                "displayUri": "ipfs://QmRkerfX5sASCXeGwXqmkCV6s6ySvSuoH2TqXKRMfZLsDL",
                "description": "Digital Collectable World Tour Poster",
                "thumbnailUri": "ipfs://QmZ9MuG5tnuShfhncSdQzpjv6bAHJngsnwLn7mTqt2ymtJ"
            }
        },
        "balance": "0",
        "transfersCount": 2,
        "firstLevel": 705942,
        "firstTime": "2022-06-17T08:38:50Z",
        "lastLevel": 721019,
        "lastTime": "2022-06-20T07:12:40Z"
    },
    {
        "id": 109467,
        "account": {
            "address": "tz1cx3HD7Yy5XaHjY7T2NVw9zed7aWJU5e3E"
        },
        "token": {
            "id": 70356,
            "contract": {
                "address": "KT1UjsWK7LEQRMKokL3FVQcj7zAhaTEMT6oW"
            },
            "tokenId": "0",
            "standard": "fa2",
            "metadata": {
                "date": "2022-06-29 20:00:00",
                "name": "Compellio Poster",
                "type": "Digital Collectable Compellio Tour Poster",
                "creators": [
                    "Venue Tickets Inc."
                ],
                "decimals": "0",
                "language": "en",
                "displayUri": "ipfs://QmRkerfX5sASCXeGwXqmkCV6s6ySvSuoH2TqXKRMfZLsDL",
                "description": "Digital Collectable Compellio Tour Poster",
                "thumbnailUri": "ipfs://QmZ9MuG5tnuShfhncSdQzpjv6bAHJngsnwLn7mTqt2ymtJ"
            }
        },
        "balance": "0",
        "transfersCount": 6,
        "firstLevel": 706152,
        "firstTime": "2022-06-17T09:40:10Z",
        "lastLevel": 707303,
        "lastTime": "2022-06-17T15:00:55Z"
    }
]

I want to return just NFT not tokens!!!

1

2 Answers 2

5

The only way to distinguish them is to use some heuristics, but they won't be 100% accurate.

But you can try to filter on tzkt this way to get only NFTs, accuracy should be good: metadata.artifactUri.null = false

1
  • What is diffent between displayUri and artifactUri ???
    – Taleb
    Jun 21 at 12:47
3

Regarding the question about the difference between displayUri and artifactUri:

artifactUri (string) [format: uri-reference] A URI (as defined in the JSON Schema Specification) to the asset.

displayUri (string) [format: uri-reference] A URI (as defined in the JSON Schema Specification) to an image of the asset. Used for display purposes.

Thats from TZIP-21 which is an extension of TZIP-016: https://tzip.tezosagora.org/proposal/tzip-21/#artifacturi-string-format-uri-reference

Not the answer you're looking for? Browse other questions tagged or ask your own question.