---
title: "Rotate"
method: POST
path: "/api_keys/{id}/rotate"
tags: ["apiKeys"]
---

# Rotate

`POST /api_keys/{id}/rotate`

Rotates an API key, generating a new secret and invalidating the old one.

## Path parameters

- `id` string, required

## Headers

- `Authorization` string, required

## Response `200`

API key rotated

- ApiKeyWithSecret
  - `id` string, required — The API key ID.
  - `name` string, required — The name of the API key.
  - `api_key` string, required — The API key secret. Only returned once, when the key is created or rotated.

## Other responses

- `401` — Unauthorized (authentication missing or invalid)
- `404` — API key not found
- `500` — Internal server error

---

[API](https://skmtc.net/phonic/apis/api-reference.md) · [All operations](https://skmtc.net/phonic/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/phonic/api-reference/versions/67bd0b1cb30a/schema)
