Skip to contentSkip to page list

Docs

Disable virtual key

Reversible stop: requests on the key are rejected with virtual_key_disabled until it is enabled again. Idempotent.

POST/api/gateway/v1/virtual-keys/{id}/disable
Request and response examples
request.py
import osimport requests​origin = "https://app.langwatch.ai"path = "/api/gateway/v1/virtual-keys/<id>/disable"api_key = os.environ["LANGWATCH_API_KEY"]headers = {    "X-Auth-Token": api_key,}​response = requests.post(    origin + path,    headers=headers,)print(response.json())

Success

application/json · Generated from schema

{  "virtual_key": {    "id": "string",    "organization_id": "string",    "name": "string",    "description": "string",    "status": "active",    "purpose": "user",    "display_prefix": "string",    "principal_user_id": "string",    "trace_project_id": "string",    "trace_project_archived": false,    "external_id": "string",    "metadata": {},    "scopes": [      {        "scope_type": "organization",        "scope_id": "string"      }    ],    "routing_policy_id": "string",    "routing_mode": "none",    "config": null,    "revision": "string",    "created_at": "2026-01-01T00:00:00Z",    "updated_at": "2026-01-01T00:00:00Z",    "last_used_at": "2026-01-01T00:00:00Z",    "revoked_at": "2026-01-01T00:00:00Z",    "expires_at": "2026-01-01T00:00:00Z"  }}
api-reference/gateway-virtual-keys/disable-virtual-key

Authorization

X-Auth-Tokenstringheaderrequired

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

idstringrequired
At least 1 character

Request body

application/json

reasonstring
Up to 500 characters

Responses

200

Success

application/json

virtual_keyobjectrequired
idstringrequired
organization_idstringrequired
namestringrequired
descriptionstring | nullrequired
statusstringrequired
One of"active""disabled""revoked"
purposestringrequired
One of"user""langy"
display_prefixstringrequired
principal_user_idstring | nullrequired
trace_project_idstring | nullrequired

The project this key's traces and costs land in. Not a scope: it grants no access to the key. Null only on a key created before this was stored.

trace_project_archivedbooleanrequired

True when the project in trace_project_id has been deleted. The key goes on sending its traces there.

external_idstring | nullrequired
metadataobjectrequired
scopesobject[]required
routing_policy_idstring | nullrequired
routing_modestringrequired
One of"none""fallback_all""policy"
configanyrequired
revisionstringrequired
created_atstring (date-time)required
Pattern ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
updated_atstring (date-time)required
Pattern ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
last_used_atstring (date-time) | nullrequired
revoked_atstring (date-time) | nullrequired
expires_atstring (date-time) | nullrequired

When the key stops serving, or null for a key that never expires. status stays active past the date on purpose.

400

Bad Request

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]
401

Unauthorized

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]
403

Forbidden

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]
500

Internal Server Error

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]

Documentation