# Chargebee API keys: find, store, rotate, and use them safely with AI agents

Source: https://botpassword.com/keys/chargebee
Last checked: 2026-10-25

Chargebee API keys are created in the app under **Settings → Configure Chargebee → API Keys and Events → API keys**, and are specific to each site (test or live). They authenticate with HTTP Basic auth, the key as username and an empty password.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| Full-access key | — | Yes | All API resources; subtypes All, Update (no create or delete) and Write (no delete) | — |
| Read-only key | — | Yes | All read calls, or restricted to transactional data and/or product catalog | — |
| Publishable key | — | No | Creating subscriptions via Process purchase, optionally estimates and read-only product catalog | — |

## How to create a Chargebee key

1. In Chargebee go to **Settings → Configure Chargebee → API Keys and Events → API keys**.
2. Click **+ Add API Key** and choose a key type.
3. Enter a name and click **Create Key**.

## Limiting what the key can do

Choose read-only or publishable keys, or the Update or Write full-access subtypes, to limit what a key can do.

## How to rotate a Chargebee key

1. Create the new key.
2. Update your application to use it.
3. Delete the old key from Chargebee.

## How to revoke a Chargebee key

1. Open the key's more options menu and choose **Disable** to block it reversibly, or **Delete** to purge it permanently.

## If the key leaked

1. Create a replacement key and deploy it.
2. Delete the exposed key.

## Gotchas

- Test and live sites have separate keys.
- Basic auth uses the key as the username with an empty password.
- A site must always keep at least one full-access key.
- The key name shows in the `user` attribute of events triggered with that key.

## Using this key with AI agents (BotPassword)

- `run_with`: Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output.
- `http_request`: Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused.
- `rotate`: Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet.
- `store_secret`: Saves a value the agent already holds as a new vault item.

## FAQ

### Where do I find my Chargebee API key?

Settings → Configure Chargebee → API Keys and Events → API keys.

### How does Chargebee API authentication work?

HTTP Basic auth with the API key as username and an empty password, over HTTPS.

### How do I rotate a Chargebee API key?

Create a new key, update your application, then delete the old key.

### Can an AI agent use my Chargebee key without seeing it?

Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a `.env` file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with `run_with`, `http_request`, `store_secret`, so the agent gets the result and never the value.

## Sources

- https://chargebee.com/docs/billing/2.0/site-configuration/api_keys
- https://apidocs.chargebee.com/docs/api
