Skip to the page

Guides · Shipping & operations

Key and secret renewal

Renew service keys, org tokens, handler secrets, action secrets and sign-in credentials with zero downtime.

API
—
In the schema
—

What you’ll build#

This guide renews every credential a production project holds without interrupting live traffic. Each workflow issues a replacement credential, cuts callers over and revokes the prior secret last.

Overlapping credential renewal

Replacement keys and tokens work alongside prior credentials until callers cut over.

The five project credential types differ in whether old and new secrets stay valid simultaneously during cutover.

CredentialHeld byOverlap behavior
Service keyBackend servers, agents, schedules and webhooksOverlap behaviorMultiple keys stay active simultaneously.
Org tokenCI pipelines and admin scriptsOverlap behaviorMultiple tokens stay active simultaneously.
Hosted handler secretBranch handler instancesOverlap behaviorHandler instances roll one at a time, reading the prior value until restart completes.
External action secretYour external handler serverOverlap behaviorNo overlap. Each action holds a single secret.
Sign-in secretsProject authentication serviceOverlap behaviorReplaces in place without invalidating active user sessions.

Sessions & keys compares credential types and permission scopes.

Before you start#

Sign in to the CLI with manage scope and list every active credential on your project before starting.

Terminal
# Verify your active CLI login holds manage scopenapalm whoami # List active credentials and expiration dates across the projectnapalm keys ls notesnapalm tokens lsnapalm handlers ls notesnapalm actions ls notesnapalm sign-in show notes

Credential expiration dates cannot be extended in place, so renew keys and tokens ahead of expiry.

Renew a service key#

A branch accepts multiple active service keys simultaneously, so the prior key and replacement key work side by side during rollout. Because a key’s label, branch, --read-only mode and per-key globals are fixed at creation, copy those flags onto the replacement key.

  1. Issue the replacement key

    Terminal
    # Inspect the current key's label, branch and access settingsnapalm keys ls notes # Issue a replacement key with matching settings (printed once on stdout)napalm keys create notes --label notes-api-2026-11 --read-only --days 90 # Compare row reach between the new and old keys to confirm identical permissionsnapalm keys ls notesnapalm keys reach notes <next-key-id>napalm keys reach notes <old-key-id>

    napalm keys ls displays each key’s target branch and read/write permissions alongside any bound globals. Pass matching --branch and --global flags and set --days between 1 and 365 days. Including a date in --label distinguishes successive keys clearly.

    The replacement key activates immediately and prints bare on standard output so you can pipe it directly into your secret manager.

  2. Deploy the replacement key to your services

    Update your application’s secret store and redeploy. Check Show activity above the project’s service keys in the console or run napalm keys usage to confirm the old key’s last-used timestamp stops advancing. Napalm retains last-used timestamps for the lifetime of the branch so even quarterly jobs remain visible.

  3. Cut over schedules and row webhooks

    Cron schedules and row-carrying webhooks bind to a specific service key ID and do not switch keys automatically. Revoking a key while a schedule or webhook still references it halts execution or delivery.

    Terminal
    # Check whether any cron schedules or row webhooks depend on the old keynapalm schedules ls notesnapalm webhooks ls notes # Re-create the schedule bound to the replacement key between cron ticksnapalm schedules remove notes <query> --yesnapalm schedules add notes <query> '<cron>' --key <next-key-id> # Re-create the row webhook bound to the replacement key (prints a new signing secret)napalm webhooks remove notes https://api.example.com/hooks/napalm --yesnapalm webhooks add notes https://api.example.com/hooks/napalm --event note_changed --key <next-key-id>

    Re-create affected schedules and webhooks with --key <next-key-id>, preserving existing --time-zone and --variables settings. Re-adding a webhook generates a fresh Napalm-Signature secret, so update your webhook receiver’s secret at the same time.

  4. Revoke the old key

    Terminal
    # Revoke the prior key once traffic drainsnapalm keys revoke notes <old-key-id>

    Revocation takes effect before napalm keys revoke returns. Subsequent HTTP requests fail with 401 invalid_key, and open live subscriptions close with key_revoked while all other keys and user sessions continue uninterrupted.

Projects API documents the HTTP endpoints for automated key renewal scripts.

Renew the CI token#

Org tokens authenticate CI pipelines and automation scripts against the Control API. Multiple org tokens stay active at once so you can update repository secrets between runs without downtime.

Terminal
# Inspect the active CI token's label, scope and expiration datenapalm tokens ls # Pipe a fresh 90-day manage token directly into your GitHub Actions secretnapalm tokens create --label deploy-2026-11 --scope manage --days 90 | gh secret set NAPALM_TOKEN # Revoke the prior token once a CI workflow succeeds with the replacementnapalm tokens revoke <old-token-id>
Actor identity
Every org token acts on behalf of the organization member who created it.
Scope and lifetime
--scope defaults to read unless manage is specified. Match the prior token’s Can column in napalm tokens ls. --days defaults to 30 days.
Standard output
napalm tokens create writes only the raw token to stdout so you can pipe directly into gh secret set or a secret vault.
In-flight CI runs
Wait for any in-progress CI workflows that started with the old token to finish before revoking.
Revocation
Revoked or expired org tokens immediately return 401 unauthorized.

