Skip to content
Primary navigation

Modify user

client.admin.organization.users.update(stringuserID, UserUpdateParams { developer_persona, role, role_id, technical_level } body, RequestOptionsoptions?): OrganizationUser { id, added_at, object, 13 more }
POST/organization/users/{user_id}

Modifies a user’s role in the organization.

ParametersExpand Collapse
userID: string
body: UserUpdateParams { developer_persona, role, role_id, technical_level }
developer_persona?: string | null

Developer persona metadata.

role?: string | null

owner or reader

role_id?: string | null

Role ID to assign to the user.

technical_level?: string | null

Technical level metadata.

ReturnsExpand Collapse
OrganizationUser { id, added_at, object, 13 more }

Represents an individual user within an organization.

id: string

The identifier, which can be referenced in API endpoints

added_at: number

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

formatunixtime
object: "organization.user"

The object type, which is always organization.user

api_key_last_used_at?: number | null

The Unix timestamp (in seconds) of the user’s last API key usage.

formatunixtime
created?: number

The Unix timestamp (in seconds) of when the user was created.

formatunixtime
developer_persona?: string | null

The developer persona metadata for the user.

email?: string | null

The email address of the user

is_default?: boolean

Whether this is the organization’s default user.

is_scale_tier_authorized_purchaser?: boolean | null

Whether the user is an authorized purchaser for Scale Tier.

is_scim_managed?: boolean

Whether the user is managed through SCIM.

is_service_account?: boolean

Whether the user is a service account.

name?: string | null

The name of the user

projects?: Projects | null

Projects associated with the user, if included.

data: Array<Data>
id?: string | null
name?: string | null
role?: string | null
object: "list"
role?: string | null

owner or reader

technical_level?: string | null

The technical level metadata for the user.

user?: User { id, object, banned, 5 more }

Nested user details.

id: string
object: "user"
banned?: boolean | null
banned_at?: number | null
formatunixtime
email?: string | null
enabled?: boolean | null
name?: string | null
picture?: string | null

Modify user

import OpenAI from 'openai';

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

const organizationUser = await client.admin.organization.users.update('user_id');

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