Python
import requests
url = "https://app.langwatch.ai/api/roles"
payload = {
"name": "<string>",
"permissions": ["<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>', permissions: ['<string>']})
};
fetch('https://app.langwatch.ai/api/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"permissions": [
"<string>"
]
}
'{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
],
"createdAt": "<string>",
"updatedAt": "<string>"
}Roles
Create role
Create a custom role from resource:action permission keys. The name is unique within the organization; a taken name answers 409 custom_role_name_taken.
POST
/
api
/
roles
Python
import requests
url = "https://app.langwatch.ai/api/roles"
payload = {
"name": "<string>",
"permissions": ["<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>', permissions: ['<string>']})
};
fetch('https://app.langwatch.ai/api/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"permissions": [
"<string>"
]
}
'{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
],
"createdAt": "<string>",
"updatedAt": "<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}.
Body
application/json
Was this page helpful?
⌘I