---
title: "Regenerate an API key"
method: POST
path: "/auth/keys/{id}/regenerate"
tags: ["Auth"]
---

# Regenerate an API key

`POST /auth/keys/{id}/regenerate`

## Request

- Base URL: `https://api.companystack.co.uk`
- URL: `https://api.companystack.co.uk/auth/keys/{id}/regenerate`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Api-Key`

Revokes the key and issues a replacement with the same name.

## Path parameters

- `id` integer, required

## Response `201`

Replacement key (shown once)

## Other responses

- `401`: API key missing, malformed or revoked
- `403`: The key's plan does not include this endpoint (`code: plan_upgrade_required`, with `upgrade_url`), the key may not call it, or the key is beyond the plan's key limit after a downgrade (`code: key_limit_exceeded`: the newest keys are paused until keys are deleted or the plan upgraded)
- `404`: Key not found

---

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