import requests
url = "https://app.langwatch.ai/api/api-keys/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.langwatch.ai/api/api-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/api-keys/{id} \
--header 'Authorization: Bearer <token>'{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"assignedToUserId": "<string>",
"createdByUserId": "<string>",
"permissions": [
"<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>",
"scopeId": "<string>"
}
],
"bindings": [
{
"scopeId": "<string>"
}
]
}Get an API key
Read one API key by id, including its role bindings, permission mode and explicit permissions. Returns your own keys; organization admins may read any key in the organization. The secret is never returned. An id that does not exist, belongs to another organization, or belongs to another member all answer 404 api_key_not_found, so the response cannot be used to probe for keys.
import requests
url = "https://app.langwatch.ai/api/api-keys/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.langwatch.ai/api/api-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/api-keys/{id} \
--header 'Authorization: Bearer <token>'{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"assignedToUserId": "<string>",
"createdByUserId": "<string>",
"permissions": [
"<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>",
"scopeId": "<string>"
}
],
"bindings": [
{
"scopeId": "<string>"
}
]
}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
API key ID
Response
The API key
personal, service The member who owns the key; null for a service key.
all, readonly, restricted The resource:action permissions a restricted key grants. Empty for the other modes.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?