Skip to main content

API Key Authentication

This guide explains how to authenticate with the Audian API using an API Key, obtain an auth token and account ID, and use them to call other endpoints.

Overview​

Audian's API supports API Key authentication via a token exchange. You send your API key to the authentication endpoint, receive a short-lived auth token and your account ID, and then include the token in subsequent requests using the X-Auth-Token header.

Quick Flow
  1. Exchange API key → 2. Receive auth_token and account_id → 3. Call APIs with X-Auth-Token header and your account_id in the path

Authenticate with API Key​

Endpoint​

PUT https://api.audian.com:8443/v2/api_auth

Request Body​

{
"data": {
"api_key": "YOUR_API_KEY"
}
}

Example Request​

curl -X PUT https://api.audian.com:8443/v2/api_auth \
-H "Content-Type: application/json" \
-d '{
"data": {
"api_key": "YOUR_API_KEY"
}
}'

Successful Response​

{
"page_size": 1,
"version": "5.4.32.6",
"auth_token": "eyJhbGciOiJSUzI1.........",
"tokens": { "consumed": 0, "remaining": 100 },
"timestamp": "2026-02-04T18:45:54Z",
"request_id": "...",
"node": "-PHinZhx0i3Je_5o-j3-FA",
"metadata": {},
"data": {
"account_id": "your_account_id_here"
},
"revision": "automatic",
"status": "success"
}
Important

From this response, capture both auth_token and data.account_id. You will need both for subsequent API calls.

Use the Auth Token​

Include the token in the X-Auth-Token header on every request after authentication.

X-Auth-Token: eyJhbGciOiJSUzI1.........

Example: List Users​

Endpoint​

GET https://api.audian.com:8443/v2/accounts/{account_id}/users?paginate=false

Sample Request​

curl -X GET \
"https://api.audian.com:8443/v2/accounts/${ACCOUNT_ID}/users?paginate=false" \
-H "X-Auth-Token: ${AUTH_TOKEN}" \
-H "Accept: application/json"

Example: Get Account Details​

curl -X GET \
"https://api.audian.com:8443/v2/accounts/${ACCOUNT_ID}" \
-H "X-Auth-Token: ${AUTH_TOKEN}" \
-H "Accept: application/json"

Getting Your API Key​

  1. Log in to my.audian.com
  2. Navigate to Settings → API Keys
  3. Click Create New API Key
  4. Copy and store the key securely
warning

API keys are shown only once. Store them securely - you cannot retrieve them later.

Security Best Practices​

Storage​

Do:

# Store in environment variable
export AUDIAN_API_KEY="your_api_key_here"

# Store in .env file (NEVER commit to git)
AUDIAN_API_KEY=your_api_key_here

Don't:

# DON'T hardcode keys
API_KEY = "your_api_key_here" # Bad!

# DON'T log keys
print(f"Using key: {api_key}") # Bad!

Key Rotation​

Rotate your API keys regularly:

  • Production Keys: Every 90 days
  • Compromised Keys: Immediately

Troubleshooting​

Invalid API Key​

If you receive an authentication error:

  • Verify the API key is correct
  • Check that the key hasn't been revoked
  • Ensure you're using the correct endpoint (/v2/api_auth)

Token Expired​

Auth tokens are short-lived. If you receive a token expiration error:

  1. Re-authenticate with your API key
  2. Use the new auth_token for subsequent requests

Missing Account ID​

Always extract the account_id from the authentication response. Many endpoints require it in the URL path:

/v2/accounts/{account_id}/...

Complete Authentication Flow Example​

#!/bin/bash

# Step 1: Authenticate and get token + account_id
RESPONSE=$(curl -s -X PUT https://api.audian.com:8443/v2/api_auth \
-H "Content-Type: application/json" \
-d '{
"data": {
"api_key": "YOUR_API_KEY"
}
}')

# Step 2: Extract auth_token and account_id
AUTH_TOKEN=$(echo $RESPONSE | jq -r '.auth_token')
ACCOUNT_ID=$(echo $RESPONSE | jq -r '.data.account_id')

echo "Auth Token: $AUTH_TOKEN"
echo "Account ID: $ACCOUNT_ID"

# Step 3: Make authenticated API calls
curl -X GET \
"https://api.audian.com:8443/v2/accounts/${ACCOUNT_ID}/users?paginate=false" \
-H "X-Auth-Token: ${AUTH_TOKEN}" \
-H "Accept: application/json"

Next Steps​