## List

`client.Zones.Roles.List(ctx, zoneID, query) (*ZoneRoleListResponse, error)`

**get** `/zones/{zoneId}/roles`

Returns the roles defined in the specified zone. The full result set is currently returned in a single page; the `after`/`before`/`limit` cursor parameters are reserved and not yet enforced, and `pagination` cursors are always null.

### Parameters

- `zoneID string`

- `query ZoneRoleListParams`

  - `After param.Field[string]`

    Cursor for forward pagination

  - `Before param.Field[string]`

    Cursor for backward pagination

  - `Expand param.Field[ZoneRoleListParamsExpandUnion]`

    - `type ZoneRoleListParamsExpandString string`

      - `const ZoneRoleListParamsExpandStringTotalCount ZoneRoleListParamsExpandString = "total_count"`

    - `type ZoneRoleListParamsExpandArray []string`

      - `const ZoneRoleListParamsExpandArrayItemTotalCount ZoneRoleListParamsExpandArrayItem = "total_count"`

  - `Identifier param.Field[string]`

    Filter roles by identifier

  - `Limit param.Field[int64]`

    Maximum number of items to return

### Returns

- `type ZoneRoleListResponse struct{…}`

  - `Items []Role`

    - `ID string`

      Unique identifier of the role

    - `CreatedAt Time`

      Entity creation timestamp

    - `Identifier string`

      Role identifier: a lowercase slug (letters and digits separated by single hyphens or underscores), unique per owner type within a zone. Role identifiers surface in policy evaluation, so the slug restriction keeps them unambiguous in policy text.

    - `OwnerType RoleOwnerType`

      Who owns this role. Platform-owned roles are managed by Keycard and cannot be modified or deleted via the API; customer-owned roles are user-created.

      - `const RoleOwnerTypePlatform RoleOwnerType = "platform"`

      - `const RoleOwnerTypeCustomer RoleOwnerType = "customer"`

    - `UpdatedAt Time`

      Entity update timestamp

    - `ZoneID string`

      Zone this role belongs to

    - `Description string`

      Human-readable description

  - `Pagination ZoneRoleListResponsePagination`

    Cursor-based pagination metadata

    - `AfterCursor string`

      An opaque cursor used for paginating through a list of results

    - `BeforeCursor string`

      An opaque cursor used for paginating through a list of results

    - `TotalCount int64`

      Total number of items matching the query. Only included when expand[]=total_count is requested.

### Example

```go
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"),
  )
  roles, err := client.Zones.Roles.List(
    context.TODO(),
    "zoneId",
    keycard.ZoneRoleListParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", roles.Items)
}
```
