Skip to content
Primary navigation

List group organization role assignments

admin.organization.groups.roles.list(strgroup_id, RoleListParams**kwargs) -> SyncNextCursorPage[RoleListResponse]
GET/organization/groups/{group_id}/roles

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

ParametersExpand Collapse
group_id: str
after: Optional[str]

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

limit: Optional[int]

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

minimum0
maximum1000
order: Optional[Literal["asc", "desc"]]

Sort order for the returned organization roles.

One of the following:
"asc"
"desc"
ReturnsExpand Collapse
class RoleListResponse: …

Detailed information about a role assignment entry returned when listing assignments.

id: str

Identifier for the role.

created_at: Optional[int]

When the role was created.

formatunixtime
created_by: Optional[str]

Identifier of the actor who created the role.

created_by_user_obj: Optional[Dict[str, object]]

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

description: Optional[str]

Description of the role.

metadata: Optional[Dict[str, object]]

Arbitrary metadata stored on the role.

name: str

Name of the role.

permissions: List[str]

Permissions associated with the role.

predefined_role: bool

Whether the role is predefined by OpenAI.

resource_type: str

Resource type the role applies to.

updated_at: Optional[int]

When the role was last updated.

formatint64

List group organization role assignments

import os
from openai import OpenAI

client = OpenAI(
    admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"),  # This is the default and can be omitted
)
page = client.admin.organization.groups.roles.list(
    group_id="group_id",
)
page = page.data[0]
print(page.id)
{
    "object": "list",
    "data": [
        {
            "id": "role_01J1F8ROLE01",
            "name": "API Group Manager",
            "permissions": [
                "api.groups.read",
                "api.groups.write"
            ],
            "resource_type": "api.organization",
            "predefined_role": false,
            "description": "Allows managing organization groups",
            "created_at": 1711471533,
            "updated_at": 1711472599,
            "created_by": "user_abc123",
            "created_by_user_obj": {
                "id": "user_abc123",
                "name": "Ada Lovelace",
                "email": "ada@example.com"
            },
            "metadata": {}
        }
    ],
    "has_more": false,
    "next": null
}
Returns Examples
{
    "object": "list",
    "data": [
        {
            "id": "role_01J1F8ROLE01",
            "name": "API Group Manager",
            "permissions": [
                "api.groups.read",
                "api.groups.write"
            ],
            "resource_type": "api.organization",
            "predefined_role": false,
            "description": "Allows managing organization groups",
            "created_at": 1711471533,
            "updated_at": 1711472599,
            "created_by": "user_abc123",
            "created_by_user_obj": {
                "id": "user_abc123",
                "name": "Ada Lovelace",
                "email": "ada@example.com"
            },
            "metadata": {}
        }
    ],
    "has_more": false,
    "next": null
}