Skip to content

APIKey.roll

POST /{namespace}/api-keys/{apiKey}/roll

Roll issues a replacement API Key with the same scope and keeps the old one working until a set time.

Mode
do
Event
APIKey.rolled

Inputs

InputTypeRequiredDescription
apiKeyAPI KeyrequiredThe API Key to replace.
expireInstringHow long the old key keeps working, from 0h to 7d. Defaults to 24h.

Outputs

OutputTypeRequiredDescription
apiKeyAPI KeyrequiredThe replacement API Key.
secretstringrequiredThe replacement’s full secret, returned once.

Effects

  • Emits APIKey.rolled.
  • Two-way: it runs at once, in the try, send and do modes.
  • Sets the old key’s expiresAt; every call it signs after that fails with 401 unauthorized.
  • Emails the Customer’s admins that the key changed, and when the old one stops.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.APIKey.roll

When it waits

GateDefault
Decision classLow: two-way, nothing at stake
Delay windowNone: it runs once review passes.
LimitThe call Limit of the Permission it runs under.
Over the LimitIt waits pending for an Approval from the Founder. Approved, it runs; refused, it ends refused with limit-exceeded; unanswered by its deadline, it ends canceled.