Skip to main content
Every request to the API needs an API key. Generate one from your API keys settings.

Bearer token

Send your API key in the Authorization header as a Bearer token:
API keys always start with the bai_ prefix. Any header missing the prefix or containing an invalid key returns a 401 authentication_error with sub-code invalid_api_key.
Treat API keys like passwords. Never commit them to source control or ship them in client-side code — use a server-side proxy if your frontend needs to call the API.

Billing ownership

When an API key calls a workflow:
  • The key owner is billed for the run (not the workflow author).
  • The workflow author may earn a revenue share on public/published workflows.
  • Runs are scoped to the key owner — you can only read back runs you started.
This means you can safely share published workflow IDs; callers spend their own credits to run them.

Rate limits

Rate limits are enforced per API key. Every response includes these headers: If you exceed the limit, you’ll get:
Back off for at least Retry-After seconds before retrying.

CORS

The API sets Access-Control-Allow-Origin: *, so browser calls from any origin work. However, exposing your API key in browser code is never safe — always proxy through your own server.

What’s next

Errors

Handle auth failures and other error conditions.

Start a run

Make your first API call.