Skip to content
Primary navigation

Modify project user

client.admin.organization.projects.users.update(stringuserID, UserUpdateParams { project_id, role } params, RequestOptionsoptions?): ProjectUser { id, added_at, object, 3 more }
POST/organization/projects/{project_id}/users/{user_id}

Modifies a user’s role in the project.

ParametersExpand Collapse
userID: string
params: UserUpdateParams { project_id, role }
project_id: string

Path param: The ID of the project.

role?: string | null

Body param: owner or member

ReturnsExpand Collapse
ProjectUser { id, added_at, object, 3 more }

Represents an individual user in a project.

id: string

The identifier, which can be referenced in API endpoints

added_at: number

The Unix timestamp (in seconds) of when the project was added.

formatunixtime
object: "organization.project.user"

The object type, which is always organization.project.user

role: string

owner or member

email?: string | null

The email address of the user

name?: string | null

The name of the user

Modify project user

import OpenAI from 'openai';

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

const projectUser = await client.admin.organization.projects.users.update('user_id', {
  project_id: 'project_id',
});

console.log(projectUser.id);
{
    "object": "organization.project.user",
    "id": "user_abc",
    "name": "First Last",
    "email": "user@example.com",
    "role": "owner",
    "added_at": 1711471533
}
Returns Examples
{
    "object": "organization.project.user",
    "id": "user_abc",
    "name": "First Last",
    "email": "user@example.com",
    "role": "owner",
    "added_at": 1711471533
}