Skip to content
Docs
Groups

Get group

Get group

client.Zones.Groups.Get(ctx, groupID, params) (*Group, error)
GET/zones/{zoneId}/groups/{groupId}

Returns a group by ID. Pass expand[]=member_count for its member count and expand[]=roles for the identifiers of its assigned roles.

ParametersExpand Collapse
groupID string
params ZoneGroupGetParams
ZoneID param.Field[string]

Path param: Zone ID

Expand param.Field[ZoneGroupGetParamsExpandUnion]optional

Query param

type ZoneGroupGetParamsExpandString string
Accepts one of the following:
const ZoneGroupGetParamsExpandStringMemberCount ZoneGroupGetParamsExpandString = "member_count"
const ZoneGroupGetParamsExpandStringRoles ZoneGroupGetParamsExpandString = "roles"
type ZoneGroupGetParamsExpandArray []string
Accepts one of the following:
const ZoneGroupGetParamsExpandArrayItemMemberCount ZoneGroupGetParamsExpandArrayItem = "member_count"
const ZoneGroupGetParamsExpandArrayItemRoles ZoneGroupGetParamsExpandArrayItem = "roles"
ReturnsExpand Collapse
type Group struct{…}

A zone-scoped group of users, assignable to roles and usable in policies. Roles assigned to a group are inherited by its members. external is false for groups managed in Keycard and true for groups synced from an external directory.

ID string

Unique identifier of the group

CreatedAt Time

Entity creation timestamp

formatdate-time
External bool

Whether the group is synced from an external directory. When true the group is directory-owned and its membership is read-only; when false it is managed in Keycard. Read-only: set by external sync, never by the caller.

Identifier string

User-specified identifier, unique within the zone. Automatically assigned for groups from an external directory.

Name string

Human-readable group name

OrganizationID string

Organization this group belongs to

UpdatedAt Time

Entity update timestamp

formatdate-time
ZoneID string

Zone this group belongs to

MemberCount int64optional

Number of users in the group. Included only when requested via expand[]=member_count (group get or list).

Roles []stringoptional

Identifiers of the roles assigned to the group; members inherit them. Deduped across scopes. Included only when requested via expand[]=roles (group get or list).

Get group

package main

import (
  "context"
  "fmt"

  "github.com/keycardai/keycard-go"
  "github.com/keycardai/keycard-go/option"
)

func main() {
  client := keycard.NewClient(
    option.WithAPIKey("My API Key"),
  )
  group, err := client.Zones.Groups.Get(
    context.TODO(),
    "groupId",
    keycard.ZoneGroupGetParams{
      ZoneID: "zoneId",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", group.ID)
}
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "external": true,
  "identifier": "identifier",
  "name": "name",
  "organization_id": "organization_id",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "zone_id": "zone_id",
  "member_count": 0,
  "roles": [
    "string"
  ]
}
Returns Examples
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "external": true,
  "identifier": "identifier",
  "name": "name",
  "organization_id": "organization_id",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "zone_id": "zone_id",
  "member_count": 0,
  "roles": [
    "string"
  ]
}