Create a new API key
POST
https://novapai.ai/api/v1/keys
POST
/api/v1/keys
cURL
$curl -X POST https://novapai.ai/api/v1/keys \
>-H "Authorization: Bearer <token>" \
>-H "Content-Type: application/json" \
>-d '\{
>"name": "Analytics Service Key",
>"limit": 150,
>"limit_reset": "monthly",
>"include_byok_in_limit": true,
>"expires_at": "2028-06-30T23:59:59Z"
>\}'201 Created
reference-api-keys-create-keys-01.json
{
"data": {
"hash": "a3f5c9d8e7b4f2a1c6d8e9f0b7a3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1",
"name": "Analytics Service Key",
"label": "sk-or-v1-analytics-3f5c9d8e",
"disabled": false,
"limit": 150,
"limit_remaining": 150,
"limit_reset": "monthly",
"include_byok_in_limit": true,
"usage": 0,
"usage_daily": 0,
"usage_weekly": 0,
"usage_monthly": 0,
"byok_usage": 0,
"byok_usage_daily": 0,
"byok_usage_weekly": 0,
"byok_usage_monthly": 0,
"created_at": "2026-04-01T09:00:00Z",
"expires_at": "2028-06-30T23:59:59Z"
},
"key": "sk-or-v1-analytics-3f5c9d8e7b4f2a1c6d8e9f0b7a3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1"
}Create a new API key for the authenticated user. Management key required.
Authentication
Authorization Bearer
API key as bearer token in Authorization header
Request
This endpoint expects an object.
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | >=1 character Name for the new API key |
| limit | double or null | 否 | Optional spending limit for the API key in USD |
| limit_reset | enum or null | 否 | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. Allowed values:daily weekly monthly |
| include_byok_in_limit | boolean | 否 | Whether to include BYOK usage in the limit |
| expires_at | datetime or null | 否 | Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected |
Response
API key created successfully
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | object | - | The created API key information |
| key | string | - | The actual API key string (only shown once) |
Errors
| 状态码 | 说明 |
|---|---|
| 400 | Bad Request Error |
| 401 | Unauthorized Error |
| 429 | Too Many Requests Error |
| 500 | Internal Server Error |