Download OpenAPI specification:Download
Node API helps DApp (Decentralized Application) developers to use the blockchain platform Kaia without having to run a node themselves. Normally using Kaia requires that you operate a Kaia Endpoint Node (KEN) with a hardware with high-spec computing power. With Node API, you can start using the Kaia platform without having to run a node. The functionality of the Node API endpoints enables you to do the following actions:
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.
A common error titled Unauthorized
occurs regardless of API type if you have authorization issues.
401: Unauthorized
Code | Message | Description |
---|---|---|
1010009 | The credential you provided does not match in our record | The credential you provided is invalid. |
1010007 | The path or method in request is invalid. Check the service API documentation and try again. | Path or method is wrong. |
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 POST 'https://node-api.klaytnapi.com/v1/klaytn' \
-u {{your_accessKeyId}}:{{your_secretAccessKey}} \
--header 'x-chain-id: 8217' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","method":"klay_blockNumber","params":[],"id":1}'
caver-js
const accessKeyId = "{{your_accessKeyId}}";
const secretAccessKey = "{{your_secretAccessKey}}";
const option = {
headers: [
{name: 'Authorization', value: 'Basic ' + Buffer.from(accessKeyId + ':' + secretAccessKey).toString('base64')},
{name: 'x-chain-id', value: '8217'},
]
}
const caver = new Caver(new Caver.providers.HttpProvider("https://node-api.klaytnapi.com/v1/klaytn", option))
caver-java
HttpService httpService = new HttpService("https://node-api.klaytnapi.com/v1/klaytn");
String auth = Credentials.basic("{{your_accessKeyId}}", "{{your_secretAccessKey}}", StandardCharsets.UTF_8);
httpService.addHeader("Authorization", auth);
httpService.addHeader("x-chain-id", "8217")
Caver caver = Caver.build(httpService);
Security Scheme Type | HTTP |
---|---|
HTTP Authorization Scheme | basic |