---
title: "Rotate (replace) your API key"
method: POST
path: "/api/v1/auth/keys/{key_id}/rotate"
tags: ["Authentication & Billing"]
---

# Rotate (replace) your API key

`POST /api/v1/auth/keys/{key_id}/rotate`

## Request

- Base URL: `https://www.deepmapai.com`
- URL: `https://www.deepmapai.com/api/v1/auth/keys/{key_id}/rotate`
- Auth: none declared

Generates a new key and invalidates the old one. The new key is shown **once**.

## Path parameters

- `key_id` integer, required

## Query parameters

- `x_api_key` string, nullable

## Response `200`

Successful Response

- KeyRotateResponse
  - `key_id` integer, required
  - `api_key` string, required: New API key. Save it now -- the old key is invalidated.
  - `key_prefix` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/deepmapai/apis/deepmap-ai.md) · [All operations](https://skmtc.dev/deepmapai/apis/deepmap-ai/llms.txt) · [OpenAPI document](https://skmtc.dev/deepmapai/apis/deepmap-ai/revisions/dab995d977d0?raw)
