Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

List groups

client.Admin.Organization.Groups.List(ctx, query) (*NextCursorPage[Group], error)
GET
/organization/groups

Lists all groups in the organization.

List groups

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAdminAPIKey("My Admin API Key"),
  )
  page, err := client.Admin.Organization.Groups.List(context.TODO(), openai.AdminOrganizationGroupListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
Response example
{
    "object": "list",
    "data": [
        {
            "object": "group",
            "id": "group_01J1F8ABCDXYZ",
            "name": "Support Team",
            "created_at": 1711471533,
            "group_type": "group",
            "is_scim_managed": false
        }
    ],
    "has_more": false,
    "next": null
}
Parameters
query AdminOrganizationGroupListParams
After param.Field[string]
Optional

A cursor for use in pagination. after is a group ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with group_abc, your subsequent call can include after=group_abc in order to fetch the next page of the list.

Limit param.Field[int64]
Optional

A limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100.

minimum0
maximum1000
Order param.Field[AdminOrganizationGroupListParamsOrder]
Optional

Specifies the sort order of the returned groups.

Returns
type Group struct{…}

Details about an organization group.

ID string

Identifier for the group.

CreatedAt int64

Unix timestamp (in seconds) when the group was created.

formatunixtime
GroupType GroupGroupType

The type of the group.

IsScimManaged bool

Whether the group is managed through SCIM and controlled by your identity provider.

Name string

Display name of the group.

Returns Examples
Response example
{
    "object": "list",
    "data": [
        {
            "object": "group",
            "id": "group_01J1F8ABCDXYZ",
            "name": "Support Team",
            "created_at": 1711471533,
            "group_type": "group",
            "is_scim_managed": false
        }
    ],
    "has_more": false,
    "next": null
}