---
search:
  tags:
    - API keys
    - POST
seo:
  description: >-
    Makes a replacement for an API key, with the same permissions and reach. The
    old… Reference for the POST /_luna/tokens/{id}/rotate endpoint in the Luna
    API.
sidebar:
  label: Rotate an API key
  badge: POST
title: Rotate an API key
type: openapi-operation
---
Makes a replacement for an API key, with the same permissions and reach. The old key keeps working for the overlap, so that you can move your programs over. The new key is shown once, in this response.

`POST /_luna/tokens/{id}/rotate`

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

Request body example:

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

**Responses**

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

Response example, 200:

```json
{
  "id": "string",
  "token": "string",
  "expiresMs": 0
}
```
