<!-- https://bobabanana.com/docs/api/authentication/ · How to authenticate to the BobaBanana API with a bb_ API key, where keys are created, per-key daily and concurrency limits, and how to keep keys safe. -->

# BobaBanana API authentication and API keys

**Every BobaBanana API request is authenticated with a secret API key sent as a bearer token: `Authorization: Bearer bb_...`.** A key belongs to one workspace, spends that workspace's [credits](https://bobabanana.com/docs/api/credits/), is shown once, and can be revoked at any time.

## How to get an API key

1. Sign in to your BobaBanana workspace at `https://bobabanana.com/app/`.
2. Open **Settings → API keys**.
3. Type a name (for example "Video agent") and choose **Make API key**.
4. Copy the key immediately. It is shown only once; BobaBanana stores only a hash of it.
5. Copy the **webhook signing secret** too if you will use [webhooks](https://bobabanana.com/docs/api/webhooks/).

A workspace can have up to 5 live keys; revoke one to make room. Making a key asks you to confirm your password.

BobaBanana is invite-only: request access at `https://bobabanana.com/app/request-access`. Once approved you get your own workspace with welcome credits.

## Sending the key

```bash
curl https://bobabanana.com/api/v1/status -H "Authorization: Bearer bb_your_key_here"
```

The header `X-API-Key: bb_your_key_here` is accepted as an alternative for tools that cannot set `Authorization`.

Send a `User-Agent` that names your app, for example `User-Agent: my-app/1.0`. Python's built-in `urllib` sends a default one (`Python-urllib/3.x`) that is refused with a plain-text `403` reading `error code: 1010`; `requests`, `httpx`, Node, Go and curl work as they are.

## Limits on each key

| Limit | Default | What happens when reached |
|---|---|---|
| Jobs per rolling 24 hours (deleted jobs still count) | 200 | `429 daily_limit_reached`, `Retry-After: 3600` |
| Unfinished jobs at once | 10 | `429 too_many_active_jobs`, `Retry-After: 30` |
| Reference pictures per request | 10 | `400 too_many_references` |
| Image upload size | 25 MB | `400 file_too_large` |
| Audio upload size | 60 MB | `400 file_too_large` |

The workspace owner can change the per-key limits.

## What a key can and cannot see

- A key sees only its own workspace. IDs from any other workspace return `404`, exactly like IDs that do not exist.
- **Jobs** are private to the key that made them; another key of the same workspace gets `404`.
- **Uploaded files** are shared by every key of the workspace, so one key can upload and another can use the `file_id`.
- A key can **use** the workspace's approved library assets and voices by `@handle` ([assets](https://bobabanana.com/docs/api/assets/)), but cannot change them.
- If the workspace is suspended, every request gets `403 workspace_suspended`.
- Result download links are signed separately and work without a key for 24 hours, so treat them like private links.

## Keeping keys safe: best practices

1. **Keep keys on the server.** Do not ship a key in a mobile app or public web page; call BobaBanana from your backend.
2. **Use one key per app or agent**, so you can revoke one without breaking the others.
3. **Store keys in environment variables or a secret manager**, never in source control.
4. **Revoke a leaked key at once** in Settings → API keys. Queued jobs still finish, but their webhooks are no longer sent; new requests are refused with `401 invalid_api_key`.

## Frequently asked questions

### Do API keys expire?
No. A key works until it is revoked.

### Can I use the API from a browser?
CORS is enabled so you can, but anyone who opens the page can read the key. Use a server-side proxy for public sites.

### What does a 401 mean?
`missing_api_key` means no key was sent; `invalid_api_key` means the key is wrong or revoked.
