Exchange access key for JWT token
curl --request POST \
--url https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange \
--header 'Content-Type: application/json' \
--data '
{
"accessKey": "asd55asdasd55asdasd55asdsad"
}
'import requests
url = "https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange"
payload = { "accessKey": "asd55asdasd55asdasd55asdsad" }
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({accessKey: 'asd55asdasd55asdasd55asdsad'})
};
fetch('https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange', 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://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange",
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([
'accessKey' => 'asd55asdasd55asdasd55asdsad'
]),
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://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange"
payload := strings.NewReader("{\n \"accessKey\": \"asd55asdasd55asdasd55asdsad\"\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://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange")
.header("Content-Type", "application/json")
.body("{\n \"accessKey\": \"asd55asdasd55asdasd55asdsad\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange")
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 \"accessKey\": \"asd55asdasd55asdasd55asdsad\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"timestamp": "2026-01-12T09:10:12.337Z",
"message": "Success",
"data": {
"token": "306cbe25-73ae-4a12-8b47-78af5c3bcac5"
}
}{
"token": "306cbe25-73ae-4a12-8b47-78af5c3bcac5"
}API Authentication
Exchange access key for JWT token
POST
/
v1
/
tenants
/
access-key
/
exchange
Exchange access key for JWT token
curl --request POST \
--url https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange \
--header 'Content-Type: application/json' \
--data '
{
"accessKey": "asd55asdasd55asdasd55asdsad"
}
'import requests
url = "https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange"
payload = { "accessKey": "asd55asdasd55asdasd55asdsad" }
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({accessKey: 'asd55asdasd55asdasd55asdsad'})
};
fetch('https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange', 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://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange",
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([
'accessKey' => 'asd55asdasd55asdasd55asdsad'
]),
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://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange"
payload := strings.NewReader("{\n \"accessKey\": \"asd55asdasd55asdasd55asdsad\"\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://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange")
.header("Content-Type", "application/json")
.body("{\n \"accessKey\": \"asd55asdasd55asdasd55asdsad\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.us.aptlydone.com/auth/v1/tenants/access-key/exchange")
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 \"accessKey\": \"asd55asdasd55asdasd55asdsad\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"timestamp": "2026-01-12T09:10:12.337Z",
"message": "Success",
"data": {
"token": "306cbe25-73ae-4a12-8b47-78af5c3bcac5"
}
}{
"token": "306cbe25-73ae-4a12-8b47-78af5c3bcac5"
}The Aptly API uses JWT Bearer Tokens for Authentication. To generate a JWT Bearer Token for use with the Aptly API you must first create a M2M Access Key for your user inside your Aptly admin panel.
Please visit the following links to create your Access Key
Once you have your Access Key pass it as the accessKey property to receive your JWT Bearer Token for use in all other Aptly API endpoints.
Body
application/json
accessKey generated from the Aptly account
Example:
"asd55asdasd55asdasd55asdsad"
Was this page helpful?