cURL
curl --request POST \ --url https://console.vast.ai/api/v0/auth/apikeys/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "name": "read-only-key", "permissions": { "read": true, "write": false }, "key_params": { "ip_whitelist": [ "1.2.3.4" ] } } '
{ "id": 12345, "key": "vast-123456789abcdef", "permissions": false }
Creates a new API key with specified permissions for the authenticated user.
CLI Usage: vastai create api-key --name <name> --permission_file <permissions_file> [--key_params <params>]
vastai create api-key --name <name> --permission_file <permissions_file> [--key_params <params>]
API key must be provided in the Authorization header
Name for the API key
"read-only-key"
JSON object containing permission definitions
{ "read": true, "write": false }
Optional wildcard parameters for advanced keys
{ "ip_whitelist": ["1.2.3.4"] }
API key created successfully
The ID of the created API key
12345
The newly generated API key
"vast-123456789abcdef"
False when permissions are disabled
false