| title | API Keys |
|---|---|
| icon | KeyRound |
| description | Create, rotate, and revoke PgBeam API keys for programmatic access. |
API keys authenticate programmatic access to the PgBeam REST API and CLI.
PgBeam supports two types of API keys:
| Type | Prefix | Scope | Manage in |
|---|---|---|---|
| Personal keys | pbu_ |
All your organizations | Settings > Account > API Keys |
| Organization keys | pbo_ |
Single organization | Settings > Organization > API Keys |
From the dashboard, go to **Settings** and select the relevant **API Keys**
page (Account or Organization level).
Click **Create Key** and configure:
- **Name**: A label to identify the key (e.g., "CI/CD", "monitoring",
"staging deploy")
- **Expiry**: Optional. Choose 30 days, 90 days, 365 days, or no expiry.
<Callout type="warn" title="Copy immediately">
The full key is shown **only once** after creation. Copy it immediately and
store it securely. You cannot retrieve the full key after closing the dialog.
</Callout>
Pass the key in the Authorization header as a bearer token:
<Tabs items={["curl", "JavaScript", "Python", "CLI"]}>
bash curl -H "Authorization: Bearer pbo_..." https://api.pgbeam.com/v1/projects
response = requests.get(
"https://api.pgbeam.com/v1/projects",
headers={"Authorization": f"Bearer {os.environ['PGBEAM_API_KEY']}"},
)
```
# Or use an environment variable
export PGBEAM_TOKEN=pbu_...
pgbeam projects list
```
Generate a new key with the same permissions as the one you want to rotate.
Update your application, CI/CD pipeline, or scripts to use the new key.
Confirm the new key works correctly in all environments.
Delete the old key from **Settings > API Keys**. Revoked keys stop working
immediately.
- Store keys in environment variables or a secret manager. Never commit them to source control.
- Set an expiry for keys used in CI/CD or automation.
- Use separate keys for different environments (production, staging, development).
- Use organization keys for shared automation so revoking a team member's access does not break CI/CD.
- Revoke keys immediately if they may have been exposed.
- Audit key usage: review active keys periodically and revoke any that are no longer needed.