create_api_key
Create a new API key. The secret key value is returned ONLY in this response — store it securely. Note: the secret will be visible in the AI conversation context.
Instructions
Create a new API key. The secret key value is returned ONLY in this response — store it securely. Note: the secret will be visible in the AI conversation context. Optionally bind the key to a sub-account via profile_id — outbound messages sent with the key are then branded as that sub-account. Optionally give it an end date with expires_at (ISO 8601 with offset, at least 5 minutes ahead); leave it out and the key never expires. Ask the user when the key should stop working rather than choosing for them. A date in the past or less than 5 minutes ahead is refused (validation_error) and nothing is created.
Agent usage: This operation requires 2FA bound to the key it creates — its environment, scopes, sub-account and end date: a code confirmed for one key does not create another. (1) Call create_api_key with what the user chose; nothing is created, and its 2fa_required refusal lists the exact targets for that key. (2) Call start_2fa with action_type "api_key_create" and exactly those targets (none if the refusal lists none); the user is shown the key they are approving. (3) Wait for the user to verify the code and poll get_2fa_status until "verified". (4) Call create_api_key again with the SAME arguments. One code creates one key.
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
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "create_api_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Human-readable key name | |
| scopes | No | Permission scopes for the key | |
| expires_at | No | When the key stops working, ISO 8601 with offset (e.g. 2027-02-13T23:59:59+01:00), at least 5 minutes ahead. Omit for a key that never expires. | |
| profile_id | No | Bind the new key to a sub-account you own (24-hex id). Immutable after creation; omit for an unbound account-wide key. | |
| environment | No | Key environment (default: production) |
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 |