Create Klaytn Account

Please sign up and log in KAS, and receive an API authentication key to create a Klaytn account.

An API authentication key can be created on KAS Console > [Security] > [Credential] menu, and the authentication password (Secret AccessKey) and Authorization can only be checked once upon their creation. Therefore, it is necessary to copy or download Secret AccessKey and Authorization to a safe location for proper and safe management after its creation. Authorization (e.g., Basic S0FTS1A2WkRaSjh...), which can be checked after creating an authentication key, refers to a value encoded using the AccessKey ID and Secret AccessKey through the basic authentication method and used for the call header when calling APIs.

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.

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/Klaytn account.

info

For details about signing up, signing in, and getting API authentication key, please visit here.

API Request

When you have received your API authentication key, you could call the API that creates a Klaytn account with submitting this key in the API request header. If you already have created your own account pool in the KAS Console, you can call API and create a Klaytn account inside your custom account pool by specifying the KRN of your account pool as x-krn parameter in the API Request header. For details about using account pool and x-krn parameter, please visit here.

After creating an account pool in the KAS Console, call the Klaytn account creation API as follows. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

info

KAS also provides a default account pool when you call the API with account pool.
Account pool must be created first to use and manage personal account pool instead of using the default account pool.

  • 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
cURLJavaScriptJava
Copy
Copied
//Example of using the default account pool that KAS automatically generates for you. In this case, you can skip x-krn parameter.
curl --location --request POST "https://wallet-api.klaytnapi.com/v2/account" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}"

//Example of using your custom account pool that you have created in KAS Console. In this case, you should submit the KRN value of your account pool with x-krn parameter.
//Note that the account pool you first created in KAS Console is also designated as the default account pool, which is automatically selected when calling KAS API when you haven't specified x-krn parameter.
curl --location --request POST "https://wallet-api.klaytnapi.com/v2/account" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}"
--header "x-krn: krn:1001:wallet:6698d79e-78ee-439a-815d-f293ec6ae736:account-pool:ap1"
Copy
Copied
const result = await caver.kas.wallet.createAccount();
Copy
Copied
Account account = caver.kas.wallet.createAccount();
System.out.println(account);

API Response

Here is a response of the Klaytn account creation API.

cURLJavaScriptJava
Copy
Copied
//Example API response when you have created a Klaytn account in the default account pool.
{
  "address": "0xa809284C83b901eD106Aba4Ccda14628Af128e14",
  "chainId": 1001,
  "createdAt": 1599187293,
  "keyId": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default:0x4cbbcb974e32a7960e1b356edf60087613101919ed83199f12e872cba068a50f",
  "krn": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default",
  "publicKey": "0x04cdccfb99b2905561e3dd886687b429a004718f11b04914f17ce68fd3a0db46c598a45da85caa61fe84cb78a0f2eaa9983ec7b8805a93ef9428eb1350a8558237",
  "updatedAt": 1599187293
}

//Example API response when you have created a Klaytn account in your own account pool.
{
  "address": "0xa809284C83b901eD106Aba4Ccda14628Af128e14",
  "chainId": 1001,
  "createdAt": 1599187293,
  "keyId": "krn:1001:wallet:6698d79e-78ee-439a-815d-f293ec6ae736:account-pool:ap1:0x4cbbcb974e32a7960e1b356edf60087613101919ed83199f12e872cba068a50f",
  "krn": "krn:1001:wallet:6698d79e-78ee-439a-815d-f293ec6ae736:account-pool:ap1",
  "publicKey": "0x04cdccfb99b2905561e3dd886687b429a004718f11b04914f17ce68fd3a0db46c598a45da85caa61fe84cb78a0f2eaa9983ec7b8805a93ef9428eb1350a8558237",
  "updatedAt": 1599187293
}
Copy
Copied
Account {
  address: '0xC42cF87D75d3233de424cD68B0B6fE381aD83E98',
  chainId: 1001,
  createdAt: 1601876981,
  keyId: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default:0x199647191a710a38496ed645eeec3b82d980dd635eebe236464ebc3c28f2d841',
  krn: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default',
  publicKey: '0x04f86e01d9ec2f80cf47594c342aa1151a5b9cf95c3d0b8ba8613afa531ebdf7fe4b7c49c2b0d25be6491fe53b92bbb40f23f1f830ca50708f8fe2775f24e9c4ce',
  updatedAt: 1601876981
}
Copy
Copied
class Account {
    address: 0xE8785620772e6d5cddB4C71808C0EcF2FDEB4079
    chainId: 1001
    createdAt: 1602120333
    keyId: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool:0xa7b69c64336b0bc63481569cd81edaee81d61b35b4511d954dc534651eca75a3
    krn: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool
    publicKey: 0x04c5d9f0da5f39dcfb10fc386ce33853f6fbe0b75854433fd48af63af11ed889026d5b4f254637d21d8c03f9072065144529c0a54a36ed757b1893bad670d7dd0c
    updatedAt: 1602120333
    multiSigKeys: null
    threshold: null
}

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.

