import requests
url = "https://app.langwatch.ai/api/v1/role-bindings"
payload = { "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({scopeId: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/role-bindings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/role-bindings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopeId": "<string>"
}
'{
"id": "<string>",
"principal": {
"type": "user",
"id": "<string>",
"name": "<string>"
},
"role": "ADMIN",
"customRoleId": "<string>",
"customRoleName": "<string>",
"scopeType": "PROJECT",
"scopeId": "<string>",
"scopeName": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}Create role binding
Create a role binding for exactly one principal: a user, a group, or an API key. Every reference is checked against the caller’s organization; an identical binding is written again, because bindings are never unique. Pass expiresAt to time-box the access: it stops granting at that moment on its own, without being revoked, and a date that has already passed answers 422 grant_expiry_in_past. The response always carries the new binding’s id; the names of its principal, role and scope may be absent on this response alone, and a follow-up read carries them. superseded by /api/grants, which answers the same rows as grants
import requests
url = "https://app.langwatch.ai/api/v1/role-bindings"
payload = { "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({scopeId: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/role-bindings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/role-bindings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopeId": "<string>"
}
'{
"id": "<string>",
"principal": {
"type": "user",
"id": "<string>",
"name": "<string>"
},
"role": "ADMIN",
"customRoleId": "<string>",
"customRoleName": "<string>",
"scopeType": "PROJECT",
"scopeId": "<string>",
"scopeName": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "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
ADMIN, MEMBER, VIEWER, CUSTOM PROJECT, TEAM, ORGANIZATION 11111Response
Success
Show child attributes
Show child attributes
ADMIN, MEMBER, VIEWER, CUSTOM PROJECT, TEAM, ORGANIZATION Was this page helpful?