---
title: "Rotate anon key"
method: POST
path: "/api/secrets/anon-key/rotate"
tags: ["Admin"]
---

# Rotate anon key

`POST /api/secrets/anon-key/rotate`

Rotate the project's opaque anon key (`anon_...`). A new key is generated and returned; the old key stays valid for the grace period (default 168 hours / 7 days, max 720) so already-deployed frontends and mobile binaries keep working while the new key ships. Admin only.

## Request body

- object
  - `gracePeriodHours` integer — How long the old key remains valid after rotation

## Response `200`

Anon key rotated successfully

- object
  - `success` boolean
  - `message` string
  - `anonKey` string — The new anon key
  - `oldKeyExpiresAt` string, date-time — When the previous key stops being accepted

## Other responses

- `400` — Invalid grace period
- `403` — Forbidden - admin access required

---

[API](https://skmtc.net/insforge/apis/insforge-authentication-api.md) · [All operations](https://skmtc.net/insforge/apis/insforge-authentication-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/insforge/insforge-authentication-api/versions/a935bb49f932/schema)
