---
title: "Rotate an organization API key"
method: POST
path: "/orgs/{org_id}/api-keys/{key_id}/rotate"
tags: ["Organizations"]
---

# Rotate an organization API key

`POST /orgs/{org_id}/api-keys/{key_id}/rotate`

## Request

- Base URL: `https://api.mnemom.ai/v1`
- URL: `https://api.mnemom.ai/v1/orgs/{org_id}/api-keys/{key_id}/rotate`
- Auth: HTTP bearer

Atomic mint-new + immediately-revoke-old, with the same `name` and `scopes` as the original. The full new secret is returned only in this response. No grace period — old key is invalid immediately. If you need overlap with an in-flight deploy, create a second key first via `POST /orgs/{org_id}/api-keys`, ship, then `DELETE` the old key. Owners and admins may rotate any org key; members may rotate keys they created. Authorization: `key_id` is matched together with `org_id`, so a key owned by another org returns 404 and no other tenant's key can be rotated.

## Path parameters

- `org_id` string, required
- `key_id` string, required

## Response `201`

New key minted, old key revoked.

- object
  - `key_id` string
  - `key` string: Full secret. Capture now — never returned again.
  - `key_prefix` string
  - `name` string
  - `org_id` string
  - `scopes` string[]
  - `rotated_from` string
  - `old_key_revoked_at` string, date-time
  - `created_at` string, date-time

## Other responses

- `400`: Bad request
- `401`: Authentication required
- `403`: Forbidden
- `404`: Resource not found
- `429`: Rate-limit exceeded. The global per-IP limiter (100 requests/minute, applied to every `/v1/*` route) rejected this request. Back off until the window resets — `Retry-After` carries the cooldown in seconds and `X-RateLimit-Reset` the absolute reset time.
- `500`: Server error — request was well-formed but the server failed to fulfill it. Typically a downstream dependency (DB / RPC / external API) returned an unexpected error.

---

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