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.
- Noun
- API Key
- Mode
do- Event
APIKey.rolled
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
apiKey | API Key | required | The API Key to replace. |
expireIn | string | How long the old key keeps working, from 0h to 7d. Defaults to 24h. |
Outputs
| Output | Type | Required | Description |
|---|---|---|---|
apiKey | API Key | required | The replacement API Key. |
secret | string | required | The replacement’s full secret, returned once. |
Effects
- Emits
APIKey.rolled. - Two-way: it runs at once, in the
try,sendanddomodes. - Sets the old key’s
expiresAt; every call it signs after that fails with 401unauthorized. - Emails the Customer’s admins that the key changed, and when the old one stops.
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | APIKey.roll |
When it waits
| Gate | Default |
|---|---|
| Decision class | Low: two-way, nothing at stake |
| Delay window | None: it runs once review passes. |
| Limit | The call Limit of the Permission it runs under. |
| Over the Limit | It 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. |