KardiaID Service API
These are APIs that are used for the KardiaID Service (KAIBase).

Get request token

User requests access-token using username and password to KardiaID Service, and KardiaID Service return access-token information
Method: POST
Endpoint: /oauth2/token/
Headers: None
Body:
Field
Type
Description
client_id
string
Client ID received from KardiaID Service
client_secret
string
Client secret received from KardiaID Service
grant_type
string
Credential grant type. For this phase, should be set to password
username
string
username
password
string
password
Sample response
1
{
2
"access_token": "7ct9AUUCOnjdj577Iy2Ziu6pjWwLfl",
3
"expires_in": 36000,
4
"token_type": "Bearer",
5
"scope": "read write",
6
"refresh_token": "vUzXEA1WTvL7eAf9MAGfzFgXqyX6Gc"
7
}
8
Copied!

Refresh token

User needs to refresh access-token and KardiaID Service return with new fresh access-token
Method: POST
Endpoint: /oauth2/token/
Headers: None
Body:
Field
Type
Description
client_id
string
Client ID received from KardiaID Service
client_secret
string
Client secret received from KardiaID Service
grant_type
string
Credential grant type. To refresh token, set this field to refresh_token
refresh_token
string
User’s refresh token received from API Get request token
Sample response
1
{
2
"access_token": "Eo4GmFh45V3Yk6AcChVrJtOU08AfpQ",
3
"expires_in": 36000,
4
"token_type": "Bearer",
5
"scope": "read write",
6
"refresh_token": "tcJLrF0alvLejLdoh9cCLSVAvlDg3a"
7
}
8
Copied!

Get user data

Retrieving user’s information
Method: GET
Endpoint: /user/me/
Headers:
Field
Type
Description
Authorization
String (basic authentication)
Value should be Bearer <TOKEN>
Body: None
Sample response
1
{
2
"username": "your_username",
3
"email": "[email protected]",
4
"first_name": "",
5
"last_name": "",
6
"date_joined": "2020-09-28T06:00:23.745789Z",
7
"last_login": "2020-09-28T06:00:37.622188Z",
8
"wallet": {
9
"balance": 0.0,
10
"wallet_address": "0xc7849145419ee7d0f600Ae95A1C630FFB5287AFB"
11
}
12
}
Copied!

Register

User enters information during the registration process
Method: POST
Endpoint: /user/register/
Headers: None
Body:
Field
Type
Description
username
string
username
email
string
User’s email
password
string
User’s password
first_name
string
User’s first name
last_name
string
User’s last name
Sample response
1
{
2
"success": [
3
"Registration successful"
4
]
5
}
6
Copied!

Introspec token

Checks the validity of the access token, gets back user information and expiration date.
Method: GET
Endpoint: /oauth2/introspec/
Headers: None
Param:
Field
Type
Description
token
string
Access token to intro-spec
Sample response
1
{
2
"active": true,
3
"scope": "read write",
4
"exp": 1601476131,
5
"client_id": "lJmS5wt6L0m9cU9Fd2zo37VOWg7dTf0YAiDWbCSS",
6
"username": "admin"
7
}
8
9
Copied!

My wallet

Return mainnet wallet address.
Method: GET
Endpoint: /user/my-wallet
Headers:
Field
Type
Description
Authorization
String (basic authentication)
Value should be Bearer <TOKEN>
Body: None
Response:
Field
Type
Description
Wallet_address
Address string
Wallet address on mainnet
Balance
Balance in string
Wallet balance in small unit HYDRO (KAI * 10^18)
Balance_display
KAI balance in float point
KAI balance for easier display
Nonce
Account nonce in integer
Account nonce to send transactions
Sample response
1
{
2
"success":
3
[{
4
“wallet_address”: "0xA158A517C587fF706B0c639388B1722b78538FDE",
5
“balance”: "720308601624999676960",
6
“balance_display”: 720.3086016249997,
7
“Nonce”: 11
8
}]
9
}
Copied!

Send transaction

Send transaction to Kardia Mainnet, the endpoint requests Trusted Client Authentication. Transaction is signed with a user private key on KardiaID Service and pushed to Kardia mainnet.
Raw_tx contains fields of Kardia mainnet transactions, in JSON format.
Method: POST
Endpoint: /user/send-transaction
Headers:
Field
Type
Description
Authorization
String (basic authentication)
Value should be Bearer <TOKEN>
Sample request:
1
raw_tx = {
2
"to": "0x772b965f2466A23370dB463d4E4fb25d84f1d72F",
3
"value": 100000000000,
4
"gas": 29000,
5
"gasPrice": 1000000,
6
"nonce": 12
7
}
Copied!
Response:
Response contains the transaction hash if success or error message.
Sample response:
1
{
2
"success": ["0xd5cf583b8d0fa47d8b320b14f63caf759f0cd1b6c3a297e0db837b9435f8a550"]
3
}
4
5
Copied!

Password Reset

KardiaID Service sends an email password reset to user which contains password reset token.
Method: POST
Endpoint: /user/resetpassword/
Body
Field
Type
Description
email
string
User email

Password Reset Confirm

Reset user password to new provided password and emailed token.
Method: POST
Endpoint: /user/resetpassword/confirm/
Body:
Field
String
Description
password
string
new password
token
string
provided token from email
Last modified 4mo ago