---
title: "Rotate a key: a new key with the same label, kind and organization (shown once); the old key keeps working for grace_second (default 86400 = 24 h, max 30 days, 0 = at once), then is refused with 401"
method: POST
path: "/api/v1/keys/{id}/rotate"
tags: ["Account"]
---

# Rotate a key: a new key with the same label, kind and organization (shown once); the old key keeps working for grace_second (default 86400 = 24 h, max 30 days, 0 = at once), then is refused with 401

`POST /api/v1/keys/{id}/rotate`

## Request

- Base URL: `https://philforms.com`
- URL: `https://philforms.com/api/v1/keys/{id}/rotate`
- Auth: HTTP bearer

## Path parameters

- `id` string, required

## Request body

- object
  - `grace_second` integer

## Response `201`

{ key, api_key, rotated: { id, prefix, expires_at }, note }

## Other responses

- `400`: grace_second out of range
- `403`: A test key can only rotate test keys
- `404`: No such key
- `409`: Already rotated — rotate its replacement

---

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