Get an API key
- Go to boson.ai/workspace and sign up for a free Boson account.
- Complete the account setup and verification steps.
- Log in and open the API Keys page.
- Click Create API Key and give the key a descriptive name.
- Copy the key. Boson API keys use the format
bai-xxxx; store yours securely.
Building a browser or mobile Realtime client? Your trusted server must exchange its long-lived key for a short-lived client secret.
Store keys safely
Read the key from an environment variable, secret manager, or deployment config. Recommended patterns:-
Quick local test: set the key in your shell for the current session:
-
Local development: use a
.envfile loaded bydirenv,dotenv, or your shell. Add.envto.gitignore. - Servers: inject through your platform’s secret store (AWS Secrets Manager, GCP Secret Manager, Vercel env vars, Fly secrets, Kubernetes Secrets).
- CI: store as a masked CI secret. Avoid printing the value in build logs.
Sending a server-side request
From a trusted server, pass the key in theAuthorization header on every API request. Browser and mobile Realtime clients must use a short-lived client secret instead.
Common errors
The API returns401 Unauthorized when there is a problem with your API key. Common causes include: