---
search:
  tags:
    - App keys
    - POST
seo:
  description: >-
    Makes a replacement for a key or token. The old one keeps working… Reference
    for the POST /_luna/tenants/{tenant}/keys/{id}/rotate endpoint in the Luna
    API.
sidebar:
  label: Rotate an app key
  badge: POST
title: Rotate an app key
type: openapi-operation
---
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`

**Request body** (`application/json`)

Request body example:

```json
{
  "overlapSeconds": null
}
```

**Responses**

- `200` — The replacement.
- `default` — The request failed. The status says how and \`error.message\` says why.

Response example, 200:

```json
{
  "id": "string",
  "key": "string",
  "kind": "string",
  "oldKeyStopsMs": 0
}
```
