import requests
url = "https://app.langwatch.ai/api/api-keys"
payload = {
"name": "<string>",
"bindings": [{ "scopeId": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', bindings: [{scopeId: '<string>'}]})
};
fetch('https://app.langwatch.ai/api/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"bindings": [
{
"scopeId": "<string>"
}
]
}
'{
"token": "<string>",
"apiKey": {
"id": "<string>",
"name": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
}Create API key
Create a new API key. For service keys, pass keyType:“service”. Optionally scope to specific projects via projectIds (ADMIN on each). Omit projectIds for full org access. The plaintext token is returned once — store it securely.
import requests
url = "https://app.langwatch.ai/api/api-keys"
payload = {
"name": "<string>",
"bindings": [{ "scopeId": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', bindings: [{scopeId: '<string>'}]})
};
fetch('https://app.langwatch.ai/api/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"bindings": [
{
"scopeId": "<string>"
}
]
}
'{
"token": "<string>",
"apiKey": {
"id": "<string>",
"name": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
}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}.
Body
Human-readable name for this token
1 - 100Role bindings that define what this token can access
1 - 20 elementsShow child attributes
Show child attributes
Optional description
500Optional expiration date (ISO 8601)
personal = tied to a user. service = not tied to any user, for automation.
personal, service For service keys with restricted scope: list of project IDs to grant ADMIN access to. Omit for full org access.
50Was this page helpful?