Neon CLI
Use the Neon CLI to manage Neon directly from the terminal
The Neon CLI is a command-line interface that lets you manage Neon directly from the terminal. This documentation references all commands and options available in the Neon CLI.
For installation instructions, see Neon CLI — Install and connect.
Synopsis
Commands
Command | Subcommands | Description |
---|---|---|
auth | Authenticate | |
me | Show current user | |
projects | list , create , update , delete , get | Manage projects |
branches | list , create , rename , add-compute , set-primary , delete , get | Manage branches |
databases | list , create , delete | Manage databases |
roles | list , create , delete | Manage roles |
operations | list | Manage operations |
connection-string | Get connection string | |
completion | Generate a completion script |
Global options
Global options are supported with any Neon CLI command.
Option | Description | Type | Default |
---|---|---|---|
-o, --output | Set the Neon CLI output format (json , yaml , or table ) | string | table |
--config-dir | Path to the Neon CLI configuration directory | string | /home/<user>/.config/neonctl |
--api-key | Neon API key | string | NEON_API_KEY environment variable |
--analytics | Manage analytics | boolean | true |
-v, --version | Show the Neon CLI version number | boolean | - |
-h, --help | Show the Neon CLI help | boolean | - |
-
Sets the output format. Supported options are
json
,yaml
, andtable
. The default istable
. Table output may be limited. Thejson
andyaml
output formats show all data. -
Specifies the path to the
neonctl
configuration directory. To view the default configuration directory containing youcredentials.json
file, runneonctl --help
. The credentials file is created when you authenticate using theneonctl auth
command. This option is only necessary if you move yourneonctl
configuration file to a location other than the default. -
Specifies your Neon API key. You can authenticate using a Neon API key when running a Neon CLI command instead of using
neonctl auth
. For information about obtaining an Neon API key, see Create an API key.To avoid including the
--api-key
option with each CLI command, you can export your API key to theNEON_API_KEY
environment variable.info
The authentication flow for the Neon CLI follows this order:
- If the
--api-key
option is provided, it is used for authentication. - If the
--api-key
option is not provided, theNEON_API_KEY
environment variable setting is used. - If there is no
--api-key
option orNEON_API_KEY
environment variable setting, the CLI looks for thecredentials.json
file created by theneonctl auth
command. - If the credentials file is not found, the Neon CLI initiates the
neonctl auth
web authentication process.
- If the
-
Analytics are enabled by default to gather information about the CLI commands and options that are used by our customers. This data collection assists in offering support, and allows for a better understanding of typical usage patterns so that we can improve user experience. Neon does not collect user-defined data, such as project IDs or command payloads. To opt-out of analytics data collection, specify
--no-analytics
or--analytics false
. -
Shows the Neon CLI version number.
-
Shows the
neonctl
command-line help. You can view help forneonctl
, aneonctl
command, or aneonctl
subcommand, as shown in the following examples:
GitHub
The GitHub repository for the Neon CLI is found here.
Last updated on