set_api_key_expiry
Change when an API key stops working: set an end date on a key that has none, move it earlier or later, or pass expires_at null so the key never expires.
Instructions
Change when an API key stops working: set an end date on a key that has none, move it earlier or later, or pass expires_at null so the key never expires. The key keeps its id, secret, scopes and sub-account; only the date changes, and nothing extends it later. Answers the key as list_api_keys shows it.
Refused before any 2FA code is asked for: a key that is not one of the account's live keys (not_found); a key whose expires_at has passed (api_key_expired — it cannot be revived, create a new key instead); a key an MCP sign-in renews itself (api_key_managed_by_sign_in — list_api_keys shows managed_by_sign_in: true; the user disconnects the AI client to end it). Check list_api_keys first so you do not start 2FA for a refused change.
Agent usage: This operation requires 2FA bound to this key AND this exact value, shortening included: a code confirmed for one date does not set another date or "never". (1) Call set_api_key_expiry with the value the user chose; its 2fa_required refusal lists the exact targets — ["", "act:expires_at:<the instant as UTC ISO 8601 with milliseconds, e.g. 2027-02-09T14:59:59.999Z>"], or "act:expires_at:never" for null. (2) Call start_2fa with action_type "api_key_expiry" and exactly those targets; the user is shown the date (or "never") they are approving. (3) Wait for the user to verify the code and poll get_2fa_status until "verified". (4) Call set_api_key_expiry again with the SAME value. One code covers one change.
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>",
"expires_at": "<expires_at>"
},
"name": "set_api_key_expiry"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | API key ID | |
| expires_at | Yes | The new end date, ISO 8601 with offset, at least 5 minutes ahead — or null for a key that never expires. Ask the user rather than choosing. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | A live API key as the owner's key list shows it. Never carries the key value. |