Get Meta Information

This page introduces how to get the information about Token (FT, NFT) contract and the information about NFT by Node API - Metadata API.

Before Getting Started

  • The x-chain-id value for calling the API is 8217 (Cypress) or 1001 (Baobab).

  • Essential parameters for calling APIs are described in individual examples.

Values that a user needs to enter for calling APIs will be represented with one pair of braces ({}). A user must enter the following values.

Item

Description

Note

chain-id

8217 or 1001

Cypress(Klaytn mainnet) or Baobab(Klaytn testnet

access-key-id

Auth ID

accessKeyId obtained from KAS Console - Security - Credential

secret-access-key

Auth Password

secretAccessKey obtained from KAS Console - Security - Credential

krn

(optional) ID of Account Pool

Unnecessary when using Default Account Pool

A KAS API Authentication Key (API Auth Key) provides access to all KAS services and all the rights to a Klaytn account which was created by calling Wallet API via this API Auth Key. The rights here include accessing and transferring all the assets (KLAY, etc.) of or sending a transaction from a Klaytn account. If you shared your API Auth Key with any unauthorized personnel, your Klaytn account could be compromised and might cause unwanted transaction execution.

DO NOT share your API Auth Key (Secret AccessKey or Authorization) with any unauthorized personnel. DO PUT efforts necessary to keep your API Auth Key safe for the security of your KAS/Klaytn account.

To check Klaytn account information through Klaytn Node, create an Account Pool and select an account to use. For more details on creating an Account Pool, account, and selecting an account, refer to Getting Started.

Klaytn Node - Metadata API does not support SDK (caver-js, caver-java)

For inquires about this document or KAS, please visit KAS Developer forum.

Get FT Contract Information

FT contract is a type of smart contract deployed to Klaytn that allows users to issue, delete, and send Fungible Token (Fungible Token, FT).

An FT contract must follow the ERC-20 or KIP-7 standard, and the name(), symbol(), and decimals() functions must be implemented in advance. For more details on these functions, refer to ERC-20, KIP-7.

API Request

curl --location --request GET "https://node-api.klaytnapi.com/v2/metadata/ft/0x3b3b30a76d169f72a0a38ae01b0d6e0fbee3cc2e" \
    --header "x-chain-id: {chain-id}" \
    -u {access-key-id}:{secret-access-key}

All response values will be empty strings or 0/-1, except for contract addresses, if the contract is not on Klaytn. If the ERC-20/KIP-7 standard is not followed, different response values will be returned according to contracts. The fields of response values to be filled by the functions will be empty strings or 0/-1 if the required field functions are not implemented.

This API does not validate whether the contract follows the correct ERC-20/KIP-7 standard. Do not enter the NFT contract address in the path parameter.

API Response

{
    "address": "0x3b3b30a76d169f72a0a38ae01b0d6e0fbee3cc2e",
    "decimals": 18,
    "name": "TEMCO",
    "symbol": "TEMCO",
    "totalSupply": "0x1363156bbee3016d70000000"
}

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developer forum.

Get NFT Contract Information

NFT contract is a type of smart contract deployed to Klaytn that allows users to issue, delete, and send Non-fungible Token (Non-Fungible Token, NFT).

An NFT contract must follow the ERC-721 or KIP-17 standard, and the name(), symbol(), and totalSupply() functions must be implemented in advance. For more details on these functions, refer to ERC-721, KIP-17.

API Request

curl --location --request GET "https://node-api.klaytnapi.com/v2/metadata/nft/0x369611bc873b38175b91d6cc8c4018bdd3068b86" \
    --header "x-chain-id: {chain-id}" \
    -u {access-key-id}:{secret-access-key}

All response values will be empty strings or 0/-1, except for contract addresses, if the contract is not on Klaytn. If the ERC-721/KIP-17 standard is not followed, different response values will be returned according to contracts. The fields of response values to be filled by the functions will be empty strings or 0/-1 if the required field functions are not implemented.

This API does not validate whether the contract follows the correct ERC-721/KIP-17 standard. Do not enter the FT contract address in the path parameter.

API Response

The following response will be received if the API is successfully executed.

{
    "address": "0x369611bc873b38175b91d6cc8c4018bdd3068b80",
    "name": "Test NFT",
    "symbol": "TNC",
    "totalSupply": "0x86"
}

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developer forum.

Get NFT Information

Get NFT Information. NFT contract is a type of smart contract deployed to Klaytn that allows users to issue, delete, and send Non-fungible Token (Non-Fungible Token, NFT).

Enter the token ID value of the NFT to load the information and the NFT contract address value issued to the NFT. This NFT contract must follow the ERC-721 or KIP-17 standard, and the tokenUri() function must be implemented for correct information return.

API Request

curl --location --request GET "https://node-api.klaytnapi.com/v2/metadata/nft/0x369611bc873b38175b91d6cc8c4018bdd3068b80/0x1" \
    --header "x-chain-id: {chain-id}" \
    -u {access-key-id}:{secret-access-key}
  • This is an example of an NFT contract address value issued to the NFT: 0x369611bc873b38175b91d6cc8c4018bdd3068b80.

  • This is an example of token ID value for searching: 0x1.

API Response

The following response will be received if the API is successfully executed.

{
    "uri": "https://media.nft.com/card_asset/165616/cced4c1b-6407-45a4-b6d9-ec040870df5e.json",
    "owner": "0x3cb01b8f935069b3f3d57cff07be4e4c09164f71"
}

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developer forum.

Last updated