---
title: "Rotate API key"
method: POST
path: "/api/v1/api-keys/{id}/rotate"
tags: ["General"]
---

# Rotate API key

`POST /api/v1/api-keys/{id}/rotate`

## Request

- Base URL: `https://botsee.io`
- URL: `https://botsee.io/api/v1/api-keys/{id}/rotate`
- Auth: HTTP bearer

Atomically creates a new API key with the same name and revokes the old one. Returns the new raw key once.

## Path parameters

- `id` string, required

## Response `201`

Resource created.

- object
  - `api_key` object
    - `created_at` string
    - `id` string
    - `key` string
    - `key_prefix` string
    - `name` string
    - `status` string

## Other responses

- `401`: Missing, invalid, or revoked API key.
- `403`: Authenticated but lacks permission (e.g. botsee_disabled).
- `404`: The requested resource does not exist or is not accessible.
- `422`: Request body or parameters failed validation.
- `429`: Too many requests. Wait and retry per Retry-After header.

---

[API](https://skmtc.dev/botsee/apis/botsee-api.md) · [All operations](https://skmtc.dev/botsee/apis/botsee-api/llms.txt) · [OpenAPI document](https://skmtc.dev/botsee/apis/botsee-api/revisions/f815b844e73b?raw)
