Getting Started
Get an access token
Exchange your client credentials for an access token using the OAuth 2.0 Client Credentials flow.
This endpoint lives on the Alvys authorization server (https://auth.alvys.com), not on the API host — the playground targets it directly. It takes no bearer token of its own; the credentials in the body are the authentication.
Accepts either application/json or application/x-www-form-urlencoded. Both return the same token and enforce scopes identically.
Create the Client ID and Secret in the Alvys Admin Portal under Admin → API Access. See Authentication for the full walkthrough and the scope catalog.
POST
/
oauth
/
token
Issue an access token
curl --request POST \
--url https://auth.alvys.com/oauth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"audience": "https://api.alvys.com/public/",
"grant_type": "client_credentials",
"scope": "load:read trip:read"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
audience: 'https://api.alvys.com/public/',
grant_type: 'client_credentials',
scope: 'load:read trip:read'
})
};
fetch('https://auth.alvys.com/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://auth.alvys.com/oauth/token"
payload = {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"audience": "https://api.alvys.com/public/",
"grant_type": "client_credentials",
"scope": "load:read trip:read"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://auth.alvys.com/oauth/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([
'client_id' => 'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_CLIENT_SECRET',
'audience' => 'https://api.alvys.com/public/',
'grant_type' => 'client_credentials',
'scope' => 'load:read trip:read'
]),
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://auth.alvys.com/oauth/token"
payload := strings.NewReader("{\n \"client_id\": \"YOUR_CLIENT_ID\",\n \"client_secret\": \"YOUR_CLIENT_SECRET\",\n \"audience\": \"https://api.alvys.com/public/\",\n \"grant_type\": \"client_credentials\",\n \"scope\": \"load:read trip:read\"\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://auth.alvys.com/oauth/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_id\": \"YOUR_CLIENT_ID\",\n \"client_secret\": \"YOUR_CLIENT_SECRET\",\n \"audience\": \"https://api.alvys.com/public/\",\n \"grant_type\": \"client_credentials\",\n \"scope\": \"load:read trip:read\"\n}")
.asString();{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "load:read trip:read"
}{
"error": "access_denied",
"error_description": "Unauthorized"
}{
"error": "access_denied",
"error_description": "Unauthorized"
}Use this page to get a token, then paste it into the Authorization field on any other endpoint in this reference to send authenticated requests.
Create your Client ID and Secret in the Alvys Admin Portal under Admin → API Access. Authentication covers the setup walkthrough and the scope catalog.
Tokens are valid for the
This endpoint is on the Alvys authorization server,
https://auth.alvys.com — not the API host. It is the one endpoint that takes no bearer token: the client_id and client_secret in the body are the authentication.Your Client Secret is a credential. Anything you type into the playground is sent to the live production authorization server, so use credentials you are willing to exercise — and never paste a secret into a shared screen or recording.
Using the token
The response’saccess_token goes on every Public API request:
Authorization: Bearer YOUR_ACCESS_TOKEN
expires_in window returned with them. Cache the token for that period rather than requesting a new one per call — the token endpoint is rate limited and will return 429 if you request one per API call.
The scope claim on the returned token lists what it may do, and the Public API enforces those scopes on every request. A token always carries every scope granted to your client application; see Available Scopes for the full list.Authorizations
Body
application/jsonapplication/x-www-form-urlencoded
Response
An access token for the Alvys Public API.
⌘I
Issue an access token
curl --request POST \
--url https://auth.alvys.com/oauth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"audience": "https://api.alvys.com/public/",
"grant_type": "client_credentials",
"scope": "load:read trip:read"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
audience: 'https://api.alvys.com/public/',
grant_type: 'client_credentials',
scope: 'load:read trip:read'
})
};
fetch('https://auth.alvys.com/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://auth.alvys.com/oauth/token"
payload = {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"audience": "https://api.alvys.com/public/",
"grant_type": "client_credentials",
"scope": "load:read trip:read"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://auth.alvys.com/oauth/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([
'client_id' => 'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_CLIENT_SECRET',
'audience' => 'https://api.alvys.com/public/',
'grant_type' => 'client_credentials',
'scope' => 'load:read trip:read'
]),
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://auth.alvys.com/oauth/token"
payload := strings.NewReader("{\n \"client_id\": \"YOUR_CLIENT_ID\",\n \"client_secret\": \"YOUR_CLIENT_SECRET\",\n \"audience\": \"https://api.alvys.com/public/\",\n \"grant_type\": \"client_credentials\",\n \"scope\": \"load:read trip:read\"\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://auth.alvys.com/oauth/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_id\": \"YOUR_CLIENT_ID\",\n \"client_secret\": \"YOUR_CLIENT_SECRET\",\n \"audience\": \"https://api.alvys.com/public/\",\n \"grant_type\": \"client_credentials\",\n \"scope\": \"load:read trip:read\"\n}")
.asString();{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "load:read trip:read"
}{
"error": "access_denied",
"error_description": "Unauthorized"
}{
"error": "access_denied",
"error_description": "Unauthorized"
}