---
title: "Regenerate Api Key"
method: POST
path: "/api/v1/config/api-keys/{key_id}/regenerate"
tags: ["api-keys"]
---

# Regenerate Api Key

`POST /api/v1/config/api-keys/{key_id}/regenerate`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/config/api-keys/{key_id}/regenerate`
- Auth: none declared

Regenerate an API key (revokes old key, creates new one with same name).

Issue #169: Secret regeneration feature. Issue #1752: the owner is emailed
a security notice after the commit.

WARNING: This immediately invalidates the old key. Update all applications.

## Path parameters

- `key_id` string, required: Public id of the API key (`akey_` + 22 base62 characters).

## Headers

- `authorization` string, nullable

## Response `200`

Successful Response

- APIKeyCreateResponse: Response model for API key creation (includes plaintext key).
  - `id` unknown, required
  - `key_prefix` unknown, required
  - `name` unknown, required
  - `user_id` unknown, required
  - `created_at` unknown, required
  - `last_used_at` unknown
  - `revoked_at` unknown
  - `expires_at` unknown
  - `status` unknown, required
  - `default_context_id` unknown
  - `default_context_name` unknown
  - `api_key` unknown, required

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-20** `09f17f5ada29`: 2 info
  - added the optional property `default_context_id` to the response with the `200` status
  - added the optional property `default_context_name` to the response with the `200` status

[Operation history](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/changes/api/v1/config/api-keys/:key_id/regenerate/post.md)

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/09f17f5ada29?raw)
