Skip to main content
Neon Postgres Docs

Search documentation

Type to search this documentation.

On this pageOverview

Neon CLI command: roles

The roles command lists, creates, and deletes roles in a Neon project from the terminal. For information about roles in Neon, see Manage roles. If project id is omitted, the CLI resolves it from your ...

The roles command lists, creates, and deletes roles in a Neon project from the terminal. For information about roles in Neon, see Manage roles. If --project-id is omitted, the CLI resolves it from your context file, auto-selects when your account has only one project, and otherwise asks you to pass --project-id.

Subcommands: create, delete, 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
neon roles list [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No

List roles with the default table output format:

Bash
neon roles list
title="Output"
┌────────┬──────────────────────┐
│ Name   │ Created At           │
├────────┼──────────────────────┤
│ daniel │ 2023-06-19T18:27:19Z │
└────────┴──────────────────────┘

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

Bash
neon roles list --output json
Show output
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"
  }
]

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

Bash
neon roles create [options]
Option Description Type Default Required
--name Role name string — Yes
--no-login Create a passwordless role that cannot login boolean — No
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon roles create --name sally
title="Output"
┌───────┬──────────────────────┐
│ Name  │ Created At           │
├───────┼──────────────────────┤
│ sally │ 2023-06-20T00:43:17Z │
└───────┴──────────────────────┘

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

Bash
neon roles delete <role> [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon roles delete sally
title="Output"
┌───────┬──────────────────────┐
│ Name  │ Created At           │
├───────┼──────────────────────┤
│ sally │ 2023-06-20T00:43:17Z │
└───────┴──────────────────────┘
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu