---
title: "Refresh Key"
method: POST
path: "/api/v1/auth/keys/{key_id}/refresh"
tags: ["grandline-auth"]
---

# Refresh Key

`POST /api/v1/auth/keys/{key_id}/refresh`

## Request

- Base URL: `https://grandline.luzomi.com`
- URL: `https://grandline.luzomi.com/api/v1/auth/keys/{key_id}/refresh`
- Auth: none declared

Rotate a key for the 90-day refresh: revoke the old one, mint a fresh key
(same name, new expiry), and email it. Returns the new cleartext once.

Rotating the key you're currently authenticating with is expected — switch to
the returned key (also in your inbox) for subsequent calls.

## Path parameters

- `key_id` integer, required

## Response `200`

Successful Response

- ApiKeyRefreshResponse: Returned once when a key is rotated. The new cleartext `key` replaces the old one (which is now revoked); it's also emailed to the account.
  - `id` integer, required
  - `name` string, required
  - `prefix` string, required
  - `key` string, required
  - `created_at` string, date-time, required
  - `expires_at` string, date-time, nullable, required
  - `rotated_from` integer, required

## Other responses

- `401`: Authentication required
- `404`: Key not found / not owned by caller
- `422`: Validation Error

---

[API](https://skmtc.dev/luzomi/apis/grandline-api.md) · [All operations](https://skmtc.dev/luzomi/apis/grandline-api/llms.txt) · [OpenAPI document](https://skmtc.dev/luzomi/apis/grandline-api/revisions/4ce06aea012b?raw)
