Skip to content
Primary navigation

Unassign organization role from user

client.admin.organization.users.roles.delete(stringroleID, RoleDeleteParams { user_id } params, RequestOptionsoptions?): RoleDeleteResponse { deleted, object }
DELETE/organization/users/{user_id}/roles/{role_id}

Unassigns an organization role from a user within the organization.

ParametersExpand Collapse
roleID: string
params: RoleDeleteParams { user_id }
user_id: string

The ID of the user to modify.

ReturnsExpand Collapse
RoleDeleteResponse { deleted, object }

Confirmation payload returned after unassigning a role.

deleted: boolean

Whether the assignment was removed.

object: string

Identifier for the deleted assignment, such as group.role.deleted or user.role.deleted.

Unassign organization role from user

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.users.roles.delete('role_id', { user_id: 'user_id' });

console.log(role.deleted);
{
    "object": "user.role.deleted",
    "deleted": true
}
Returns Examples
{
    "object": "user.role.deleted",
    "deleted": true
}