Payments and finance

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

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.

Chargebee key types

TypePrefixSecret?ScopeExpiry
Full-access key
A site must keep at least one full-access key.
—YesAll API resources; subtypes All, Update (no create or delete) and Write (no delete)—
Read-only key—YesAll read calls, or restricted to transactional data and/or product catalog—
Publishable key
Browser-safe.
—NoCreating 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 your Chargebee key leaked

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

Things that catch people out

  • 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 your Chargebee key with AI agents

A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.

BotPassword works this way. For a Chargebee key, these intents fit:

IntentWhat BotPassword does
run_withRuns 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_requestMakes 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.
rotatePartly 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_secretSaves a value the agent already holds as a new vault item.

Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents

Frequently asked questions

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.

Stop pasting Chargebee keys into agents

BotPassword is in early access. Request an invite and we'll email you when your spot opens.