Give a key a new secret

Keeps the key's id, project, scopes and expiry and gives it a new secret, answered once and stored only as a SHA-256 hash.

POST/v1/keys/{key_id}/rotate

Keeps the key's id, project, scopes and expiry and gives it a new secret, answered once and stored only as a SHA-256 hash. The old secret keeps working for overlap_s seconds (an hour by default, 0 ends it at once), so a fleet moves to the new one without a gap; every gateway refuses it after that. Rotating again ends any overlap still running. Only a signed-in person with a fresh second factor rotates a key, as only a person makes one; an API key answers person_required. The person's role must hold keys:write, and a member rotates only keys they made. A service grant's key is rotated by connecting the service again, and a revoked or expired key is conflict. A repeat with the same Idempotency-Key answers conflict and never the secret again.

For people only: a signed-in person with a fresh second factor makes this call, from the dashboard. Any API key is refused with person_required.

Request

curl -X POST "https://api.pod.mapier.ai/v1/keys/key_3ahrz6dmv29gqy5ckt18fp/rotate" \
  -H "Authorization: Bearer $POD_PERSON_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"overlap_s":3600}'

Parameters

NameInTypeRequiredWhat it is
key_idpathstringYes
Idempotency-KeyheaderstringNoMakes a repeat of this call safe for 24 hours.

Body

FieldTypeRequiredWhat it is
overlap_sintegerNoHow long the old secret keeps working, in seconds. Default 3600. From 0 to 604800.

Answer

200. The key and its new secret, shown this once.

200
{
  "key": {
    "id": "key_3ahrz6dmv29gqy5ckt18fp",
    "name": "example",
    "project": "prj_3ahrz6dmv29gqy5ckt18fp",
    "mode": "test",
    "class": "person",
    "scopes": ["sandboxes:read"],
    "last_four": "example",
    "created_by": "example",
    "created_at": "2026-11-23T12:00:00.000Z",
    "expires_at": null,
    "revoked_at": null,
    "service": null,
    "billing_mark": null,
    "parent_sandbox": null,
    "parent_scopes": null,
    "last_used_at": null,
    "rotated_at": null,
    "previous_secret_until": null
  },
  "secret": "pod_3ahrz6dmv29gqy5ckt18fpx4bjs07enw3ahrz6dm"
}
FieldTypeAlwaysWhat it is
keyApiKeyYes
secretstringYesShown once. Stored by Pod only as a SHA-256 hash.

Errors

The refusals this call is known for: invalid, person_required, forbidden, not_found, conflict. Any call can also answer unauthorized, rate_limited, unavailable or internal; the error list says what each means and when to send the call again.

In the SDKs

ClientCall
TypeScriptpod.keys.rotate(id, { overlap_s })
Pythonpod.keys.rotate(id, overlap_s=…)