Transmission History

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.

{
    "addresses": [
        "0xd0ea3e0eabaea095ea3ba231c043dbf8c0feb40a", 
        "0xa308064ad41e46310b7e463b610ae642a5007086"
    ]
}

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.

{
    "ftContractAddresses": [
        "0x90d68ef8a262a4a54ed1632dd5a31afb4d35753d"
    ]

}

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.

{
    "addresses": [
        "0xd0ea3e0eabaea095ea3ba231c043dbf8c0feb40a"
    ],
    "ftContractAddresses":[
        "0x90d68ef8a262a4a54ed1632dd5a31afb4d35753d"
    ]
}

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.

{
    "nftContractAddresses": [
        "0x462e90a68328662163189c3b35fafeea3f6b29e8"
    ]
}

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

cursor=J9Ag...VM6z

False

presets

Preset IDs to be used for searching

presets=65,68

True

curl --location --request GET "https://th-api.klaytnapi.com/v2/transfer?kind=klay,ft,nft&presets=65,68&range=1592360291,15991809920" \
    --header "x-chain-id: {chain-id}" \
    -u {access-key-id}:{secret-access-key}

API Response

The following response will be received if the request was successful.

{
    "items": [
        {
            "transferType": "klay",
            "from": "0xfee21dec2936f4cf7714080559db1c53ce639e07",
            "fee": "0x2114b6e5980400",
            "status": 1,
            "to": "0xe33337cb6fbb68954fe1c3fde2b21f56586632cd",
            "transactionHash": "0xa0f6663d713bf173e9e2563f588ab11dc09df34970ae60c5e7bf5c383a8bc17c",
            "transactionIndex": 0,
            "typeInt": 48,
            "timestamp": 1596025548,
            "value": "0x218ae196b8d4f300000",
            "feePayer": "",
            "feeRatio": 10
        },
        {
            "transferType": "klay",
            "from": "0xe83d131a941b767594262f1e7d635260b2facc61",
            "fee": "0x2c0dbbfb37000",
            "status": 1,
            "to": "0xfee21dec2936f4cf7714080559db1c53ce639e07",
            "transactionHash": "0x61f1e0b317b0bbb2d29a58c1791b8290210188b5422f53b135f3cbb993140876",
            "transactionIndex": 0,
            "typeInt": 9,
            "timestamp": 1596025448,
            "value": "0x218ae3cf27fbef10000",
            "feePayer": "0x10f0eaa52a474f0605afbb8c17bb9189e6ed006c",
            "feeRatio": 10
        }
    ],
    "cursor": ""
}

“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 Transaction Hash

Search the history of the token transfer with the transaction hash if there is a transaction hash value that has sent a token.

API Request

Search for the token transfer history based on the token hash as follows.

curl --location --request GET "https://th-api.klaytnapi.com/v2/transfer/tx/0x9fb236689b26fc8b8a938a8eb2b7e5a6afc1c7a837c61751f08eac7358db8d73" \
    --header "x-chain-id: {chain-id}" \
    -u {access-key-id}:{secret-access-key}
  • transaction-hash(0x9fb236689b2...ac7358db8d73) is a reuired input value and a 32-byte hash of transaction in the block.

API Response

The following response will be received if the request was successful.

