Change a grant's role
import requests
url = "https://app.langwatch.ai/api/v1/grants/{grantId}"
payload = { "roleId": "<string>" }
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({roleId: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/grants/{grantId}', 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/grants/{grantId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"roleId": "<string>"
}
'{
"id": "<string>",
"principal": {
"type": "user",
"id": "<string>",
"name": "<string>"
},
"role": {
"id": "<string>",
"name": "<string>",
"builtIn": true
},
"scope": {
"type": "organization",
"id": "<string>",
"name": "<string>"
},
"status": "active",
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z"
}Grants
Change a grant's role
Change the role a grant confers. The principal and scope are the grant’s identity and do not change. Lowering the organization’s last administrator answers cannot_demote_last_admin. A grant never confers a permission the caller does not hold at that scope: 403 grant_exceeds_caller_permissions names the missing permissions.
PATCH
/
api
/
v1
/
grants
/
{grantId}
Change a grant's role
import requests
url = "https://app.langwatch.ai/api/v1/grants/{grantId}"
payload = { "roleId": "<string>" }
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({roleId: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/grants/{grantId}', 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/grants/{grantId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"roleId": "<string>"
}
'{
"id": "<string>",
"principal": {
"type": "user",
"id": "<string>",
"name": "<string>"
},
"role": {
"id": "<string>",
"name": "<string>",
"builtIn": true
},
"scope": {
"type": "organization",
"id": "<string>",
"name": "<string>"
},
"status": "active",
"expiresAt": "2023-11-07T05:31:56Z",
"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}.
Path Parameters
Required string length:
1 - 128Body
application/json
Required string length:
1 - 128Response
200 - application/json
Success
Last modified on October 12, 2026
Was this page helpful?