Auth Token
curl --request POST \
--url https://cra.pr.snh-ai.com/auth/token \
--header 'Content-Type: <content-type>' \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://cra.pr.snh-ai.com/auth/token"
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "<content-type>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': '<content-type>'}
};
fetch('https://cra.pr.snh-ai.com/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://cra.pr.snh-ai.com/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_HTTPHEADER => [
"Content-Type: <content-type>",
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cra.pr.snh-ai.com/auth/token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cra.pr.snh-ai.com/auth/token")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cra.pr.snh-ai.com/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = '<content-type>'
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "<string>",
"expires_in": 123
}Endpoints
Auth Token
Exchange an API key for a JWT bearer token
POST
/
auth
/
token
Auth Token
curl --request POST \
--url https://cra.pr.snh-ai.com/auth/token \
--header 'Content-Type: <content-type>' \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://cra.pr.snh-ai.com/auth/token"
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "<content-type>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': '<content-type>'}
};
fetch('https://cra.pr.snh-ai.com/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://cra.pr.snh-ai.com/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_HTTPHEADER => [
"Content-Type: <content-type>",
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cra.pr.snh-ai.com/auth/token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cra.pr.snh-ai.com/auth/token")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cra.pr.snh-ai.com/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = '<content-type>'
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "<string>",
"expires_in": 123
}Exchange your API key for a short-lived JWT token. Use this token in the
Authorization header for /evaluate.
Request
string
required
Your API key, provided during Account Setup. Format:
eval-api-key-<unique-hash>string
required
Must be
application/jsonResponse
string
required
JWT token to include in the
Authorization: Bearer header on subsequent requestsstring
required
Always
"bearer"integer
required
Token lifetime in seconds. Current environments return
3600 (1 hour). Always use this value rather than hard-coding a duration.Example Request
curl -X POST https://cra.pr.snh-ai.com/auth/token \
-H "X-API-Key: eval-api-key-YOUR_KEY" \
-H "Content-Type: application/json"
import requests
resp = requests.post(
"https://cra.pr.snh-ai.com/auth/token",
headers={"X-API-Key": "eval-api-key-YOUR_KEY"}
)
resp.raise_for_status()
token = resp.json()["access_token"]
const resp = await fetch("https://cra.pr.snh-ai.com/auth/token", {
method: "POST",
headers: { "X-API-Key": "eval-api-key-YOUR_KEY" }
});
const { access_token } = await resp.json();
Example Response
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"expires_in": 3600
}
Error Responses
401 — Missing API Key
{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing X-API-Key header.",
"request_id": "71adf7c7-2d74-4364-8990-5dd7d1dde2ae"
},
"timestamp": "2026-07-17T14:56:12.067742Z"
}
401 — Invalid API Key
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API key.",
"request_id": "b09ddb50-099d-4980-9af3-af6687a9bdbd"
},
"timestamp": "2026-07-17T14:56:12.425156Z"
}
Notes
- Read
expires_infrom the response (currently 3600 seconds / 1 hour). Request a new token before expiry. - Tokens cannot be refreshed or extended.
- Store tokens securely. Never expose API keys in client-side code.
Related
- Authentication — Full authentication guide with best practices
- Environments — Base URLs for staging and production
