---
title: "create api-key"
method: POST
path: "/api/v0/auth/apikeys/"
tags: ["Accounts"]
---

# create api-key

`POST /api/v0/auth/apikeys/`

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>]`

## Request body

- object
  - `name` string, required — Name for the API key
  - `permissions` object — JSON object containing permission definitions
  - `key_params` object — Optional wildcard parameters for advanced keys

## Response `200`

API key created successfully

- object
  - `id` integer — The ID of the created API key
  - `key` string — The newly generated API key
  - `permissions` union
    - boolean — False when permissions are disabled
    - object — Object defining the permissions when enabled

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `429` — Too Many Requests

---

[API](https://skmtc.net/vast/apis/vast-ai-api.md) · [All operations](https://skmtc.net/vast/apis/vast-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vast/vast-ai-api/revisions/4ed14f79f796/schema)
