All CAMB.AI API requests require authentication using an API key. This guide explains how to obtain and use your API key.
Getting Your API Key
Go to CAMB.AI Studio
Sign in or create an account
Navigate to your account settings
Generate or copy your API key
Keep your API key secure. Never expose it in client-side code or public repositories.
Using Your API Key
Include your API key in the x-api-key header of every request.
x-api-key: your_camb_api_key
Example Request
curl -X POST "https://client.camb.ai/apis/tts-stream" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello world!",
"voice_id": 147320
}'
import requests
headers = {
"x-api-key" : "YOUR_API_KEY" ,
"Content-Type" : "application/json"
}
response = requests.post(
"https://client.camb.ai/apis/tts-stream" ,
headers = headers,
json = { "text" : "Hello world!" , "voice_id" : 147320 }
)
const response = await fetch ( "https://client.camb.ai/apis/tts-stream" , {
method: "POST" ,
headers: {
"x-api-key" : "YOUR_API_KEY" ,
"Content-Type" : "application/json"
},
body: JSON . stringify ({
text: "Hello world!" ,
voice_id: 147320
})
});
SDK Authentication
When using the official SDKs, pass your API key during client initialization.
from camb.client import CambAI
client = CambAI( api_key = "your_api_key" )
# Or use environment variable
client = CambAI( api_key = os.getenv( "CAMB_API_KEY" ))
import { CambClient } from '@camb-ai/sdk' ;
const client = new CambClient ({ apiKey: "YOUR_API_KEY" });
// Or use environment variable
const client = new CambClient ({ apiKey: process . env . CAMB_API_KEY });
Error Responses
Status Code Meaning 401Invalid or missing API key 403API key doesnβt have permission for this resource 429Rate limit exceeded
Example Error Response
{
"error" : "Invalid API key" ,
"status" : 401
}
Best Practices
Use environment variables or secure secret management systems.
Generate new API keys regularly and revoke old ones.
Use separate keys for environments
Create different API keys for development, staging, and production.
Check your API usage in CAMB.AI Studio to detect unauthorized access.
Next Steps
Quick Start Make your first API call
SDK Guide Use our official SDKs