{
    "items": [
        {
            "transferType": "ft",
            "transaction": {
                "from": "0x5bf30ff4a1a3a905531c5e1b52c635892a9fc28d",
                "fee": "0x48abe561cf400",
                "transactionHash": "0x9fb236689b26fc8b8a938a8eb2b7e5a6afc1c7a837c61751f08eac7358db8d73",
                "typeInt": 49,
                "timestamp": 1597649114,
                "value": "0x0",
                "feePayer": "0xacb22916b804ac088c61c8711ec196b518f2e7fc",
                "feeRatio": 10
            },
            "contract": {
                "address": "0xb1a7abe0c5a9e06cc7585a435e74976d2dee07f3",
                "name": "BlockchainPetToken",
                "symbol": "BPT",
                "decimals": 2
            },
            "from": "0x5bf30ff4a1a3a905531c5e1b52c635892a9fc28d",
            "to": "0xeb7f7926cc4f866cec135728d35a7531c1d12791",
            "value": "0x3e8",
            "formattedValue": "10"
        },
        {
            "transferType": "klay",
            "from": "0x5bf30ff4a1a3a905531c5e1b52c635892a9fc28d",
            "fee": "0x48abe561cf400",
            "status": 1,
            "to": "0xb1a7abe0c5a9e06cc7585a435e74976d2dee07f3",
            "transactionHash": "0x9fb236689b26fc8b8a938a8eb2b7e5a6afc1c7a837c61751f08eac7358db8d73",
            "transactionIndex": 1,
            "typeInt": 49,
            "timestamp": 1597649114,
            "value": "0x0",
            "feePayer": "0xacb22916b804ac088c61c8711ec196b518f2e7fc",
            "feeRatio": 10
        }
    ]
}

“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

cursor=J9Ag...VM6z

False

ca-filter

FT or NFT contract address to be searched

ca-filter=0xc756...1118

False

curl --location --request GET "https://th-api.klaytnapi.com/v2/transfer/account/0xc060632ad88d0dec2bbc44bbea9d4c48c2ead48f?kind=klay,ft,nft&range=1592360291,15991809920" \
    --header "x-chain-id: {chain-id}" \
    -u {access-key-id}:{secret-access-key}
  • address is the EOA used to search and a required input value.

  • In the example of API call, “0xc060...d48f” is a random value.

API Response

The following response will be received if the request was successful.

{
    "items": [
        {
            "transferType": "klay",
            "from": "0xc060632ad88d0dec2bbc44bbea9d4c48c2ead48f",
            "fee": "0x6b7cf1b09bc00",
            "status": 1,
            "to": "0xd07453030abc0e37ee81371e2505bf55e0be6440",
            "transactionHash": "0x8771b0bbf25c19dc0d4be3e4a536830a26f4a06e129b34f49b4ac765bf9d6185",
            "transactionIndex": 3,
            "typeInt": 48,
            "timestamp": 1598855708,
            "value": "0x0",
            "feePayer": "",
            "feeRatio": 10
        },
        {
            "transferType": "ft",
            "transaction": {
                "from": "0xc060632ad88d0dec2bbc44bbea9d4c48c2ead48f",
                "fee": "0x6b7cf1b09bc00",
                "transactionHash": "0x8d9c23f2a9381243062b5f5b15f9d4793942bc74d7f6a3ac9bbb294e693c1540",
                "typeInt": 48,
                "timestamp": 1582622881,
                "value": "0x0",
                "feePayer": "",
                "feeRatio": 10
            },
            "contract": {
                "address": "0x46f307b58bf05ff089ba23799fae0e518557f87c",
                "name": "Airbloc",
                "symbol": "ABL",
                "decimals": 18
            },
            "from": "0xd07453030abc0e37ee81371e2505bf55e0be6440",
            "to": "0xc060632ad88d0dec2bbc44bbea9d4c48c2ead48f",
            "value": "0xde0b6b3a7640000",
            "formattedValue": "1"
        },
        ...
        ,
        {
            "transferType": "klay",
            "from": "0xc060632ad88d0dec2bbc44bbea9d4c48c2ead48f",
            "fee": "0x449e582f0cc00",
            "status": 1,
            "to": "0xd07453030abc0e37ee81371e2505bf55e0be6440",
            "transactionHash": "0xc93453af98297b953afb34f8aed92ae2acc3d96cd5291e9fc43bfea1fedfc076",
            "transactionIndex": 0,
            "typeInt": 0,
            "timestamp": 1582254900,
            "value": "0x0",
            "feePayer": "",
            "feeRatio": 10
        }
    ],
    "cursor": "18G42d0gY531Z2pzqEVrDWMLmQ9kz2epXE8JZwadKGrOqW3oVRxN6PAJX73aKMgTKW6LBZJe2OvvT2nDL6Pxgb9m4YQv5AM0NlB17ePxoOK8vk74wbG6NaBAJlX309vK"
}

“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.

Last updated