curl --request POST \
--url https://api.coderabbit.ai/v1/users/roles \
--header 'Content-Type: application/json' \
--header 'x-coderabbitai-api-key: <api-key>' \
--data '
{
"role": "6f1bb6c1-4766-4f09-9d0d-b998c33d2398",
"user_ids": [
"121358802",
"234567"
],
"org_name": "<string>",
"org_id": "<string>"
}
'import requests
url = "https://api.coderabbit.ai/v1/users/roles"
payload = {
"role": "6f1bb6c1-4766-4f09-9d0d-b998c33d2398",
"user_ids": ["121358802", "234567"],
"org_name": "<string>",
"org_id": "<string>"
}
headers = {
"x-coderabbitai-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-coderabbitai-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
role: '6f1bb6c1-4766-4f09-9d0d-b998c33d2398',
user_ids: ['121358802', '234567'],
org_name: '<string>',
org_id: '<string>'
})
};
fetch('https://api.coderabbit.ai/v1/users/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"status": "success",
"succeeded": [
"121358802"
],
"failed": [
{
"user_id": "234567",
"code": "CANNOT_CHANGE_BILLING_ADMIN_ROLE"
}
]
}{
"error": {
"code": "BATCH_SIZE_EXCEEDED",
"message": "Maximum 500 users per request"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or inactive API key"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "User does not have the required permissions"
}
}{
"error": {
"code": "LEGACY_API_KEY",
"message": "You are using a legacy API key. We are deprecating use of legacy keys. Regenerate a new API key and retry the request."
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "<string>"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal server error"
}
}Change roles for multiple users
Bulk change roles for users in the organization. Supports up to 500 users per request. Cannot modify billing admin roles. Rate limited to 10 requests per 60 seconds with max 3 concurrent requests per organization.
curl --request POST \
--url https://api.coderabbit.ai/v1/users/roles \
--header 'Content-Type: application/json' \
--header 'x-coderabbitai-api-key: <api-key>' \
--data '
{
"role": "6f1bb6c1-4766-4f09-9d0d-b998c33d2398",
"user_ids": [
"121358802",
"234567"
],
"org_name": "<string>",
"org_id": "<string>"
}
'import requests
url = "https://api.coderabbit.ai/v1/users/roles"
payload = {
"role": "6f1bb6c1-4766-4f09-9d0d-b998c33d2398",
"user_ids": ["121358802", "234567"],
"org_name": "<string>",
"org_id": "<string>"
}
headers = {
"x-coderabbitai-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-coderabbitai-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
role: '6f1bb6c1-4766-4f09-9d0d-b998c33d2398',
user_ids: ['121358802', '234567'],
org_name: '<string>',
org_id: '<string>'
})
};
fetch('https://api.coderabbit.ai/v1/users/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"status": "success",
"succeeded": [
"121358802"
],
"failed": [
{
"user_id": "234567",
"code": "CANNOT_CHANGE_BILLING_ADMIN_ROLE"
}
]
}{
"error": {
"code": "BATCH_SIZE_EXCEEDED",
"message": "Maximum 500 users per request"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or inactive API key"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "User does not have the required permissions"
}
}{
"error": {
"code": "LEGACY_API_KEY",
"message": "You are using a legacy API key. We are deprecating use of legacy keys. Regenerate a new API key and retry the request."
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "<string>"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal server error"
}
}- CLI Tool
- MCP Server
coderabbit api request /users/roles --input request.json
org_id set to ALL, CodeRabbit changes each organization separately, so the change isn’t atomic: a user is listed in succeeded only when every organization succeeded. See Change a role on every organization of a self-hosted instance.Authorizations
See Authentication for the key types and where to create a key.
Body
For workspace-scoped API keys, supply this provider organization ID or org_name, never both. For self-hosted instance keys, use a provider organization ID or ALL (case-insensitive) to apply the role change across active organizations on that instance. Omit it to preserve single-organization behavior for self-hosted keys. Organization keys remain bound to their own organization; ALL is valid only for self-hosted instance keys.
Response
Role change completed (partial or full success)
Was this page helpful?