Generate access token
1 min
auth
Use /auth endpoint by credentials to return a token and continue your process to initiate a payment.
POST
https://api-sandbox.klavi.ai/payment/customer/v1/auth
Body Parameters
- accessKeystringrequiredDescription
- secretKeystringrequiredDescription
Response
- accessTokenstringDescription
- expireAtnumberDescription
curl
curl --location 'https://api-sandbox.klavi.ai/payment/customer/v1/auth' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"accessKey":"string","secretKey":"string"}'nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api-sandbox.klavi.ai/payment/customer/v1/auth',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"accessKey": "string",
"secretKey": "string"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"accessKey": "string",
"secretKey": "string"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api-sandbox.klavi.ai/payment/customer/v1/auth", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
import json
url = "https://api-sandbox.klavi.ai/payment/customer/v1/auth"
payload = json.dumps({
"accessKey": "string",
"secretKey": "string"
})
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api-sandbox.klavi.ai/payment/customer/v1/auth")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"accessKey": "string",
"secretKey": "string"
})
response = https.request(request)
puts response.read_body
200
{
"accessToken": "1NiIsInR5cCI6IkpXVCJ9.TlUiXX1fQ.I7XIKNQxVdchh8Mkr6lV",
"expireAt": 1752053847
}