Skip to main content

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.
Treat API keys like passwords. Never commit keys to source control, never log them, and never embed them in client-side code shipped to browsers or mobile apps.
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 .env file loaded by direnv, dotenv, or your shell. Add .env to .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 the Authorization header on every API request. Browser and mobile Realtime clients must use a short-lived client secret instead.

Common errors

The API returns 401 Unauthorized when there is a problem with your API key. Common causes include: