Create API Key
create_api_keyGenerates an API key for a Magic Lane project so apps can authenticate with the SDK and APIs, with optional expiry and file output to share the key without revealing it.
Instructions
Create an API key for a project (the key apps use with the Magic Lane SDK and APIs; not the secret key this server runs with). Name 6–64 characters, unique in the project; optional expiry as an ISO date, default 6 months. The key is masked unless revealToken is true; set that only when the user asks to see the key. To hand the key to the user without showing it here, give tokenPath and it is written to that file (a new file; an existing one is replaced only with overwrite: true). A tokenPath that is refused stops the call before the key is created. The key can be read again later with get_api_key. A project can have at most 2 API keys: with that many there the create fails (check with list_api_keys first), and a place is freed only in the developer portal. Not idempotent. Requires "API keys: Read & write".
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": {
"projectId": "<projectId>",
"name": "<name>"
},
"name": "create_api_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | API key name, 6–64 characters, no line breaks or tabs; unique in the project. | |
| expiresAt | No | When the key expires, as an ISO 8601 date or date-time (a date alone means 00:00 UTC, and a date-time without an offset is taken as UTC). In the future and at most 10 years ahead. Default: 6 months from now (as in the portal). | |
| overwrite | No | Replace the file at tokenPath if it exists. Default false: an existing file is refused. Set it only when the user wants that file replaced. | |
| projectId | Yes | Project id (UUID), from list_projects or create_project. | |
| tokenPath | No | Write the full API key to this file (absolute, or relative to the folder MAGICLANE_FILES_DIR names when the server has one, otherwise the server's working directory), created readable only by the user where the system supports it. An existing file is replaced only with overwrite: true, and a network path is refused. A path that starts with ~/ or ~user/ is refused: ~ is not read as a home folder. The key itself is not put in the result. | |
| revealToken | No | Return the full API key in the result. Default false: the key is masked (only its last 4 characters). Set true only when the user asks to see the key; prefer tokenPath when it is available. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | The API key, masked unless the full key was asked for. | |
| notes | Yes | Things to know about this result. |