Update an API key
PATCH
https://novapai.ai/api/v1/keys/:hash
PATCH
/api/v1/keys/:hash
cURL
$curl -X PATCH https://novapai.ai/api/v1/keys/f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 \
>-H "Authorization: Bearer <token>" \
>-H "Content-Type: application/json" \
>-d '\{
>"name": "Updated API Key Name",
>"disabled": false,
>"limit": 75,
>"limit_reset": "daily",
>"include_byok_in_limit": true
>\}'200 Updated
reference-api-keys-update-keys-01.json
{
"data": {
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"name": "Updated API Key Name",
"label": "Updated API Key Name",
"disabled": false,
"limit": 75,
"limit_remaining": 49.5,
"limit_reset": "daily",
"include_byok_in_limit": true,
"usage": 25.5,
"usage_daily": 25.5,
"usage_weekly": 25.5,
"usage_monthly": 25.5,
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_weekly": 17.38,
"byok_usage_monthly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"updated_at": "2025-08-24T16:00:00Z"
}
}
```sql showLineNumbers filename="reference-api-keys-update-keys-02.sql"
Update an existing API key. [Management key](http://novapai.ai/docs/guides/overview/auth/management-api-keys) required.
### Authentication
Authorization Bearer
API key as bearer token in Authorization header
### Path parameters
hash string Required
The hash identifier of the API key to update
### Request
This endpoint expects an object.
| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| name | string | 否 | New name for the API key |
| disabled | boolean | 否 | Whether to disable the API key |
| limit | double or null | 否 | New spending limit for the API key in USD |
| limit_reset | enum or null | 否 | New limit reset type 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 |
### Response
API key updated successfully
| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| data | object | - | The updated API key information |
### Errors
| 状态码 | 说明 |
| --- | --- |
| 400 | Bad Request Error |
| 401 | Unauthorized Error |
| 404 | Not Found Error |
| 429 | Too Many Requests Error |
| 500 | Internal Server Error |