---
title: "Regenerate Key"
method: POST
path: "/api/keys/{api_key}/regenerate"
tags: ["api-keys"]
---

# Regenerate Key

`POST /api/keys/{api_key}/regenerate`

## Request

- Base URL: `https://api.halalterminal.com`
- URL: `https://api.halalterminal.com/api/keys/{api_key}/regenerate`
- Auth: API key in header `X-API-Key`

**Deprecated** — use `POST /api/auth/me/regenerate` instead.

The path-parameter form leaks the key into Caddy/proxy access logs.
The replacement reads from the `X-API-Key` header only.

## Path parameters

- `api_key` string, required: API key to deactivate and replace.

## Response `200`

The old (deactivated) key and the new replacement key

- RegenerateKeyResponse: Response returned after regenerating an API key.
  - `old_key` string, required: The deactivated API key
  - `new_key` string, required: The newly generated replacement key
  - `email` string, required: Email associated with the key
  - `plan` string, required: Plan tier carried over to the new key

## Other responses

- `401`: Missing or invalid API key
- `403`: Caller does not own this key
- `404`: API key not found or already inactive
- `422`: Validation Error
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/halalterminal/apis/halal-terminal-api.md) · [All operations](https://skmtc.dev/halalterminal/apis/halal-terminal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/halalterminal/apis/halal-terminal-api/revisions/78768b250943?raw)