Organization & billing documents the Control API token routes.

Renew a hosted handler secret#

Hosted handlers read external API credentials (such as Resend or Stripe keys) from branch-scoped environment secrets. Updating a secret triggers a rolling restart across your branch’s handler instances. Create the replacement key in your external provider first and keep the old provider key active until the rollout operation finishes.

Terminal
# Prompt for the new secret value with echo disabled and return the rollout operation IDnapalm handlers secrets set notes RESEND_KEY --json # Wait for the rolling handler restart to completenapalm operations show <operation-id> --wait # List configured secret names (secret values are never returned)napalm handlers ls notes
Secret input
napalm handlers secrets set reads values interactively with echo off, from a file via --value-file or from stdin via --value-file - so secrets never appear in shell history.
Per-branch scope
Handler secrets are isolated per branch. Pass --branch to update preview or staging branches that hold the same secret.

Hosted handlers covers secret naming rules and limits.

Renew an external action secret#

An external action handler on your own server presents its action secret to POST /sign-in/agents/token to exchange call assertions for a caller-scoped session in call.db(). Because Napalm stores one secret per action and prints it only on creation, renewing an external action secret requires removing and re-adding the action during a brief maintenance window.

Terminal
# Inspect the action's handler URL, timeout and read-only flagnapalm actions ls notes # Remove and re-add the action back to back to issue a new secretnapalm actions remove notes emailNote --yesnapalm actions add notes emailNote https://app.example.com/napalm/email-note --timeout 20
Between commands
In the instant between napalm actions remove and napalm actions add, calls to emailNote execute as an ordinary read query without invoking the external handler.
Before redeploy
Token exchanges using the prior secret fail at /sign-in/agents/token with 401 invalid_client until your handler server deploys the new secret.
Preserving flags
Re-pass your prior --read-only, --timeout and --answer-schema flags. Omitting --timeout applies the default 10-second timeout.

Renew sign-in secrets#

Built-in sign-in stores three external secrets: OAuth/OIDC client secrets, your SMTP password and your auth-webhook signing key. Because read endpoints never echo secrets back, each renewal resubmits the complete setting.

Terminal
# Save the OAuth provider with a fresh client secret in NAPALM_CLIENT_SECRETnapalm sign-in provider notes github --client-id <client-id> # Save SMTP settings with a fresh password in NAPALM_SMTP_PASSWORDnapalm sign-in email notes --host smtp.example.com --sender "Notes <sign-in@example.com>" \  --username sign-in@example.com # Replace the webhook signing key in place via NAPALM_SIGNING_KEYnapalm sign-in webhooks add notes https://app.example.com/hooks/sign-in \  --event IdentityCreated --event EmailVerified --replace https://app.example.com/hooks/sign-in napalm sign-in show notes
OAuth client secret
Create a second client secret in your identity provider’s console before updating Napalm, then delete the old secret at the provider afterward. Custom OIDC providers also require passing --issuer-url, --display-name and --slug (all listed in napalm sign-in show).
SMTP password
Saving replaces the full SMTP configuration, so include --port and --starttls whenever your mail server uses non-default transport settings.
Webhook signing key
Accept both the prior and replacement HMAC keys in your webhook receiver first, run --replace with the new NAPALM_SIGNING_KEY and drop the old key from your receiver once cutover finishes.
Active user sessions
Updating OAuth, SMTP or webhook secrets never alters session-signing keys, so signed-in users stay signed in.

See Sign-in for your app and Identity providers & sign-in events for full setup details.

Check the renewal#

Confirm that revoked credentials fail immediately while active services, schedules, webhooks and CI continue running on their replacement secrets.

  1. Verify the old service key is rejected

    Terminal
    curl -i https://notes.napalmdata.com/query/myNotes \  -H "Authorization: Bearer $OLD_KEY" -H "Content-Type: application/json" \  -d '{ "variables": {} }'

    Confirm the old key returns 401 invalid_key while the replacement key returns 200.

  2. Check key and token status

    napalm keys ls notes lists the prior key as revoked and the replacement key as active, and napalm tokens ls confirms the same for your CI org token.

  3. Inspect schedules and webhooks

    napalm schedules ls notes and napalm webhooks ls notes reference the replacement key’s label with zero revoked-key warnings.

  4. Trigger a CI run

    Confirm napalm whoami inside CI prints the replacement token’s label and expiration date.

  5. Delete retired upstream secrets

    Remove the old API key in your mail provider and the old client secret in your OAuth provider, then verify transactional emails and new OAuth logins still succeed.

Type a word or two to search every docs page.