Before Getting Started
- API introduced in here should only be used with HTTP Request.
-
The
x-chain-id
value for calling the API is8217
(Mainnet) or1001
(Kairos). - 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 | Kaia Mainnet or Kairos |
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 Kaia account which was created by calling Wallet API via this API Auth Key. The rights here include accessing and transferring all the assets (KAIA, etc.) of or sending a transaction from a Kaia account. If you shared your API Auth Key with any unauthorized personnel, your Kaia account could be compromised and might cause unwanted transaction execution.
danger
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/Kaia account.
Get List of FT Contract
Search the list of labeled FT contracts.
FT contract is a type of smart contract deployed to Kaia that allows users to issue, delete, and send Fungible Token (Fungible Token, FT).
Label is a marker put on a specific token contract by KAS for tracking its information. KAS only tracks labeled token contracts. This API requests for the list of labeled FT contracts. For details about labeling, please visit here.
API Request
Search the list of labeled FT contracts as follows.
Query Parameter
You can search for the list of FT contracts by specifying the labeling status and contract type. Also, you can receive API response values with Cursor-based Pagination.
Parameter | Description | Example | Required or Not |
---|---|---|---|
status | Labeling status ["completed", "processing", "failed", "cancelled"] | status=completed |
False |
type | Type of contract (KIP standard: "kip", ERC standard: "erc", else: "") |
type=kip |
False |
size | the number of items in the API response (min=1, max=1000, default=100) | size=100 |
False |
cursor | the cursor required to get the next batch of response items | cursor=J9Ag...VM6z |
False |
curl --location --request GET "https://th-api.klaytnapi.com/v2/contract/ft?status=completed&type=kip&size=100&cursor=J9Ag...VM6z" \
--header "x-chain-id: {chain-id}" \
-u {access-key-id}:{secret-access-key}
const query = {
status: caver.kas.tokenHistory.queryOptions.status.COMPLETED,
size: 1,
type: caver.kas.tokenHistory.queryOptions.type.KIP7,
};
const result = await caver.kas.tokenHistory.getFTContractList(query);
TokenHistoryQueryOptions options = new TokenHistoryQueryOptions();
options.setStatus("completed");
options.setSize((long)1);
options.setType("KIP-7");
PageableFtContractDetails details = caver.kas.tokenHistory.getFTContractList(options);
System.out.println(details);
API Response
The list of FT contracts will be received as a response as follows if the request is successful.
{
"items": [
{
"address": "0x275f942985503d8ce9558f8377cc526a3aba3566",
"decimals": 18,
"link": {
"icon": "",
"website": ""
},
"name": "ProjectWITH",
"symbol": "WIKEN",
"totalSupply": "0x36afb02a36d33e82de40000",
"status": "completed",
"type": "erc",
"createdAt": 1593355639,
"updatedAt": 1593355639,
"deletedAt": 0
},
{
"address": "0x46f307b58bf05ff089ba23799fae0e518557f87c",
"decimals": 18,
"link": {
"icon": "",
"website": ""
},
"name": "Airbloc",
"symbol": "ABL",
"totalSupply": "0x134b7e13729b9d839f00000",
"status": "completed",
"type": "erc",
"createdAt": 1593355615,
"updatedAt": 1593355615,
"deletedAt": 0
},
...,
{
"address": "0xb1a7abe0c5a9e06cc7585a435e74976d2dee07f3",
"decimals": 2,
"link": {
"icon": "",
"website": ""
},
"name": "BlockchainPetToken",
"symbol": "BPT",
"totalSupply": "0x30141cb58",
"status": "completed",
"type": "kip",
"createdAt": 1593353416,
"updatedAt": 1593353416,
"deletedAt": 0
}
],
"cursor": ""
}
PageableFtContractDetails {
items: [
FtContractDetail {
address: '0x4a29e5f60090a75de0f62c6224e04e0f610ca4af',
decimals: 18,
name: 'KALE',
symbol: 'KAL',
status: 'completed',
totalSupply: '0x152d02c7e14af6800000',
createdAt: 1601020509,
updatedAt: 1601020509,
deletedAt: 0,
link: undefined,
type: 'KIP-7'
}
],
cursor: 'MBX6wNrK2QdWJp0xqG1XJp8zWxPwqVGLO0bYaAorYo3DgvpM0xVk5BwL9Zl1emRNB3RJdObWzAQq46PaNGE287rXKgZQdM2K4Dmke7E93B56NlvLg9zbDZeVv7o1POlA'
}
class PageableFtContractDetails {
items: [class FtContractDetail {
address: 0x4a29e5f60090a75de0f62c6224e04e0f610ca4af
decimals: 18
name: KALE
symbol: KAL
status: completed
totalSupply: 0x152d02c7e14af6800000
createdAt: 1601020509
updatedAt: 1601020509
deletedAt: 0
link: null
type: KIP-7
}]
cursor: MBX6wNrK2QdWJp0xqG1XJp8zWxPwqVGLO0bYaAorYo3DgvpM0xVk5BwL9Zl1emRNB3RJdObWzAQq46PaNGE287rXKgZQdM2K4Dmke7E93B56NlvLg9zbDZeVv7o1POlA
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.
Get FT Contract Information
Search for specific FT contract information.
FT contract is a type of smart contract deployed to Kaia that allows users to issue, delete, and send Fungible Token (Fungible Token, FT).
API Request
The following request searches for the information of an FT contract in the "0xbe7377db700664331beb28023cfbd46de079efac" address.
curl --location --request GET "https://th-api.klaytnapi.com/v2/contract/ft/0xbe7377db700664331beb28023cfbd46de079efac" \
--header "x-chain-id: {chain-id}" \
-u {access-key-id}:{secret-access-key}
const result = await caver.kas.tokenHistory.getFTContract(
"0x4a29e5f60090a75de0f62c6224e04e0f610ca4af"
);
String address = "0xa35fc8998eee155ec1a9a693f83c7d6c5a3ef927";
FtContractDetail contract = caver.kas.tokenHistory.getFTContract(address);
System.out.println(contract);
-
The
ft-address
(0xbe7377db700664331beb2...) is a required value that stands for the address of an FT contract to be searched.
API Response
The following response will be received if the request was successful.
{
"address": "0xbe7377db700664331beb28023cfbd46de079efac",
"decimals": 18,
"link": {
"icon": "",
"website": ""
},
"name": "Att",
"symbol": "att",
"totalSupply": "0x2863c1f5cdae42f9540000000",
"status": "completed",
"type": "erc",
"createdAt": 1593355554,
"updatedAt": 1593355554,
"deletedAt": 0
}
FtContractDetail {
address: '0x4a29e5f60090a75de0f62c6224e04e0f610ca4af',
decimals: 18,
name: 'KALE',
symbol: 'KAL',
status: 'completed',
totalSupply: '0x152d02c7e14af6800000',
createdAt: 1601020509,
updatedAt: 1601020509,
deletedAt: 0,
link: undefined,
type: 'KIP-7'
}
class FtContractDetail {
address: 0xa35fc8998eee155ec1a9a693f83c7d6c5a3ef927
decimals: 18
name: SummerToken
symbol: JUN
status: completed
totalSupply: 0x52b7d2dcc80cd2e4000000
createdAt: 0
updatedAt: 0
deletedAt: 0
link: null
type: KIP-7
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.
Get List of NFT Contract
Search the list of labeled NFT contracts.
NFT contract is a type of smart contract deployed to Kaia that allows users to issue, delete, and send Non-fungible Token (Non-Fungible Token, NFT).
Label is a marker put on a specific token contract by KAS for tracking its information. KAS only tracks labeled token contracts. This API requests for the list of labeled NFT contracts. For details about labeling, please visit here.
API Request
Search the list of labeled NFT contracts as follows.
Query Parameter
You can search for the list of FT contracts by specifying the labeling status and contract type. Also, you can receive API response values with Cursor-based Pagination.
Parameter | Description | Example | Required or Not |
---|---|---|---|
status | Labeling Status ["completed", "processing", "failed", "cancelled"] | status=completed |
False |
type | Type of contract (KIP standard: "kip", ERC standard: "erc", else: "") |
type=kip |
False |
size | the number of items in the API response (min=1, max=1000, default=100) | size=100 |
False |
cursor | the cursor required to get the next batch of response items | cursor=J9Ag...VM6z |
False |
curl --location --request GET "https://th-api.klaytnapi.com/v2/contract/nft?status=completed&type=kip&size=100&cursor=J9Ag...VM6z" \
--header "x-chain-id: {chain-id}" \
-u {access-key-id}:{secret-access-key}
const query = {
status: caver.kas.tokenHistory.queryOptions.status.COMPLETED,
size: 1,
type: caver.kas.tokenHistory.queryOptions.type.KIP17,
};
const result = await caver.kas.tokenHistory.getNFTContractList(query);
TokenHistoryQueryOptions options = new TokenHistoryQueryOptions();
options.setStatus("completed");
options.setSize((long)1);
options.setType("KIP-17");
PageableNftContractDetails details = caver.kas.tokenHistory.getNFTContractList(options);
System.out.println(details);
API Response
The list of NFT contracts will be received as a response as follows if the request is successful.
{
"items": [
{
"address": "0xc60e442725d3fe651cfab999e045409f94db9416",
"name": "MineralNFT",
"symbol": "FSI",
"totalSupply": "0x0",
"status": "completed",
"type": "kip",
"createdAt": 1598650844,
"updatedAt": 1598650844,
"deletedAt": 0
},
...,
{
"address": "0x1f49e1d2a4691e4514ae91bc3040767cf344ad82",
"name": "Klaytn Champ",
"symbol": "CHAMP",
"totalSupply": "0x49",
"status": "completed",
"type": "kip",
"createdAt": 1593353198,
"updatedAt": 1593353198,
"deletedAt": 0
}
],
"cursor": "MBX6wNrK2QdWJp0xqG1XJp8zWxPwqVGLO0bYaAorYo3DgvpM0xVk5BwL9Zl1emRNqyJdObWzAQq46PaNGE287rXKgZQdM2K4Dmke7E93B56NlvLg9zbDZeVv7o1POlAa"
}
PageableNftContractDetails {
items: [
NftContractDetail {
address: '0xb18e06e815ccbc9c0873b45df0a08c1ded175190',
name: 'KIP17',
symbol: 'KIP17',
totalSupply: '0x0',
createdAt: 1602137778,
updatedAt: 1602137778,
deletedAt: 0,
type: 'KIP-17',
status: 'completed'
}
],
cursor: '2MBxPQoJVOwp63erbdl3qxeoMJrb24Z19LG0pBEm1N4ZG052deEKBwQVarxMmoy5xBnkXg9DA63qPLJl7WpvbOz8YX7VadP5zvkDAWN8OQgwYK6Elzg97kLA8WK4XZ5D'
}
class PageableNftContractDetails {
items: [class NftContractDetail {
address: 0x1d15887950aa821814b793ed4a4cfa38937df5da
name: KIP17
symbol: KIP17
totalSupply: 0x0
createdAt: 1602495497
updatedAt: 1602495497
deletedAt: 0
type: KIP-17
status: completed
}]
cursor: owN0deEJPGMZ69Q3L5V34MAgJ5xpNmrQ9lWk0EDvxv7bkQq1aLX58AZz0GlgNEyd1kRwK94JBdVP6rm3eopO2DMWYz6BKoXPYbdOewaGqZ1728La7rbx8YDBgW2lkqAK
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.
Get NFT Contract Information
Search for specific NFT contract information.
NFT contract is a type of smart contract deployed to Kaia that allows users to issue, delete, and send Non-fungible Token (Non-Fungible Token, NFT).
API Request
The following request searches for the information of the NFT contract in the "0x90d535c434e967ec6e9accb0de5dcb34010865e0" address
curl --location --request GET "https://th-api.klaytnapi.com/v2/contract/nft/0x90d535c434e967ec6e9accb0de5dcb34010865e0" \
--header "x-chain-id: {chain-id}" \
-u {access-key-id}:{secret-access-key}
const result = await caver.kas.tokenHistory.getNFTContract(
"0xbbe63781168c9e67e7a8b112425aa84c479f39aa"
);
String addr = "0xbbe63781168c9e67e7a8b112425aa84c479f39aa";
NftContractDetail detail = caver.kas.tokenHistory.getNFTContract(addr);
System.out.println(detail);
-
nft-address
(0x90d535c434e967ec6e9acc...) is a required input value that stands for an address of the NFT contract to be searched.
API Response
The following response will be received if the request was successful.
{
"address": "0x90d535c434e967ec6e9accb0de5dcb34010865e0",
"name": "GET TICKET NFT V01",
"symbol": "GETticket NFT",
"totalSupply": "0x7",
"status": "completed",
"type": "kip",
"createdAt": 1597743588,
"updatedAt": 1597743588,
"deletedAt": 0
}
NftContractDetail {
address: '0xbbe63781168c9e67e7a8b112425aa84c479f39aa',
name: 'Jasmine',
symbol: 'JAS',
totalSupply: '0x36',
createdAt: 1599101533,
updatedAt: 1599101533,
deletedAt: 0,
type: 'KIP-17',
status: 'completed'
}
class PageableNftContractDetails {
items: [class NftContractDetail {
address: 0x1d15887950aa821814b793ed4a4cfa38937df5da
name: KIP17
symbol: KIP17
totalSupply: 0x0
createdAt: 1602495497
updatedAt: 1602495497
deletedAt: 0
type: KIP-17
status: completed
}]
cursor: owN0deEJPGMZ69Q3L5V34MAgJ5xpNmrQ9lWk0EDvxv7bkQq1aLX58AZz0GlgNEyd1kRwK94JBdVP6rm3eopO2DMWYz6BKoXPYbdOewaGqZ1728La7rbx8YDBgW2lkqAK
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.