import requests
url = "https://app.langwatch.ai/api/gateway/v1/virtual-keys/{id}/rotate"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/virtual-keys/{id}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/gateway/v1/virtual-keys/{id}/rotate \
--header 'X-Auth-Token: <api-key>'{
"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": true,
"external_id": "<string>",
"metadata": {},
"scopes": [
{
"scope_type": "organization",
"scope_id": "<string>"
}
],
"routing_policy_id": "<string>",
"routing_mode": "none",
"config": "<unknown>",
"revision": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
},
"secret": "<string>"
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}Rotate virtual key secret
Mints a fresh secret for an existing VK. The old secret remains valid for 24h.
import requests
url = "https://app.langwatch.ai/api/gateway/v1/virtual-keys/{id}/rotate"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/virtual-keys/{id}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/gateway/v1/virtual-keys/{id}/rotate \
--header 'X-Auth-Token: <api-key>'{
"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": true,
"external_id": "<string>",
"metadata": {},
"scopes": [
{
"scope_type": "organization",
"scope_id": "<string>"
}
],
"routing_policy_id": "<string>",
"routing_mode": "none",
"config": "<unknown>",
"revision": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
},
"secret": "<string>"
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}Authorizations
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.
Headers
A caller-chosen key, 8 to 255 characters, that makes this create safe to retry. The first request to use a key runs normally and its response is stored for 24 hours. A later request with the same key and the same body is not executed again: it returns the stored response, marked with X-Idempotent-Replay: true. The same key with a different body is refused 409 idempotency_error, as is a retry sent while the original is still running. Only successful responses are stored, so a create that failed can simply be retried with the same key.
8 - 255Path Parameters
1Was this page helpful?