Rotate an API Key
The response carries the new key, including its one-time secret value.
Body shape — all fields optional::
{ "grace_period_hours": 24 # how long the old key keeps working; default 24 }
The new key inherits name, permissions, workspace_id,
rate_limit_per_minute, description from
the old key. permissions come from the old key's mirror row
(archie_connect.keys.permissions; the WorkOS list does not hold
Archie's list), falling back to the WorkOS list only when the mirror
list is empty or the row is missing. The new row also inherits the
old row's expires_at (as it was before the grace stamp below) and
created_by_user_id, so rotating never turns a restricted or
time-limited key into an unrestricted, permanent one and never makes
the person rotating its creator. rotated_from_key_id on the new
row points back to the old key_id (lets the reaper cron walk the
chain).
Old key gets expires_at stamped on its mirror row as the earlier of
now() + grace_period_hours and its own current expires_at, so the
overlap never runs past the old key's own expiry (a key with no
expires_at gets the full overlap); a separate reaper job is expected
to revoke once expires_at passes.
Response: same shape as POST / (full merged shape + one-time sk_… value for the new key).
id field when it was created.Successful Response
curl https://uk.heyarchie.com/api/v1/connect-keys/<key_id>/rotate \ -X POST \ -H "Authorization: Bearer sk_..."
import requests
headers = {"Authorization": "Bearer sk_..."}
r = requests.post("https://uk.heyarchie.com/api/v1/connect-keys/<key_id>/rotate", headers=headers)
print(r.json())const r = await fetch("https://uk.heyarchie.com/api/v1/connect-keys/<key_id>/rotate", { method: "POST", headers: { "Authorization": "Bearer sk_..." }, }); const data = await r.json(); console.log(data);
{
"detail": [
{
"loc": [
null
],
"msg": "<string>",
"type": "<string>"
}
]
}Every response also carries X-Request-ID. Quote it if you write to us about a call.