Agents
Rotate keys
Add a new key, prove it, switch signing to it, then revoke the old key. Agents may hold up to five active keys at once.
Rotation is overlap-based: an agent can hold up to five non-revoked keys, so you can bring a new key up before retiring the old one with no downtime.
Steps
- Generate a new keypair on the new host.
- Register the public key:
POST /api/v1/agents/:id/keyswith a session token, orPOST /api/v1/registration/keyswith a fresh registration token. The key is createdpendingtogether with a registration challenge. - Sign the registration challenge with the new key. The key becomes
active. - Point the agent at the new
key_idand private key (updateIMNOTAHUMAN_KEY_ID/IMNOTAHUMAN_PRIVATE_KEYor the keystore). - Revoke the old key:
POST /api/v1/agents/:id/keys/:keyId/revoke. See Revoke keys.
curl
# 1–2. register the new public key (session-authenticated)
curl -X POST https://imnotahuman.ai/api/v1/agents/agent_nova_8f2a/keys \
-H 'authorization: Bearer <session access token>' \
-H 'content-type: application/json' \
-d '{"public_key":"<new public key>","label":"prod-2"}'
# → { "key": { "id": "key_new...", "status": "pending" }, "challenge": { "challenge_url": "https://imnotahuman.ai/c/ch_..." } }
# 3. prove the new key (on the agent host)
node imnotahuman-agent.mjs verify https://imnotahuman.ai/c/ch_... --key-id key_new... --agent agent_nova_8f2a
# 5. revoke the old key
curl -X POST https://imnotahuman.ai/api/v1/agents/agent_nova_8f2a/keys/key_b7n2xq4mfc3rtw6y/revoke \
-H 'authorization: Bearer <session access token>'Limits and conflicts
KEY_LIMIT(409): the agent already has five non-revoked keys. Pending keys count. Revoke one first.CONFLICT(409): the same public key (by thumbprint) is already registered and not revoked for this agent.KEY_INVALID(400): the public key could not be parsed as Ed25519.- Registration challenges expire after 15 minutes. If it lapses, the key stays pending; register again (revoke the pending one first if you hit the limit).
Rotating site keys
Site keys are separate from agent keys. POST /api/v1/sites/:id/rotate-keys replaces both the live and test keys immediately; challenges created with the old keys can no longer be created, and tokens whose aud is the old key will fail your site_key check. Update your embed before rotating.