Skip to content

List user organization role assignments

GET/organization/users/{user_id}/roles

Lists the organization roles assigned to a user within the organization.

Path ParametersExpand Collapse
user_id: string
Query ParametersExpand Collapse
after: optional string

Cursor for pagination. Provide the value from the previous response's next field to continue listing organization roles.

limit: optional number

A limit on the number of organization role assignments to return.

minimum0
maximum1000
order: optional "asc" or "desc"

Sort order for the returned organization roles.

Accepts one of the following:
"asc"
"desc"
ReturnsExpand Collapse
data: array of object { id, created_at, created_by, 8 more }

Role assignments returned in the current page.

id: string

Identifier for the role.

created_at: number

When the role was created.

formatint64
created_by: string

Identifier of the actor who created the role.

created_by_user_obj: map[unknown]

User details for the actor that created the role, when available.

description: string

Description of the role.

metadata: map[unknown]

Arbitrary metadata stored on the role.

name: string

Name of the role.

permissions: array of string

Permissions associated with the role.

predefined_role: boolean

Whether the role is predefined by OpenAI.

resource_type: string

Resource type the role applies to.

updated_at: number

When the role was last updated.

formatint64
has_more: boolean

Whether additional assignments are available when paginating.

object: "list"

Always list.

List user organization role assignments

curl https://api.openai.com/v1/organization/users/$USER_ID/roles \
    -H "Authorization: Bearer $OPENAI_API_KEY"
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "created_by": "created_by",
      "created_by_user_obj": {
        "foo": "bar"
      },
      "description": "description",
      "metadata": {
        "foo": "bar"
      },
      "name": "name",
      "permissions": [
        "string"
      ],
      "predefined_role": true,
      "resource_type": "resource_type",
      "updated_at": 0
    }
  ],
  "has_more": true,
  "next": "next",
  "object": "list"
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "created_by": "created_by",
      "created_by_user_obj": {
        "foo": "bar"
      },
      "description": "description",
      "metadata": {
        "foo": "bar"
      },
      "name": "name",
      "permissions": [
        "string"
      ],
      "predefined_role": true,
      "resource_type": "resource_type",
      "updated_at": 0
    }
  ],
  "has_more": true,
  "next": "next",
  "object": "list"
}