# Roles

## List Roles

`client.Organizations.Roles.List(ctx, organizationID) (*[]Role, error)`

**get** `/api/v1/organizations/{organization_id}/roles`

List all roles in an organization.

### Parameters

- `organizationID string`

### Returns

- `type OrganizationRoleListResponse []Role`

  - `ID string`

    Unique identifier

  - `Name string`

    A name for the role.

  - `Permissions []RolePermission`

    The actual permissions of the role.

    - `ID string`

      Unique identifier

    - `Access bool`

      Whether the permission is granted or not.

    - `Description string`

      A description for the permission.

    - `Name string`

      A name for the permission.

    - `CreatedAt Time`

      Creation datetime

    - `UpdatedAt Time`

      Update datetime

  - `CreatedAt Time`

    Creation datetime

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  roles, err := client.Organizations.Roles.List(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", roles)
}
```

#### Response

```json
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "name": "x",
    "permissions": [
      {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "access": true,
        "description": "description",
        "name": "x",
        "created_at": "2019-12-27T18:11:19.117Z",
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "updated_at": "2019-12-27T18:11:19.117Z"
  }
]
```
