Create, Change, Rotate and Revoke Keys
You manage API keys from the Python SDK, the archie CLI or the REST API at /api/v1/connect-keys. All of them use the same backend, with the same checks, the same audit log and the same cache clearing.
Pick whichever suits how you work.
Fixed When You Create It
A key is an sk_ bearer value plus a few fields. The value and permissions are held by WorkOS, our secret store. The other fields live in Archie's own record of the key and can be changed without rotating it.
A readable label. Renaming changes Archie's copy only; WorkOS keeps the original.
Cannot be edited. Create a replacement key; rotating copies the list unchanged.
Fields You Can Change
These three can be changed whenever you like, and the change applies to the same key.
Pins the key to one workspace in a multi-workspace org. null means the earliest one.
Beats the org override and the default. 0 blocks every request; null clears it.
A free-text note shown with the key.
Create a Key in Code
The new key's rate limit is in force from its very first request. Show key.value to the person who needs it straight away, then discard it: it cannot be fetched again.
from heyarchie import Archie
client = Archie(api_key="sk_...", base_url="https://uk.heyarchie.com")
key = client.keys.create(
name="ci-deploys",
permissions=["ask:execute", "search:read"],
workspace_id="b0000000-0000-0000-0000-000000000001", # optional
rate_limit_per_minute=30, # optional
description="staging deploy bot", # optional
)
# Show key.value to the operator now. WorkOS will not return it again.
print(key.value)Permissions must come from the current eleven scopes listed on the Authentication page. A retired or unknown name, such as messages:create, fails with 400 unknown_permissions and the response lists the valid names. Keys made with old names still sign in, but an old name matches no skill, so create a replacement with current scopes and revoke the old key.
Change a Key's Fields
Change the workspace pin, rate limit and description with client.keys.update or PATCH /api/v1/connect-keys/{key_id}. Permissions cannot be edited: a PATCH to permissions returns 501, because WorkOS has no way to change them. Create a replacement key with the scopes you want and revoke the old one.
# Pin to a workspace
client.keys.update(key.id, workspace_id="b0000000-...")
# Set a per-key rate limit (None to clear, 0 to block)
client.keys.update(key.id, rate_limit_per_minute=30)
# Change several fields in one call
client.keys.update(
key.id,
description="staging deploy bot, updated",
rate_limit_per_minute=60,
)Rotate a Key
Rotating creates a replacement that copies the old key's name, permissions, workspace, rate limit and description. The old key keeps working for a grace period, 24 hours by default, and is then revoked automatically. The new value is returned once.
# Default: the old key stops after 24 hours new_key = client.keys.rotate(key.id) # Or a shorter grace period new_key = client.keys.rotate(key.id, grace_period_hours=1) print(new_key.value) # the new sk_ value, shown once print(new_key.rotated_from_key_id) # the old key's id
Revoke a Key
Revoking takes effect at once. Archie deletes the key at WorkOS, marks it revoked and clears every cache that held it, so the very next call with it gets 401.
client.keys.revoke(key.id) # Any later call with this key gets 401 auth_required.
List and Inspect Keys
Listing returns every key with its preview value, never the full secret. Fetching one key returns all its fields together.
page = client.keys.list()
for k in page.data:
print(k.id, k.obfuscated_value, k.workspace_id, k.rate_limit_per_minute)
# One key, all fields:
key = client.keys.get("api_key_01KRVGB...")
print(key.description, key.revoked_at)What Never Reaches Your Browser
Your code only sees the key's fields and a short preview of its value. It never talks to WorkOS directly.