Skip to content
Primary navigation

Update project role

admin.organization.projects.roles.update(strrole_id, RoleUpdateParams**kwargs) -> Role
POST/projects/{project_id}/roles/{role_id}

Updates an existing project role.

ParametersExpand Collapse
project_id: str
role_id: str
description: Optional[str]

New description for the role.

permissions: Optional[Sequence[str]]

Updated set of permissions for the role.

role_name: Optional[str]

New name for the role.

ReturnsExpand Collapse
class Role: …

Details about a role that can be assigned through the public Roles API.

id: str

Identifier for the role.

description: Optional[str]

Optional description of the role.

name: str

Unique name for the role.

object: Literal["role"]

Always role.

permissions: List[str]

Permissions granted by the role.

predefined_role: bool

Whether the role is predefined and managed by OpenAI.

resource_type: str

Resource type the role is bound to (for example api.organization or api.project).

Update project role

import os
from openai import OpenAI

client = OpenAI(
    admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"),  # This is the default and can be omitted
)
role = client.admin.organization.projects.roles.update(
    role_id="role_id",
    project_id="project_id",
)
print(role.id)
{
    "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
}