> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ariacompute.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api/api-keys — 创建新的 API 密钥

> 在账户上创建一个新的 bfvk API 密钥。完整密钥值仅返回一次，请立即存入密钥管理器。

在账户上创建一个新的 `bfvk-` API 密钥。完整的密钥值仅在响应体中返回一次。请立即存储：后续的列表调用只返回前缀。

**方法：** `POST` **路径：** `/api/api-keys` **认证：** 会话 Bearer

## 请求

<ParamField body="name" type="string" required>
  密钥的可读名称。显示在控制台与 `GET /api/api-keys` 中。
</ParamField>

## 响应

<ResponseField name="id" type="string">
  稳定的密钥标识。
</ResponseField>

<ResponseField name="name" type="string">
  你提供的名称。
</ResponseField>

<ResponseField name="key" type="string">
  完整 API 密钥，以 `bfvk-` 前缀开头。仅返回一次。
</ResponseField>

<ResponseField name="prefix" type="string">
  密钥的前几个字符。
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 时间戳。
</ResponseField>

<Warning>
  `key` 字段是完整值唯一出现的位置。在关闭标签页前复制它。
</Warning>

## 示例

```bash theme={null}
curl -X POST https://ariacompute.cn/api/api-keys \
  -H "Authorization: Bearer eyJhbGciOi..." \
  -H "Content-Type: application/json" \
  -d '{"name": "production"}'
```

```json theme={null}
{
  "id": "key_01H...",
  "name": "production",
  "key": "bfvk-4z9CXXXXXXXXXXXXXXX",
  "prefix": "bfvk-4z9C",
  "created_at": "2026-09-23T10:00:00Z"
}
```

## 错误

| 状态    | 含义          |
| ----- | ----------- |
| `400` | 缺失 `name`。  |
| `401` | 缺失或无效的会话令牌。 |
