## Create

`client.Zones.Roles.New(ctx, zoneID, body) (*Role, error)`

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

Creates a new customer-owned role in the specified zone. The owner_type is always customer; platform roles are managed by Keycard.

### Parameters

- `zoneID string`

- `body ZoneRoleNewParams`

  - `RoleCreate param.Field[RoleCreate]`

    Schema for creating a new role

### Returns

- `type Role struct{…}`

  A role that can be assigned to users within a zone.

  - `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

### 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"),
  )
  role, err := client.Zones.Roles.New(
    context.TODO(),
    "zoneId",
    keycard.ZoneRoleNewParams{
      RoleCreate: keycard.RoleCreateParam{
        Identifier: "identifier",
      },
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", role.ID)
}
```
