Authentication
Client Login
Obtains a temporary access token using the apiKey and secretKey issued by Kravata during onboarding.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your API key. |
| secretKey | string | Yes | Your secret key. |
Response
| Field | Description |
|---|---|
| accessToken | Token to send as Authorization: Bearer <accessToken> in every other request. |
| expiresIn | Validity of the token, in seconds. When it expires, call this endpoint again. |
The Postman test script stores the token in the access_token collection variable automatically.
Production
In production, call https://partners-api.kravata.co/api/v1/client/token presenting your mTLS certificate:
curl -X POST https://partners-api.kravata.co/api/v1/client/token \
--cert client.crt --key client.key \
-H "Content-Type: application/json" \
-d '{"apiKey": "<apiKey>", "secretKey": "<secretKey>"}'
Request the certificate (client.crt) and private key (client.key) from your Kravata point of contact.
POST
/
api
/
v1
/
client
/
token
Client Login
curl --request POST \
--url https://test-api-kore.kravata.co/api/v1/client/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "{{api_key}}",
"secretKey": "{{secret_key}}"
}
'import requests
url = "https://test-api-kore.kravata.co/api/v1/client/token"
payload = {
"apiKey": "{{api_key}}",
"secretKey": "{{secret_key}}"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({apiKey: '{{api_key}}', secretKey: '{{secret_key}}'})
};
fetch('https://test-api-kore.kravata.co/api/v1/client/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test-api-kore.kravata.co/api/v1/client/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKey' => '{{api_key}}',
'secretKey' => '{{secret_key}}'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://test-api-kore.kravata.co/api/v1/client/token"
payload := strings.NewReader("{\n \"apiKey\": \"{{api_key}}\",\n \"secretKey\": \"{{secret_key}}\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://test-api-kore.kravata.co/api/v1/client/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"{{api_key}}\",\n \"secretKey\": \"{{secret_key}}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api-kore.kravata.co/api/v1/client/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKey\": \"{{api_key}}\",\n \"secretKey\": \"{{secret_key}}\"\n}"
response = http.request(request)
puts response.read_bodyClient Login
curl --request POST \
--url https://test-api-kore.kravata.co/api/v1/client/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "{{api_key}}",
"secretKey": "{{secret_key}}"
}
'import requests
url = "https://test-api-kore.kravata.co/api/v1/client/token"
payload = {
"apiKey": "{{api_key}}",
"secretKey": "{{secret_key}}"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({apiKey: '{{api_key}}', secretKey: '{{secret_key}}'})
};
fetch('https://test-api-kore.kravata.co/api/v1/client/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test-api-kore.kravata.co/api/v1/client/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKey' => '{{api_key}}',
'secretKey' => '{{secret_key}}'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://test-api-kore.kravata.co/api/v1/client/token"
payload := strings.NewReader("{\n \"apiKey\": \"{{api_key}}\",\n \"secretKey\": \"{{secret_key}}\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://test-api-kore.kravata.co/api/v1/client/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"{{api_key}}\",\n \"secretKey\": \"{{secret_key}}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api-kore.kravata.co/api/v1/client/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKey\": \"{{api_key}}\",\n \"secretKey\": \"{{secret_key}}\"\n}"
response = http.request(request)
puts response.read_body
