Bearer token
Send your API key in theAuthorization header as a Bearer token:
bai_ prefix. Any header missing the prefix or containing an invalid key returns a 401 authentication_error with sub-code invalid_api_key.
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.
Rate limits
Rate limits are enforced per API key. Every response includes these headers:
If you exceed the limit, you’ll get:
Retry-After seconds before retrying.
CORS
The API setsAccess-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.