Skip to content
Primary navigation

Update project role

client.admin.organization.projects.roles.update(stringroleID, RoleUpdateParams { project_id, description, permissions, role_name } params, RequestOptionsoptions?): Role { id, description, name, 4 more }
POST/projects/{project_id}/roles/{role_id}

Updates an existing project role.

ParametersExpand Collapse
roleID: string
params: RoleUpdateParams { project_id, description, permissions, role_name }
project_id: string

Path param: The ID of the project to update.

description?: string | null

Body param: New description for the role.

permissions?: Array<string> | null

Body param: Updated set of permissions for the role.

role_name?: string | null

Body param: New name for the role.

ReturnsExpand Collapse
Role { id, description, name, 4 more }

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

id: string

Identifier for the role.

description: string | null

Optional description of the role.

name: string

Unique name for the role.

object: "role"

Always role.

permissions: Array<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).

Update project role

import OpenAI from 'openai';

const client = new OpenAI({
  adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted
});

const role = await client.admin.organization.projects.roles.update('role_id', {
  project_id: 'project_id',
});

console.log(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
}