regenerate_api_key
Regenerate an API key: issues a new key (a new id and secret) with the same name, environment, scopes and sub-account. Pass expires_at to choose when the new key stops working — a date, or null for never; leave it out and the new key keeps…
Instructions
Regenerate an API key: issues a new key (a new id and secret) with the same name, environment, scopes and sub-account. Pass expires_at to choose when the new key stops working — a date, or null for never; leave it out and the new key keeps the old key's end date (or none). Ask the user rather than choosing. The answer's expires_at is when the new key stops working (carried from the old key when you send none); with no expires_at the new key never expires. A key whose expires_at has passed (see list_api_keys) is refused (api_key_expired) and a new date does not revive it, so check it before starting 2FA: for a key an MCP sign-in minted the message reads "This key stopped working on and can't be turned back on. Connect your AI client again to get a new one."; for any other key, "This key stopped working on and can't be turned back on. Create a new key." The old key stops working immediately; use the id in this response from now on. The new key lists the old one in replaced_key_ids, so its requests and usage stay with it. The new secret is returned ONLY in this response. Note: the secret will be visible in the AI conversation context.
Agent usage: This operation requires 2FA bound to this key and to the end date sent (none sent, a date, and null are three different confirmations). (1) Call regenerate_api_key with the end date the user chose, or none; its 2fa_required refusal lists the exact targets — [""] with no expires_at, ["", "act:expires_at:<the instant as UTC ISO 8601 with milliseconds>"] for a date, "act:expires_at:never" for null. (2) Call start_2fa with action_type "api_key_regenerate" and exactly those targets; the user is shown the new end date (or "never") they are approving. (3) Wait for the user to verify the code and poll get_2fa_status until "verified". (4) Call regenerate_api_key again with the SAME expires_at.
ACCESS: needs a Proof account, signed in: call start_login, show the user its challenge, then wait_for_login, then call this tool again. An API key alone does NOT open this tool.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>"
},
"name": "regenerate_api_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | API key ID to regenerate | |
| expires_at | No | When the new key stops working, ISO 8601 with offset, at least 5 minutes ahead — or null for a key that never expires. Leave it out to keep the old key's end date. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | MongoDB ObjectId | |
| key | Yes | The full API key. Returned only in this response; it cannot be read again. | |
| name | Yes | ||
| prefix | Yes | ||
| scopes | Yes | ||
| warning | Yes | ||
| created_at | Yes | ||
| expires_at | No | When the key stops working. Present when the key has an expiry: the one asked for at creation; on a regenerated key the one asked for while regenerating, else the old key's instant, carried over. Absent on a key that never expires. | |
| profile_id | Yes | Sub-account (PublicProfile) the key is bound to; null for unbound keys. | |
| environment | Yes |