> This page location: Tools & Workflows > API, CLI & SDKs > CLI > Projects & branches > roles
> Full Neon documentation index: https://neon.com/docs/llms.txt

> Summary: The `neonctl roles` CLI command lists, creates, and deletes database roles in a Neon project, with subcommands scoped to a specific branch or the project default. Use it when you need to add a login role, create a passwordless role with `--no-login`, or remove an existing role from the command line. Role names are capped at 63 bytes; commands require the Neon CLI and either browser-based auth or an API key.

# Neon CLI command: roles

List, create, and delete database roles in a Neon project

The `roles` command lists, creates, and deletes roles in a Neon project from the terminal. For information about roles in Neon, see [Manage roles](https://neon.com/docs/manage/roles). If `--project-id` is omitted, the CLI resolves it from your [context file](https://neon.com/docs/cli/set-context), auto-selects when your account has only one project, and prompts otherwise.

Subcommands: [list](https://neon.com/docs/cli/roles#list), [create](https://neon.com/docs/cli/roles#create), [delete](https://neon.com/docs/cli/roles#delete)

## neonctl roles list

Lists roles. If you don't specify a branch ID or name with `--branch`, the command targets the project's default branch. This applies to all `roles` subcommands.

```bash
neonctl roles list [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--project-id` | Project ID        | string | —       |    No    |
| `--branch`     | Branch ID or name | string | —       |    No    |

List roles with the default `table` output format:

```bash
neonctl roles list
```

```text filename="Output"
┌────────┬──────────────────────┐
│ Name   │ Created At           │
├────────┼──────────────────────┤
│ daniel │ 2023-06-19T18:27:19Z │
└────────┴──────────────────────┘
```

List roles with the `--output` format set to `json`:

```bash
neonctl roles list --output json
```

<details>

<summary>Show output</summary>

```json
[
  {
    "branch_id": "br-odd-frog-703504",
    "name": "daniel",
    "protected": false,
    "created_at": "2023-06-28T10:17:28Z",
    "updated_at": "2023-06-28T10:17:28Z"
  }
]
```

</details>

## neonctl roles create

Creates a role. The role name cannot exceed 63 bytes.

```bash
neonctl roles create [options]
```

| Option         | Description                                  | Type    | Default | Required |
| -------------- | -------------------------------------------- | ------- | ------- | :------: |
| `--name`       | Role name                                    | string  | —       |    Yes   |
| `--no-login`   | Create a passwordless role that cannot login | boolean | —       |    No    |
| `--project-id` | Project ID                                   | string  | —       |    No    |
| `--branch`     | Branch ID or name                            | string  | —       |    No    |

```bash
neonctl roles create --name sally
```

```text filename="Output"
┌───────┬──────────────────────┐
│ Name  │ Created At           │
├───────┼──────────────────────┤
│ sally │ 2023-06-20T00:43:17Z │
└───────┴──────────────────────┘
```

## neonctl roles delete

Deletes a role. The `<role>` is the role name.

```bash
neonctl roles delete <role> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--project-id` | Project ID        | string | —       |    No    |
| `--branch`     | Branch ID or name | string | —       |    No    |

```bash
neonctl roles delete sally
```

```text filename="Output"
┌───────┬──────────────────────┐
│ Name  │ Created At           │
├───────┼──────────────────────┤
│ sally │ 2023-06-20T00:43:17Z │
└───────┴──────────────────────┘
```

---

## Related docs (Projects & branches)

- [projects](https://neon.com/docs/cli/projects)
- [branches](https://neon.com/docs/cli/branches)
- [databases](https://neon.com/docs/cli/databases)
- [operations](https://neon.com/docs/cli/operations)
