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
      • GETList BYOK provider credentials
      • POSTCreate a BYOK provider credential
      • GETGet a BYOK provider credential
      • DELDelete a BYOK provider credential
      • PATCHUpdate a BYOK provider credential
LogoLogo
ModelsChatRankingsDocs
API ReferenceByok

Update a BYOK provider credential

PATCH
https://openrouter.ai/api/v1/byok/:id
PATCH
/api/v1/byok/:id
$curl -X PATCH https://openrouter.ai/api/v1/byok/11111111-2222-3333-4444-555555555555 \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "disabled": false,
> "name": "Updated OpenAI Key"
>}'
1{
2 "data": {
3 "allowed_api_key_hashes": null,
4 "allowed_models": null,
5 "allowed_user_ids": null,
6 "created_at": "2025-08-24T10:30:00Z",
7 "disabled": false,
8 "id": "11111111-2222-3333-4444-555555555555",
9 "is_fallback": false,
10 "label": "sk-...AbCd",
11 "provider": "openai",
12 "sort_order": 0,
13 "workspace_id": "550e8400-e29b-41d4-a716-446655440000",
14 "name": "Updated OpenAI Key"
15 }
16}

Update an existing bring-your-own-key (BYOK) provider credential by its id. Include the key field to rotate the raw provider API key in-place (the previous key material is overwritten). Management key required.

Was this page helpful?
Previous

Create a chat completion

Next
Built with

Authentication

AuthorizationBearer
API key as bearer token in Authorization header

Path parameters

idstringRequiredformat: "uuid"

The BYOK credential ID (UUID).

Request

This endpoint expects an object.
allowed_modelslist of strings or nullOptional

Optional allowlist of model slugs this credential may be used for. null means no restriction.

allowed_user_idslist of strings or nullOptional

Optional allowlist of user IDs that may use this credential. null means no restriction.

disabledbooleanOptional
Whether this credential is disabled.
is_fallbackbooleanOptional

Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried.

keystringOptional>=1 character

A new raw provider API key to rotate the credential in-place. The previous key material is overwritten and the masked label is regenerated. Encrypted at rest and never returned in API responses.

namestring or nullOptional<=255 characters

Optional human-readable name for the credential.

Response

BYOK credential updated successfully
dataobject
The updated BYOK credential.

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
500
Internal Server Error