Create Project Role
POSThttps://api.confident-ai.com/v1/projects/{projectId}/roles
Creates a custom project role from a set of policies. The role name must be unique within the project and cannot collide with a system-defined role name.
curl -X POST "https://api.confident-ai.com/v1/projects/{projectId}/roles" \
-H "CONFIDENT_API_KEY: <ORGANIZATION-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Analyst",
"description": "Read-only project access",
"policyIds": [
"policy-uuid-1"
]
}'{
"success": true,
"data": {
"role": {
"id": "project-role-uuid-3",
"name": "Analyst",
"description": "Read-only project access",
"projectId": "PROJECT-ID",
"policies": [
{
"id": "policy-uuid-1",
"name": "View traces"
}
]
}
}
}Headers
CONFIDENT_API_KEYstringRequiredThe organization API key for your Confident AI organization.
Path parameters
projectIdstringRequiredThe unique identifier of the project.
Request body
namestringRequiredName of the role (must be unique within the organization and cannot be a system role name)
descriptionstringOptional description of the role
policyIdslist of stringsRequiredThe ids of the policies to attach to this role
Response
successbooleanIndicates if the request was successful
dataobjectShow 1 propertyHide 1 property
roleobjectShow 5 propertiesHide 5 properties
idstringUnique identifier for the role
namestringName of the role
descriptionstringOptional description of the role
projectIdstringThe owning project id, or
nullfor global, system-defined roles that are available to every project.policieslist of objectsThe policies attached to this role
Show 2 propertiesHide 2 properties
idstringUnique identifier
namestringName