Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Secret keys

A secret key is a project’s server credential: sk_test_… in dev and sk_live_… in prd. It reaches every service the project adopted, in the key’s environment, and with it the server mints user tokens. Only a dev key reads the test inbox.

Agentpost shows a secret key once and keeps only its hash, so a list of keys tells them apart by prefix. Keep it on the server, such as in an environment variable; never send it to a browser or put it in an app. A browser or a native app starts a sign-in with a publishable key instead.

Status

A secret key’s status is active until you rotate or revoke it. A key works while its status is active or grace.

  • Rotated: a new key with the same name and environment replaces it. The request must send grace, a duration string from "0s" to "7d". A grace of "0s" stops the old key at once and requires confirm set to the key’s name. The old key is grace until graceEndsAt, then expired. User tokens it minted keep working until their own expiresAt. Rotating a key that already has a replacement, even during its grace, or that was revoked or has expired answers conflict.
  • Revoked: it stops at once, with every user token it minted, and can’t be undone.

A request with a stopped key answers unauthenticated. A live event tail the key already opened stops within 30 seconds, whether the key was revoked or its grace ended.

Where to act on it