Get Information of a Klaytn Account

Klaytn account search API is used for searching for the information of a created Klaytn account.

API Request

Enter the address of account (EOA), and then call the Klaytn account search API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

  • 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

An API authentication key can be created on KAS Console > [Security] > [Credential] menu, and the authentication password (Secret AccessKey) and Authorization can only be checked once upon their creation. Therefore, it is necessary to copy or download Secret AccessKey and Authorization to a safe location for proper and safe management after its creation. Authorization (e.g., Basic S0FTS1A2WkRaSjh...), which can be checked after creating an authentication key, refers to a value encoded using the AccessKey ID and Secret AccessKey through the basic authentication method and used for the call header when calling APIs.

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.

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/Klaytn account.

cURLJavaScriptJava
Copy
Copied
curl --location --request GET "https://wallet-api.klaytnapi.com/v2/account/0xa809284C83b901eD106Aba4Ccda14628Af128e14" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}"
Copy
Copied
const result = await caver.kas.wallet.getAccount(
  "0xC42cF87D75d3233de424cD68B0B6fE381aD83E98"
);
Copy
Copied
Account account = caver.kas.wallet.getAccount("0xbdd1A483f9058B364f892D3C9Af2c63382785EEa");
System.out.println(account);

API Response

Here is a response of the Klaytn account search API.

cURLJavaScriptJava
Copy
Copied
{
  "address": "0xa809284C83b901eD106Aba4Ccda14628Af128e14",
  "chainId": 1001,
  "createdAt": 1599187293,
  "keyId": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default:0x4cbbcb974e32a7960e1b356edf60087613101919ed83199f12e872cba068a50f",
  "krn": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default",
  "publicKey": "0x04cdccfb99b2905561e3dd886687b429a004718f11b04914f17ce68fd3a0db46c598a45da85caa61fe84cb78a0f2eaa9983ec7b8805a93ef9428eb1350a8558237",
  "updatedAt": 1599187293
}
Copy
Copied
Account {
  address: '0xC42cF87D75d3233de424cD68B0B6fE381aD83E98',
  chainId: 1001,
  createdAt: 1601876981,
  keyId: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default:0x199647191a710a38496ed645eeec3b82d980dd635eebe236464ebc3c28f2d841',
  krn: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default',
  publicKey: '0x04f86e01d9ec2f80cf47594c342aa1151a5b9cf95c3d0b8ba8613afa531ebdf7fe4b7c49c2b0d25be6491fe53b92bbb40f23f1f830ca50708f8fe2775f24e9c4ce',
  updatedAt: 1601876981
}
Copy
Copied
class Account {
    address: 0xbdd1A483f9058B364f892D3C9Af2c63382785EEa
    chainId: 1001
    createdAt: 1602122561
    keyId: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool:0x119c90315df9bb00901db6b768c32a450decaa1da7387f27686cdcfc350bddc2
    krn: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool
    publicKey: 0x043cd09ea024668a4a09f729a3772da10ac5139a7ac1fb624090283d7de81a885530bb42336b3142051e7b82f8305a77f876f13568c2c9a0ca4fd901b9be5f7913
    updatedAt: 1602122561
    multiSigKeys: null
    threshold: null
}

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.

Get List of Klaytn Accounts

Klaytn account list search API is used for looking for created Klaytn account lists.

API Request

Call the Klaytn account list search API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

  • 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

