Neon Deploy: Learn how Neon helps developers ship faster with Postgres. Grab your ticket

Neon CLI commands — roles

Use the Neon CLI to manage Neon directly from the terminal

Before you begin

  • Before running the roles command, ensure that you have installed the Neon CLI.
  • If you have not authenticated with the neon auth command, running a Neon CLI command automatically launches the Neon CLI browser authentication process. Alternatively, you can specify a Neon API key using the --api-key option when running a command. See Connect.

For information about roles in Neon, see Manage roles.

The roles command

The roles command allows you to list, create, and delete roles in a Neon project.

Usage

neon roles <subcommand> [options]
SubcommandDescription
listList roles
createCreate a role
deleteDelete a role

list

This subcommand allows you to list roles.

Usage

neon roles list [options]

Options

In addition to the Neon CLI global options, the list subcommand supports these options:

OptionDescriptionTypeRequired
--context-fileContext file path and file namestring
--project-idProject IDstringOnly if your Neon account has more than one project
--branchBranch ID or namestring

If a branch ID or name is not provided, the command lists roles for the default branch of the project.

Examples

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

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

neon roles list --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"
  }

create

This subcommand allows you to create a role.

Usage

neon roles create [options]

Options

In addition to the Neon CLI global options, the create subcommand supports these options:

OptionDescriptionTypeRequired
--context-fileContext file path and file namestring
--project-idProject IDstringOnly if your Neon account has more than one project
--branchBranch ID or namestring
--nameThe role name. Cannot exceed 63 bytes in length.string

If a branch ID or name is not provided, the command creates a role in the default branch of the project.

Example

neon roles create --name sally
┌───────┬──────────────────────┐
 Name Created At
├───────┼──────────────────────┤
 sally 2023-06-20T00:43:17Z
└───────┴──────────────────────┘

delete

This subcommand allows you to delete a role.

Usage

neon roles delete <role> [options]

Options

In addition to the Neon CLI global options, the delete subcommand supports these options:

OptionDescriptionTypeRequired
--context-fileContext file path and file namestring
--project-idProject IDstringOnly if your Neon account has more than one project
--branchBranch ID or namestring

If a branch ID or name is not provided, the command assumes the role resides in the default branch of the project.

Example

neon roles delete sally
┌───────┬──────────────────────┐
 Name Created At
├───────┼──────────────────────┤
 sally 2023-06-20T00:43:17Z
└───────┴──────────────────────┘

Need help?

Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more detail, see Getting Support.

Last updated on

Was this page helpful?