Skip to main content
PATCH
Update virtual key

Authorizations

X-Auth-Token
string
header
required

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

Path Parameters

id
string
required

Body

application/json
name
string
Required string length: 1 - 128
description
string | null
scopes
object[]
Minimum array length: 1
trace_project_id
string | null

Where the key's traces and costs land. Omit it and the destination stays exactly where it is, scope edits included. A value moves it, validated the way create validates it. Explicit null does not clear it: it asks for the destination to be worked out again from what the key is now, under the same rules create uses. It lands on the key's single project scope when exactly one names a live project, and otherwise on the organization's oldest live governance project when there are no other live projects to choose from. An organization with live projects that could have been named refuses with gateway_trace_project_ambiguous, and one with no governance project to fall back on refuses with trace_project_required.

routing_policy_id
string | null
routing_mode
enum<string>
Available options:
none,
fallback_all,
policy
expires_at
string | null

When the key stops serving. Omit it and the stored date stays where it is; null clears it, so the key never expires; a date moves it. A key whose date has already passed accepts this edit like any other, which is how an expired key is put back in service without minting a new secret. A date in the past is refused with virtual_key_expiry_in_past.

budget
object | null
config
object
external_id
string | null
Required string length: 1 - 128
metadata
object

Response

Updated

virtual_key
object
required
Last modified on May 19, 2026