KIP-7 API

Download OpenAPI specification:Download

Introduction

The KIP-7 API helps DApp (Decentralized Application) developers to manage contracts and tokens created in accordance with the KIP-7 standard, which is Kaia's technical speficication for Fungible Tokens. The functionality of the multiple endpoints enables you to do the following actions:

  • deploy smart contracts
  • manage the entire life cycle of an FT from minting, to sending and burning
  • get contract or token data
  • authorize a third party to execute token transfers
  • send tokens on behalf of the owner

For more details on KAS, please refer to KAS Docs. If you have any questions or comments, please leave them in the KAS Developers Forum.

alias

When a method of the KIP-17 API requires a contract address, you can use the contract alias. You can give the contract an alias when deploying, and use it in place of the complicated address.

deployer

When you create a contract, you will be assigned one deployer address per Credential, which is the account address used for managing contracts. In KIP-7 API, this address is used in many different token-related operations. You can find the deployer address with KIP7Deployer.

Even with contracts created using SDKs like "caver", you can still use the contract address and Wallet API account to manage your contracts and tokens.

Fee Payer Options

KAS KIP-17 supports four ways to pay the transaction fees.

1. Only using KAS Global FeePayer Account
Sends all transactions using KAS Global FeePayer Account.

{
    "options": {
      "enableGlobalFeePayer": true
    }
}

2. Using User FeePayer Account
Sends all transactions using User FeePayer Account.

{
  "options": {
    "enableGlobalFeePayer": false,
    "userFeePayer": {
      "krn": "krn:1001:wallet:20bab367-141b-439a-8b4c-ae8788b86316:feepayer-pool:default",
      "address": "0xd6905b98E4Ba43a24E842d2b66c1410173791cab"
    }
  }
}

3. Using both KAS Global FeePayer Account + User FeePayer Account
Sends transactions using User FeePayer Account by default, and switches to the KAS Global FeePayer Account when balances are insufficient.

{
  "options": {
    "enableGlobalFeePayer": true,
    "userFeePayer": {
      "krn": "krn:1001:wallet:20bab367-141b-439a-8b4c-ae8788b86316:feepayer-pool:default",
      "address": "0xd6905b98E4Ba43a24E842d2b66c1410173791cab"
    }
  }
}

4. Not using FeePayer Account
Sends transactions the default way, paying the transaction fee from the user's account.

{
  "options": {
    "enableGlobalFeePayer": false
  }
}

Authorization

A common error titled Unauthorized occurs regardless of API type if you have authorization issues.

401: Unauthorized

Code Message Description
1010009 invalid credential The credential you entered is invalid.

Authentication

basic

KAS uses Basic HTTP Auth. All requests must have a correct Authorization header. You can create the Credential for Basic Auth by using username as AccessKey ID and password as SecretAccessKey obtained on KAS Console.

NOTE

The KAS account credentials grant access to all services of KAS and own all rights to the Kaia account created by Wallet API, which means they can execute value transfer of assets on the Kaia account (such as KAIA) or a Transaction execution. To keep your KAS/Kaia account secure, do not share your KAS API Secret Access Key with others and manage it safely.

cURL

  curl --location --request GET 'https://kip7-api.klaytnapi.com/v1/contract' \
  -u ${your_accessKeyId}:${your_secretAccessKey} \
  --header 'x-chain-id: 1001' \
  --header 'Content-Type: application/json'
Security Scheme Type HTTP
HTTP Authorization Scheme basic