import requests
url = "https://app.langwatch.ai/api/v1/api-keys/{id}"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://app.langwatch.ai/api/v1/api-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://app.langwatch.ai/api/v1/api-keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"roleBindings": [
{
"id": "<string>",
"role": "ADMIN",
"scopeType": "ORGANIZATION",
"scopeId": "<string>"
}
],
"keyType": "personal",
"assignedToUserId": "<string>",
"createdByUserId": "<string>",
"permissionMode": "<string>",
"permissions": [
"<string>"
],
"bindings": [
{
"role": "ADMIN",
"scopeType": "ORGANIZATION",
"scopeId": "<string>"
}
]
}This response has no body data.This response has no body data.This response has no body data.This response has no body data.This response has no body data.Update an API key
Update an API key’s name, description, permission mode, permissions or bindings. Every field is optional; bindings are replaced outright, and the response is exactly what a subsequent GET returns. You may update your own keys; organization admins may update any key in the organization. Bindings can never exceed the access of the member the key belongs to, and a key can grant at most what the key making the request holds. The token itself never changes.
import requests
url = "https://app.langwatch.ai/api/v1/api-keys/{id}"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://app.langwatch.ai/api/v1/api-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://app.langwatch.ai/api/v1/api-keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"roleBindings": [
{
"id": "<string>",
"role": "ADMIN",
"scopeType": "ORGANIZATION",
"scopeId": "<string>"
}
],
"keyType": "personal",
"assignedToUserId": "<string>",
"createdByUserId": "<string>",
"permissionMode": "<string>",
"permissions": [
"<string>"
],
"bindings": [
{
"role": "ADMIN",
"scopeType": "ORGANIZATION",
"scopeId": "<string>"
}
]
}This response has no body data.This response has no body data.This response has no body data.This response has no body data.This response has no body data.Authorizations
Admin API key for organization-level operations (managing projects, API keys). Create one in Settings > API Keys or via POST /api/api-keys. Format: sk-lw-{id}_{secret}.
Path Parameters
1Body
1 - 100500'all' and 'readonly' take their meaning from the bindings alone; 'restricted' additionally requires an explicit permissions list.
all, readonly, restricted Restricted mode only: the exact resource:action permissions the key's CUSTOM bindings grant.
^[a-z][a-zA-Z0-9_-]*:[a-z][a-zA-Z0-9_-]*$Replaces the key's bindings outright. Whatever is accepted here is exactly what a subsequent GET returns.
1 - 20 elementsShow child attributes
Show child attributes
Response
Success
1Show child attributes
Show child attributes
personal, service ^[a-z][a-zA-Z0-9_-]*:[a-z][a-zA-Z0-9_-]*$Show child attributes
Show child attributes
Was this page helpful?