Get an access token
curl --request POST \
--url https://api-v3.aui.io/apollo-api/management/v1/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "publishable_key",
"publishable_key": "pk_network_..."
}
'import requests
url = "https://api-v3.aui.io/apollo-api/management/v1/auth/token"
payload = {
"grant_type": "publishable_key",
"publishable_key": "pk_network_..."
}
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({grant_type: 'publishable_key', publishable_key: 'pk_network_...'})
};
fetch('https://api-v3.aui.io/apollo-api/management/v1/auth/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://api-v3.aui.io/apollo-api/management/v1/auth/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([
'grant_type' => 'publishable_key',
'publishable_key' => 'pk_network_...'
]),
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://api-v3.aui.io/apollo-api/management/v1/auth/token"
payload := strings.NewReader("{\n \"grant_type\": \"publishable_key\",\n \"publishable_key\": \"pk_network_...\"\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://api-v3.aui.io/apollo-api/management/v1/auth/token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"publishable_key\",\n \"publishable_key\": \"pk_network_...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v3.aui.io/apollo-api/management/v1/auth/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 \"grant_type\": \"publishable_key\",\n \"publishable_key\": \"pk_network_...\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 123,
"token_type": "Bearer",
"agent_id": "<string>",
"organization_id": "<string>"
}Get an access token
Exchange a credential for a short-lived access token (OAuth 2.0, RFC 6749). Supported grant types: publishable_key. Refresh and other grants will be added on the same endpoint.
POST
/
management
/
v1
/
auth
/
token
Get an access token
curl --request POST \
--url https://api-v3.aui.io/apollo-api/management/v1/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "publishable_key",
"publishable_key": "pk_network_..."
}
'import requests
url = "https://api-v3.aui.io/apollo-api/management/v1/auth/token"
payload = {
"grant_type": "publishable_key",
"publishable_key": "pk_network_..."
}
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({grant_type: 'publishable_key', publishable_key: 'pk_network_...'})
};
fetch('https://api-v3.aui.io/apollo-api/management/v1/auth/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://api-v3.aui.io/apollo-api/management/v1/auth/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([
'grant_type' => 'publishable_key',
'publishable_key' => 'pk_network_...'
]),
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://api-v3.aui.io/apollo-api/management/v1/auth/token"
payload := strings.NewReader("{\n \"grant_type\": \"publishable_key\",\n \"publishable_key\": \"pk_network_...\"\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://api-v3.aui.io/apollo-api/management/v1/auth/token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"publishable_key\",\n \"publishable_key\": \"pk_network_...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v3.aui.io/apollo-api/management/v1/auth/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 \"grant_type\": \"publishable_key\",\n \"publishable_key\": \"pk_network_...\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 123,
"token_type": "Bearer",
"agent_id": "<string>",
"organization_id": "<string>"
}Body
application/json
The body is of type Body · object.
Response
Successful Response
Successful token response (RFC 6749 §5.1), extended with the agent and
organization behind the exchanged key. Send the token as
Authorization: Bearer <access_token>; agent_id is the agent your
messaging calls run against (null when the key carries no agent).
⌘I