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

{
	"access_token": "7ct9AUUCOnjdj577Iy2Ziu6pjWwLfl",
	"expires_in": 36000,
	"token_type": "Bearer",
	"scope": "read write",
	"refresh_token": "vUzXEA1WTvL7eAf9MAGfzFgXqyX6Gc"
}

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

{
	"access_token": "Eo4GmFh45V3Yk6AcChVrJtOU08AfpQ",
	"expires_in": 36000,
	"token_type": "Bearer",
	"scope": "read write",
	"refresh_token": "tcJLrF0alvLejLdoh9cCLSVAvlDg3a"
}

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

{
	"username": "your_username",
	"email": "your_email@gmail.com",
	"first_name": "",
	"last_name": "",
	"date_joined": "2020-09-28T06:00:23.745789Z",
	"last_login": "2020-09-28T06:00:37.622188Z",
	"wallet": {
		"balance": 0.0,
		"wallet_address": "0xc7849145419ee7d0f600Ae95A1C630FFB5287AFB"
	}
}

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

{
	"success":  [
		"Registration successful"
	]
}

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

{
	"active":  true,
	"scope":  "read write",
	"exp":  1601476131,
	"client_id":  "lJmS5wt6L0m9cU9Fd2zo37VOWg7dTf0YAiDWbCSS",
	"username":  "admin"
}

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

{
  "success": 
  [{
    “wallet_address”: "0xA158A517C587fF706B0c639388B1722b78538FDE", 
    “balance”: "720308601624999676960",
    “balance_display”: 720.3086016249997,
    “Nonce”: 11
  }]
}

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:

raw_tx = {
 "to": "0x772b965f2466A23370dB463d4E4fb25d84f1d72F",
 "value": 100000000000,
 "gas": 29000,
 "gasPrice": 1000000,
 "nonce": 12
}

Response:

Response contains the transaction hash if success or error message.

Sample response:

{
  "success": ["0xd5cf583b8d0fa47d8b320b14f63caf759f0cd1b6c3a297e0db837b9435f8a550"]
}

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 updated