An API authentication key can be created on KAS Console > [Security] > [Credential] menu, and the authentication password (Secret AccessKey) and Authorization can only be checked once upon their creation. Therefore, it is necessary to copy or download Secret AccessKey and Authorization to a safe location for proper and safe management after its creation. Authorization (e.g., Basic S0FTS1A2WkRaSjh...), which can be checked after creating an authentication key, refers to a value encoded using the AccessKey ID and Secret AccessKey through the basic authentication method and used for the call header when calling APIs.

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.

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/Klaytn account.

  • Query Parameter You can receive API response values with cursor-based pagination . The search range can also be set by second.
Parameter Description Example Required or Not
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
to-timestamp Search range: The last timestamp (sec) to-timestamp=15921809920 False
from-timestamp Search range: The first timestamp (sec) from-timestamp=1592360291 False
cURLJavaScriptJava
Copy
Copied
curl --location --request GET "https://wallet-api.klaytnapi.com/v2/account?&size=100&cursor=&from-timestamp=1592360291&to-timestamp=15991809920" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}"
Copy
Copied
const query = caver.kas.wallet.queryOptions.constructFromObject({
  fromTimestamp: 1501576981,
  toTimestamp: 1601876982,
  size: 3,
  cursor: "",
});
const result = await caver.kas.wallet.getAccountList(query);
Copy
Copied
WalletQueryOptions options = new WalletQueryOptions();
options.setSize((long)5);
options.setFromTimestamp((long)1599187200);
options.setToTimestamp((long)1599187200);

Accounts accounts = caver.kas.wallet.getAccountList(options);
System.out.println(accounts);

API Response

Here is the response of the Klaytn account list search API.

