List groups
List groups
Returns a paginated list of the groups in the specified zone. Use cursor pagination via after/before. Sort: comma-separated field list; prefix with - for descending (allowed: created_at, name, identifier). Pass expand[]=member_count to include each group's member count, expand[]=roles to include the identifiers of the roles assigned to each group, and expand[]=total_count to include the matching row count. Filter by exact identifier via filter[identifier] (repeatable, OR'd across values). Search via query[] (case-insensitive substring match, OR'd across repeated values); it matches the group's name and identifier. Pass filter[id] (repeatable, max 100) to restrict results to a known set of groups — mutually exclusive with after/before (returns 400 if combined). When filter[id] is set, limit is ignored and the response contains every requested group that exists in the zone, in a single page. IDs not in the zone are silently omitted.
Parameters
Returns
List groups
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"),
)
groups, err := client.Zones.Groups.List(
context.TODO(),
"zoneId",
keycard.ZoneGroupListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", groups.Items)
}
{
"items": [
{
"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"
]
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}Returns Examples
{
"items": [
{
"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"
]
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}