Skip to main content

What is key rotation?

Key rotation replaces an existing API key with a new one while keeping the old key active for a short overlap window. In the current dashboard flow, that overlap window is 24 hours.

How rotation works

1

Start rotation

In the API keys table, open the row action menu and click Rotate.
2

New key created

BabySea creates a replacement key with the same name, scopes, and IP allowlist as the original key.
3

24 hour overlap begins

The original key continues to work for 24 hours so you can update your applications without an immediate break.
4

Copy the new key

After success, BabySea opens the confirmation view with the title Key rotated successfully and shows the new key one time.
This is the only time the new key is shown. Store it securely before closing the dialog.
5

Update your services

Replace the old key in all your services, environment variables, and secrets managers with the new key.
6

Old key stops working

After the 24 hour overlap, the old key no longer authenticates requests.

What the rotation dialog says

Before you confirm rotation, the dialog description says: This will create a new key to replace: {name}. The old key will continue to work for 24 hours, giving you time to update your applications. After the grace period, the old key will stop working automatically. The confirm action is Rotate key.

What is preserved

The replacement key inherits these properties from the original key:
PropertyInherited
NameYes
ScopesYes
IP allowlistYes

Dashboard indicators

After rotation, the Status column reflects the key state:
Key stateStatus shown
New keyActive
Old key during the 24 hour overlapRotated
Old key after the overlap endsExpired
Manually disabled keyRevoked
The row action menu also changes with state. For example, already rotated keys show Rotated instead of another rotate action.

Rotation rules

RuleDetail
Only active keys can rotateRevoked, expired, and already rotated keys cannot start another rotation.
One rotation at a timeThe old key keeps a rotated marker, so the dashboard does not offer another rotate action for that row.
Owner access requiredMembers can view the page but cannot rotate keys.

Example workflow

A typical quarterly rotation for a production key:
  1. Monday 10:00 AM: Rotate the prod-api-worker key in the dashboard. Copy the new key.
  2. Monday 10:05 AM: Update the key in your secrets manager (Vercel, AWS, Vault, etc.).
  3. Monday 10:10 AM: Deploy your services. They pick up the new key from the secrets manager.
  4. Monday 10:30 AM: Verify the new key is working with GET /v1/status or a normal application request.
  5. Tuesday 10:00 AM: Grace period expires. The old key stops working. No action needed.
Schedule a reminder before the 24 hour overlap ends so you can confirm every application is already using the new key.

Rotation vs. revocation

ActionOld keyNew key createdUse case
RotateActive during graceYesPlanned key refresh
RevokeImmediately disabledNoCompromised or leaked key
If a key is compromised, do not rotate. Revoke it immediately to disable it, then create a new key. See Revoke a key below.

Revoke a key

Revoking a key immediately disables it. All requests using the revoked key return BSE1002 with HTTP 401 from the moment of revocation.
DetailValue
EffectImmediate (key stops working instantly)
ReversibleNo
Logs preservedYes (API key logs remain until the key is deleted)
When to useKey is compromised, leaked, or no longer needed
Revocation cannot be undone. If you need the key’s functionality back, create a new one.

Delete a key

Deleting a key permanently removes it and all associated API key logs. The key is also immediately revoked if it was still active.
DetailValue
EffectImmediate removal of key and all logs
ReversibleNo
Logs preservedNo (logs are removed with the key)
When to useCleaning up old keys you no longer need to audit
Before deleting, consider whether you still need the API logs for auditing. If you only want to stop the key from working, revoke it instead.

Action availability

Not all actions are available for every key status:
ActionActiveRotatedExpiredRevoked
RotateYesNoNoNo
RevokeYesYesNoNo
DeleteYesYesYesYes
All key management actions are available from the three-dot menu in the API keys table.