For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
  • API Guides
    • Overview
    • Streaming
    • Embeddings
    • Limits
    • Authentication
    • Parameters
    • Errors and Debugging
  • API Reference
      • GETGet current API key
      • GETList API keys
      • POSTCreate a new API key
      • GETGet a single API key
      • DELDelete an API key
      • PATCHUpdate an API key
LogoLogo
ModelsChatRankingsDocs
API ReferenceAPI Keys

Update an API key

PATCH
https://openrouter.ai/api/v1/keys/:hash
PATCH
/api/v1/keys/:hash
$curl -X PATCH https://openrouter.ai/api/v1/keys/f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "disabled": false,
> "include_byok_in_limit": true,
> "limit": 75,
> "limit_reset": "daily",
> "name": "Updated API Key Name"
>}'
1{
2 "data": {
3 "byok_usage": 17.38,
4 "byok_usage_daily": 17.38,
5 "byok_usage_monthly": 17.38,
6 "byok_usage_weekly": 17.38,
7 "created_at": "2025-08-24T10:30:00Z",
8 "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
9 "disabled": false,
10 "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
11 "include_byok_in_limit": true,
12 "label": "Updated API Key Name",
13 "limit": 75,
14 "limit_remaining": 49.5,
15 "limit_reset": "daily",
16 "name": "Updated API Key Name",
17 "updated_at": "2025-08-24T16:00:00Z",
18 "usage": 25.5,
19 "usage_daily": 25.5,
20 "usage_monthly": 25.5,
21 "usage_weekly": 25.5,
22 "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11",
23 "expires_at": null
24 }
25}

Update an existing API key. Management key required.

Was this page helpful?
Previous

Create a message

Next
Built with

Authentication

AuthorizationBearer
API key as bearer token in Authorization header

Path parameters

hashstringRequired
The hash identifier of the API key to update

Request

This endpoint expects an object.
disabledbooleanOptional
Whether to disable the API key
include_byok_in_limitbooleanOptional
Whether to include BYOK usage in the limit
limitdouble or nullOptional
New spending limit for the API key in USD
limit_resetenum or nullOptional

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:
namestringOptional
New name for the API key

Response

API key updated successfully
dataobject
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