# Replace a key with a twin; the old key keeps working for the overlap

`POST /keys/{id}/rotate` · Rivier · keys

Replace a key with a twin; the old key keeps working for the overlap.

- Scope: keys:admin
- Sdk: keys.key.rotate
- Cli: keys key rotate
- Events: keys.key.rotated

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "overlapHours": {
      "type": "number",
      "minimum": 0,
      "maximum": 720
    }
  },
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/keys/{id}/rotate' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "overlapHours": 0
}'
```
