This page introduces how to get transmission history of KLAY, FT, NFT with Token History API.
Before Getting Started
API introduced in here should only be used with HTTP Request.
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.
Get Token History by Preset
Preset
Preset is information required for KAS to get transfer record of 1 or more tokens. Once a preset is registered on KAS Console, KAS keeps monitoring transfer history of several tokens in the preset so that the transfer history can be loaded at once when you search it. EOA, FT contract address, and NFT contract address can be registered to the preset. This API searches token transfer record according to information in a preset.
FT contract is a type of smart contract deployed to Klaytn that allows users to issue, delete, and send Fungible Token (Fungible Token, FT). 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).
Presets must be registered on KAS console before using this API. Preset IDs of registered presets can be found on KAS console. For more details on how to create presets and check their IDs, refer to the following.
Preset Example 1: EOA
Here is an example of preset with only EOA registered.
If this API is called with only the preset is registered on KAS console, EOA (Klaytn account address) that is registered to the preset receives only KLAY/NFT/FT transfer record as an API response. For example, KLAY transfer history of KLAY Transmission Transaction that from or to is 0xd0ea3e0eabaea095ea3ba231c043dbf8c0feb40a or 0xa308064ad41e46310b7e463b610ae642a5007086 are received only as responses.
Here is an example of preset with only EOA registered.
Preset Example 2: FT Contract Address
Here is an example of preset with only FT contract address registered.
If this API is called with only the preset registered on KAS console, entire transfer history of FT token having 0x90d68ef8a262a4a54ed1632dd5a31afb4d35753d as its token contract address are received as responses.
Preset Example 3: EOA and FT Contract Address
Here is an example of preset with EOA and FT contract address registered.
If this API is called with only the preset registered on KAS console, entire transfer history of FT token (0x90d68ef8a262a4a54ed1632dd5a31afb4d35753d as its token contract address) that from or to is 0xd0ea3e0eabaea095ea3ba231c043dbf8c0feb40a are received as responses.
Preset Example 4: NFT Contract Address
NFT contract addresses can be stored in a preset as with FT contract addresses.
If this API is called with only the preset registered on KAS console, entire transfer history of NFT token having 0x90d68ef8a262a4a54ed1632dd5a31afb4d35753d as its token contract address are received as responses. NFT contract addresses can also be used together with EOA as shown in example 3.
All transactions are recorded in one blockchain and transfer details can be interpreted as transmission or reception according to sender (from) and receiver (to). Token History API stores blockchain transactions as transfer details and returns them in user-required formats.
API Request
Search token transfer history with the preset as follows.
Query Parameter
You can search transfer details by specifying type of transfer token, search range, response size, and a preset for searching. Also, you can receive API response values with Cursor-based Pagination.
Parameter
Description
Example
Required or Not
kind
[“klay”, “ft”, “nft”]
If no value was designated, use all 3 values
kind=klay or kind=klay,ft,nft
False
range
Search range (block number or unix time)
Block number should be hexadecimal, unix time should be 10 digit number
range=0x1,0x2 or range=1592360291,15991809920
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
“typeInt” variable is a value for identifying the transaction type.
For details about the types of transactions, please visit here.
For details about this API, please visit here.
For inquires about this document or KAS, please visit KAS Developer forum.
Get Token History by EOA
Search for the token transfer history of a specific EOA.
API Request
Search for the token transfer history based on the EOA as follows.
Query Parameter
Users can search for transfer details by specifying the type of transfer token, search range, response size, and contract addresses (ca-filter). Also, you can receive API response values with Cursor-based Pagination.
Parameter
Description
Example
Required or Not
kind
[“klay”, “ft”, “nft”]
If no value was designated, use all 3 values
kind=klay or kind=klay,ft,nft
False
range
Search range (block number or unix time)
Block number should be hexadecimal, unix time should be 10 digit number
range=0x1,0x2 or range=1592360291,15991809920
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