Skip to content
DashboardGet API Key
Getting Started

Authentication

How to authenticate with the Chamelaion API using Bearer tokens or API key headers.

Every request to the Chamelaion API (except /health) requires authentication. Chamelaion supports two authentication methods — both use the same API token from your dashboard.

  1. Log in to the Chamelaion Dashboard
  2. Navigate to SettingsAPI Keys
  3. Click Create new key
  4. Give your key a descriptive name (e.g., “Production Server” or “Dev Testing”)
  5. Copy the key immediately — it won’t be shown again

Pass your API token in the Authorization header with the Bearer prefix:

Terminal window
curl https://api.chamelaion.com/api/v1/users/me \
-H "Authorization: Bearer YOUR_API_KEY"
import requests
response = requests.get(
"https://api.chamelaion.com/api/v1/users/me",
headers={"Authorization": "Bearer YOUR_API_KEY"},
)
print(response.json())
# {"name": "My API Token"}
const response = await fetch("https://api.chamelaion.com/api/v1/users/me", {
headers: { Authorization: "Bearer YOUR_API_KEY" },
});
const data = await response.json();
console.log(data);
// { name: "My API Token" }

Alternatively, pass your token in the x-api-key header:

Terminal window
curl https://api.chamelaion.com/api/v1/users/me \
-H "x-api-key: YOUR_API_KEY"
import requests
response = requests.get(
"https://api.chamelaion.com/api/v1/users/me",
headers={"x-api-key": "YOUR_API_KEY"},
)
print(response.json())

This method is useful when integrating with tools or platforms that have dedicated API key fields but don’t support custom Authorization header formats.

Use the /v1/users/me endpoint to verify that your token is valid and see the identity associated with it:

Terminal window
curl https://api.chamelaion.com/api/v1/users/me \
-H "Authorization: Bearer YOUR_API_KEY"

A successful response returns:

{
"name": "My API Token"
}

If your token is invalid or missing, you’ll receive a 401 Unauthorized response:

{
"error": "invalid token"
}

We recommend storing your API key in an environment variable:

Terminal window
export CHAMELAION_API_KEY="your-api-key-here"
curl https://api.chamelaion.com/api/v1/users/me \
-H "Authorization: Bearer $CHAMELAION_API_KEY"
import os
import requests
api_key = os.environ["CHAMELAION_API_KEY"]
response = requests.get(
"https://api.chamelaion.com/api/v1/users/me",
headers={"Authorization": f"Bearer {api_key}"},
)
const apiKey = process.env.CHAMELAION_API_KEY!;
const response = await fetch("https://api.chamelaion.com/api/v1/users/me", {
headers: { Authorization: `Bearer ${apiKey}` },
});
HTTP StatusError MessageCause
401missing authorization headerNo Authorization or x-api-key header sent
401invalid authorization formatAuthorization header is malformed
401missing tokenHeader is present but the token value is empty
401invalid tokenThe token doesn’t match any active API key
401unauthorizedGeneric authentication failure