Create project role
POST/projects/{project_id}/roles
Creates a custom role for a project.
Path Parameters
project_id: string
Body ParametersJSON
permissions: array of string
Permissions to grant to the role.
role_name: string
Unique name for the role.
description: optional string
Optional description of the role.
Returns
id: string
Identifier for the role.
description: string
Optional description of the role.
name: string
Unique name for the role.
object: "role"
Always role.
permissions: array of string
Permissions granted by the role.
predefined_role: boolean
Whether the role is predefined and managed by OpenAI.
resource_type: string
Resource type the role is bound to (for example api.organization or api.project).
Create project role
curl -X POST https://api.openai.com/v1/projects/proj_abc123/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_name": "API Project Key Manager",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"description": "Allows managing API keys for the project"
}'
{
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}
Returns Examples
{
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}