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

# Rotate API key

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

## Request

- Base URL: `https://api.abm.dev`
- URL: `https://api.abm.dev/v1/api-keys/{keyId}/rotate`
- Auth: API key in header `X-API-Key`

Revokes the existing key and creates a new one with the same name and scopes. The new plaintext `key` is returned once — store it securely.

## Path parameters

- `keyId` string, required

## Response `200`

API key rotated

- CreateApiKeyResponse
  - `id` string
  - `key` string: Plaintext API key — returned ONLY on creation/rotation. Store this securely; it cannot be retrieved again.
  - `name` string
  - `environment` 'test' | 'live'
  - `scopes` string[]
  - `createdAt` string, date-time
  - `expiresAt` string, date-time
  - `warning` string: Reminder that the plaintext key is only shown once

## Other responses

- `404`: Resource not found

---

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