---
title: "Rotate API key"
method: POST
path: "/v1/auth/keys/rotate"
tags: ["auth"]
---

# Rotate API key

`POST /v1/auth/keys/rotate`

## Request

- Base URL: `https://agentlair.dev`
- URL: `https://agentlair.dev/v1/auth/keys/rotate`
- Auth: HTTP bearer

Generate a new API key for this account. The old key is immediately invalidated.
Requires authentication (API key or session).

## Response `200`

New key generated

- object
  - `api_key` string: New API key — save immediately
  - `key_prefix` string
  - `account_id` string
  - `rotated_at` string, date-time
  - `warning` string

## Other responses

- `401`: Unauthorized

---

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