Exchange keyId + secret for a Bearer token
curl --request POST \
--url https://{baasHost}/api/generate-token \
--header 'Content-Type: application/json' \
--data '
{
"keyId": "00000000-0000-4000-8000-000000000000",
"secret": "<your-api-secret>"
}
'import requests
url = "https://{baasHost}/api/generate-token"
payload = {
"keyId": "00000000-0000-4000-8000-000000000000",
"secret": "<your-api-secret>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({keyId: '00000000-0000-4000-8000-000000000000', secret: '<your-api-secret>'})
};
fetch('https://{baasHost}/api/generate-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://{baasHost}/api/generate-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([
'keyId' => '00000000-0000-4000-8000-000000000000',
'secret' => '<your-api-secret>'
]),
CURLOPT_HTTPHEADER => [
"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://{baasHost}/api/generate-token"
payload := strings.NewReader("{\n \"keyId\": \"00000000-0000-4000-8000-000000000000\",\n \"secret\": \"<your-api-secret>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{baasHost}/api/generate-token")
.header("Content-Type", "application/json")
.body("{\n \"keyId\": \"00000000-0000-4000-8000-000000000000\",\n \"secret\": \"<your-api-secret>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baasHost}/api/generate-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"keyId\": \"00000000-0000-4000-8000-000000000000\",\n \"secret\": \"<your-api-secret>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "eyJhbGciOi...",
"expiresAt": "2026-01-01T12:00:00.000Z",
"businessId": "2c0219b4-8c70-418d-9e9a-449e7b7643eb",
"environment": "sandbox",
"scopes": [
"wallet:*",
"lending:*",
"identity:*"
]
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Token expired or invalid"
}
}Auth
Exchange keyId + secret for a Bearer token
Returns a short-lived (~1h) JWT used as Authorization: Bearer <token> on all other calls. Each service (BaaS core and Collections gateway) issues its own token from its own key pair.
POST
/
generate-token
Exchange keyId + secret for a Bearer token
curl --request POST \
--url https://{baasHost}/api/generate-token \
--header 'Content-Type: application/json' \
--data '
{
"keyId": "00000000-0000-4000-8000-000000000000",
"secret": "<your-api-secret>"
}
'import requests
url = "https://{baasHost}/api/generate-token"
payload = {
"keyId": "00000000-0000-4000-8000-000000000000",
"secret": "<your-api-secret>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({keyId: '00000000-0000-4000-8000-000000000000', secret: '<your-api-secret>'})
};
fetch('https://{baasHost}/api/generate-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://{baasHost}/api/generate-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([
'keyId' => '00000000-0000-4000-8000-000000000000',
'secret' => '<your-api-secret>'
]),
CURLOPT_HTTPHEADER => [
"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://{baasHost}/api/generate-token"
payload := strings.NewReader("{\n \"keyId\": \"00000000-0000-4000-8000-000000000000\",\n \"secret\": \"<your-api-secret>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{baasHost}/api/generate-token")
.header("Content-Type", "application/json")
.body("{\n \"keyId\": \"00000000-0000-4000-8000-000000000000\",\n \"secret\": \"<your-api-secret>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baasHost}/api/generate-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"keyId\": \"00000000-0000-4000-8000-000000000000\",\n \"secret\": \"<your-api-secret>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "eyJhbGciOi...",
"expiresAt": "2026-01-01T12:00:00.000Z",
"businessId": "2c0219b4-8c70-418d-9e9a-449e7b7643eb",
"environment": "sandbox",
"scopes": [
"wallet:*",
"lending:*",
"identity:*"
]
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Token expired or invalid"
}
}