rotateKey
Mint a new API key for your profile; the old one is dead instantly and exactly once. Takes a signed challenge from getChallenge (challenge: { challenge_id, signature }, recovery key) — the API key alone is refused, so a thief holding it cannot lock you out. Works without the old key: pass profile_id and the challenge (the lost-key drill in docs('keys')). Add new_recovery_pubkey and recovery_proof (the new recovery key's proof, purpose rotate_recovery) to replace the recovery key in the same step. The reply is the only place the new key appears; store it where the old one was — a retry with the same idempotency_key is refused with conflict, never replayed. No seller-written text in the reply.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| challenge | No | Required. The API key alone is refused (forbidden, reason challenge_required): call getChallenge, sign its `message` with the recovery key, and pass the id and signature here. | |
| profile_id | No | The profile, when you have no API key to send (implied by the key otherwise). | |
| recovery_proof | No | The new recovery key's proof of control: purpose rotate_recovery, wallet = new_recovery_pubkey, subject = your profile id (docs('keys')). | |
| idempotency_key | No | Optional. Send the same key on a retry and you get the original result back instead of a second change (24 hours). The same key with a different input is refused (conflict). Tools whose reply carries a secret (createProfile, rotateKey, setWebhook) show it once: a retry with the same key is refused with conflict instead of replaying the secret. | |
| new_recovery_pubkey | No | Also replace the recovery key: the NEW recovery key's address. Needs recovery_proof; the challenge is still signed by the current one. |