Skip to content
Luna
Esc
↑↓navigate↵open⌘Jpreview

Rotate an app key

Makes a replacement for a key or token. The old one keeps working for the overlap, so that callers can move over. Use the id primary for the tenant’s main publishable key and primary-secret for its main secret token.

POST/_luna/tenants/{tenant}/keys/{id}/rotate
Authorization
AuthorizationBearer token · headerrequired

An account key (la_…), an API key (lt_…) or a session token (ls_…). The scopes listed are the permissions the operation needs.

Scopes:keys:write
Path parameters
tenantstringrequired

The tenant, by its full name.

idstringrequired

The key's id.

Request body
application/json
One of:
Rotation
overlapSecondsinteger<int64> | null

How long the old key keeps working, in seconds. One hour when left out. 0 ends it at once.

min 0 · default: null
null
null
Responses
200

The replacement.

idstringrequired

The new key's id. A main key keeps its id, and an added key's replacement gets a new one.

keystringrequired

The new key. A secret token is shown only this once.

kindstringrequired

publishable or secret.

oldKeyStopsMsinteger<int64>required

When the old key stops working, in milliseconds since the Unix epoch.

min 0
default

The request failed. The status says how and error.message says why.

errorErrorDetailrequired
Show properties
codestring | null

A code for programs to branch on, when the error has one.

messagestringrequired

What went wrong, in a sentence a person can read.

Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'https://luna.example.com/_luna/tenants/string/keys/string/rotate' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "overlapSeconds": null
}'
Response
{
  "id": "string",
  "key": "string",
  "kind": "string",
  "oldKeyStopsMs": 0
}

Was this page helpful?