cURLJavaScriptJava
Copy
Copied
{
  "cursor": "",
  "items": [
    {
      "address": "0xa809284C83b901eD106Aba4Ccda14628Af128e14",
      "chainId": 1001,
      "createdAt": 1599187293,
      "keyId": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default:0x4cbbcb974e32a7960e1b356edf60087613101919ed83199f12e872cba068a50f",
      "krn": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default",
      "publicKey": "0x04cdccfb99b2905561e3dd886687b429a004718f11b04914f17ce68fd3a0db46c598a45da85caa61fe84cb78a0f2eaa9983ec7b8805a93ef9428eb1350a8558237",
      "updatedAt": 1599187293
    },
    {
      "address": "0x78B123CCCCd50f41E3192a60e6ED92B15E21b1B5",
      "chainId": 1001,
      "createdAt": 1599187194,
      "keyId": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default:0x6c4419647e7724853f9e50b0c54b5985d0870470ac37b3ef865e62c3ccfa4ea4",
      "krn": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default",
      "publicKey": "0x0463cc38f08dd15dfd416966e9d0da93942e26d2a9a9bcac08d614f487f94a7e46e4418d1acda9e21706f19c917486de40c974eb20c12a2eca2eea91895499d379",
      "updatedAt": 1599187194
    },
   ...
   ,
    {
      "address": "0x7ec5169EA28B2e3fFEF143a3513D7eC1CeFF2cB4",
      "chainId": 1001,
      "createdAt": 1599187161,
      "keyId": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default:0xd3ee56e2616c8d412918e7f0e9222c805aacf5bad6d84b70b83c2229d61f21c9",
      "krn": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default",
      "publicKey": "0x043ccf257d2ad3f8c3b2128969302efc6bf59d8cd8e578bcfdac8a4ac9cea6d4747350c98edaec5d23fafa9b3288a3b45816d2e9b3bb28443cc2486ad6bca652f1",
      "updatedAt": 1599187161
    }
  ]
}
Copy
Copied
Accounts {
  cursor: 'eyJBZGRyZXNzIjoia3JuOjEwMDE6d2FsbGV0OjhlNzZkMDAzLWQ2ZGQtNDI3OC04ZDA1LTUxNzJkOGYwMTBjYTphY2NvdW50LXBvb2w6ZGVmYXVsdDoweERhNTVlMDQyMDI5MDI3MzM4MzcyNDY4MzZBQTM2MDBDNjY3Rjc1YWUiLCJUeXBlIjoiQUNDIiwiY3JlYXRlZF9hdCI6MTYwMTI4MjM5NSwicnBuIjoia3JuOjEwMDE6d2FsbGV0OjhlNzZkMDAzLWQ2ZGQtNDI3OC04ZDA1LTUxNzJkOGYwMTBjYTphY2NvdW50LXBvb2w6ZGVmYXVsdCJ9',
  items: [
    Account {
      address: '0xC42cF87D75d3233de424cD68B0B6fE381aD83E98',
      chainId: 1001,
      createdAt: 1601876981,
      keyId: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default:0x199647191a710a38496ed645eeec3b82d980dd635eebe236464ebc3c28f2d841',
      krn: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default',
      publicKey: '0x04f86e01d9ec2f80cf47594c342aa1151a5b9cf95c3d0b8ba8613afa531ebdf7fe4b7c49c2b0d25be6491fe53b92bbb40f23f1f830ca50708f8fe2775f24e9c4ce',
      updatedAt: 1601876981
    },
    ... ,
    Account {
      address: '0xDa55e04202902733837246836AA3600C667F75ae',
      chainId: 1001,
      createdAt: 1601282395,
      keyId: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default:0x3f44e68b980e5781e1b162587d574ae24ef2d839caab57a6e5ccb78410508703',
      krn: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default',
      publicKey: '0x04986f2695ff5ef75d074e8c43c5ee7ffe06bd43829e78012621192d84cbb0ccb827fa714af1521ea0a17b2b8368daa8e4d6fd06f67f5c133819fb0ef09050dfe3',
      updatedAt: 1601282395
    }
  ]
}
Copy
Copied
class Accounts {
    cursor: eyJBZGRyZXNzIjoia3JuOjEwMDE6d2FsbGV0OmQ1YzM0NmY1LWJiODAtNGY0NS05MDkzLTU3ZTI1MjA1Y2RjODphY2NvdW50LXBvb2w6cG9vbDoweEExYmFkNWU0Mzk2OUVFMTQ5Q0UzRDRjQjQ4RGY5QThjYjEyQUY4ODciLCJUeXBlIjoiQUNDIiwiY3JlYXRlZF9hdCI6MTYwMTAyMDc1OCwicnBuIjoia3JuOjEwMDE6d2FsbGV0OmQ1YzM0NmY1LWJiODAtNGY0NS05MDkzLTU3ZTI1MjA1Y2RjODphY2NvdW50LXBvb2w6cG9vbCJ9
    items: [class Account {
        address: 0x416cAe65ba2BcccCa4d7Cc3bc31FF61b9C60bA97
        chainId: 1001
        createdAt: 1601282275
        keyId: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool:0x95494c8010aa3a70d3f13c2ef9ab8b3880ee2fa5cdda4ffbb548b9a486eb2cb0
        krn: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool
        publicKey: 0x04cc7465b66f7496886dff8c0565247633fab72994d2a6f91fe8e9ebfe7bfd597f4aaab777ebc831b331c186641517625857c8eaa8eca3357eaf72caeff4f0bce7
        updatedAt: 1601282275
        multiSigKeys: null
        threshold: null
    }, class Account {
        address: 0x2005f6B0bE729c9050bDa3650cdfd9497564CD71
        chainId: 1001
        createdAt: 1601020759
        keyId: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool:0x570d8faf589d62a90be90870545028ec607d1adfa744a570ae9c36f91637df62
        krn: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool
        publicKey: 0x042fce35af923d12e91a34e9b47b4568314d41f891d6214789dd399a186b708a228af94fb0f92b279df9987c94cbd417f022b72b5b38614abe6c1ad66038baa5f0
        updatedAt: 1601020759
        multiSigKeys: null
        threshold: null
    },
    .....
    class Account {
        address: 0xA1bad5e43969EE149CE3D4cB48Df9A8cb12AF887
        chainId: 1001
        createdAt: 1601020758
        keyId: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool:0x11886da5d3899c32aae4e87fdf413fbcea7204096b5c273174453d4f80091d8a
        krn: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool
        publicKey: 0x04d06c1f9a170c830008752a9085ae4df45068402a7561cb280ae6ba8d69f2a843d4e7f2fd2d00bba7d2f8ffd3ee8265712f0f3672818dbe1196aaeeb8cb376a2d
        updatedAt: 1601020758
        multiSigKeys: null
        threshold: null
    }]
}

It can be difficult to import all the data when loading the data by calling the KAS API. The API is called several times to load the specified number of data by batch, in which data is generally called by the page. Thus, it is called pagination. Read this for more information.

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.