Create Project Role
(v2)POST
Creates a custom role in this project from a set of project policies and returns the role. Its permissions are the union of what those policies grant, so a role created with an empty policyIds can do nothing until you attach one, and it grants nobody anything until a project member is assigned to it.
curl -X POST "https://api.confident-ai.com/v2/projects/{projectId}/roles" \
-H "CONFIDENT_API_KEY: <ORGANIZATION-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Billing Auditor",
"description": "Read-only access to invoices and model costs.",
"policyIds": [
"<POLICY-ID>"
]
}'{
"success": true,
"data": {
"id": "<ROLE-ID>",
"name": "Release Manager",
"description": "Can publish prompts and run evaluations, but not delete data.",
"policies": [
{
"id": "<POLICY-ID>",
"name": "Billing read-only"
}
],
"projectId": "<PROJECT-ID>"
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe organization API key for your Confident AI organization.
Path parameters
projectIdstringRequiredThe id of the project, which must belong to your organization.
Request body
namestringRequiredThe name of the role, unique among the roles the organization or project can use. It cannot match the name of a global, system-defined role, compared without regard to case.
descriptionstring | nullWhat the role is for. On an update, omit it to leave the stored description unchanged, or send
nullto clear it.policyIdslist of stringsRequiredThe ids of the policies to attach to the role, which is what gives the role its permissions. This is the role's complete policy set: on an update the list replaces what is stored rather than adding to it, and an empty array leaves the role with no permissions at all. Discover assignable policies with the policies endpoint of the same scope.
Response
Create Project Role succeeded.
successbooleanIndicates if the request was successful.
dataobjectA named set of project policies that a project member can hold. A member holds at most one role per project, and every permission they have in that project comes from the policies attached to it.
Show 5 propertiesHide 5 properties
idstringThe id of the role, generated by Confident AI.
namestringThe name of the role.
descriptionstring | nullWhat the role is for, or
nullwhen it has no description.policieslist of objectsThe project policies attached to the role, whose permissions together are everything a member holding it can do in the project. A global role's permissions are system-defined rather than drawn from policies, so its list is empty.
Show 2 propertiesHide 2 properties
idstringThe id of the policy, generated by Confident AI.
namestringThe name of the policy.
projectIdstring | null
deprecatedbooleanIndicates if this endpoint is deprecated.