# Rotate an API key

`POST https://backend.estactics.com/api/apiTokens/rotateUserApiToken`

Creates a new key with the same permissions, and retires the old one after the delay you choose.

Authentication: `Authorization: Bearer YOUR_API_KEY`. Required permission: `apiTokens.MANAGE`.

## Body parameters

- `id` (integer, required): ID of the key.
- `expireDelay` (now | 1d | 2d | 1w | 1M, required): How long the old key keeps working.

## Example request body

```json
{
  "id": 8,
  "expireDelay": "1w"
}
```

## Example response

```json
{
  "success": true,
  "data": {
    "id": 8,
    "userId": 18,
    "token": "atsec_your_new_key",
    "expiredAt": null
  }
}
```
