How rotation works
- Request rotation — Call
POST /v1/api-keys/rotate. The response returns anencrypted_credentialspayload and anactivity_id. - Decrypt the response — Decrypt
encrypted_credentialsusing yoursecret_keyto retrieve the new key credentials. See Decrypting the response. - Approve in Prime UI — One or more authorized approvers must approve the rotation activity in the Prime UI, depending on your consensus policy. Once all required approvals are met, the new key activates.
- Transition period — For
duration_secondsafter approval, both keys are active. Setduration_seconds: 0to expire the old key immediately on approval. - Swap credentials — Update your integration with the new credentials before the transition period ends.
Operational guidance
When to rotate- Expiring keys — Rotate at least 24 hours before expiry. If the key expires before the rotation activity is approved, the rotation fails and you will need to create a new key manually through the Prime UI.
- Non-expiring keys — Rotate periodically as part of your security hygiene.
duration_seconds
- Set to
0for an immediate cutover — the old key expires the moment the rotation is approved. Use this when all services can be updated atomically. - Set a grace period long enough to redeploy every service that uses the key. Both keys remain active during this window, so you can roll out new credentials without downtime. The maximum is 30 days.
Required scope
The invoking key must have the Rotate API Key scope enabled. This scope is found under the API Key Management section when creating a key in the Prime UI and cannot be changed after creation.Decrypting the response
encrypted_credentials is encrypted with HKDF-SHA256 + AES-256-GCM using your secret_key.
Wire format
After base64-decoding:- version — Always
0x01. Reject any other value. - salt — Random 32-byte HKDF salt.
- nonce — Random 12-byte AES-GCM nonce.
- ciphertext+tag — AES-256-GCM encrypted payload with the 16-byte authentication tag appended. Pass the entire value to your GCM decrypt function.
After decryption, the plaintext is a JSON object:
Decryption example
- Python
- TS/JS
- Go
- Java
- .NET
Monitoring approval
Use theactivity_id from the response to track approval status via Get Activity or List Activities.