Navigation

PlanetScale CLI for Postgres

Postgres

To interact with PlanetScale for Postgres and manage your databases, you can use the pscale CLI to do the following:

  • Create, delete and list your databases and branches
  • Open a secure Postgres shell instance
  • Manage database roles and permissions
  • ...and more!

Note

pscale can use the PostgreSQL command-line client to quickly open an interactive shell for a database branch. Optional instructions for installing the PostgreSQL client can be found for each platform below.

Getting Started

Make sure to first set up your PlanetScale developer environment. Once you've installed the pscale CLI, you can interact with PlanetScale and manage your Postgres databases straight from the command line.

Available Commands

Warning

The below pscale commands are for PlanetScale for Postgres databases. To see commands for Vitess/MySQL databases, see PlanetScale CLI.

Use pscale [command] [command] to start up the pscale CLI in your terminal.

CommandSubcommands/OptionsFlagsDescription
api--help, --org string, --database string, --branch string, --field key=value, --header stringArray, --input string, --method string, --query key=valuePerforms authenticated calls against the PlanetScale API and prints the response to stdout.
audit-loglist--help, --org stringList all audit logs
authlogin, logout--helpAuthenticate via console
backupcreate, delete, list, restore, show--help, --org stringManage branch backups
branchcreate, delete, list, show, switch--help, --org stringManage branches
completionbash, zsh, fish, powershell--helpGenerate completion script for specified shell
databasecreate, delete, dump, list, restore-dump, show--helpManage databases
helpapi, audit-log, auth, backup, branch, completion, database, help, mcp, org, ping, region, role, service-token, shell, signup, size--helpView help for any command
mcpinstall, server--target string, --helpInstall and start an MCP server
orglist, show, switch--helpManage and switch organizations
ping--help, --count, -n int, --concurrency int, --provider, -p string --timeout durationCheck latency between your machine and PlanetScale's public regions
regionlist--org stringView available regions
rolecreate, delete, get, list, renew, reset-default, update--help, --org string, --inherited-roles string, --ttl duration, --force, --successor string, --name string, --webManage Postgres roles
service-tokenadd-access, create, delete, delete-access, list, show-access--help, --org stringManage access of service tokens
shell<database_name> <branch_name>--help, --local-addr string, --org string, --remote-addr stringOpen a Postgres shell instance to the specified database and branch
signup--helpSign up for a new PlanetScale account
sizecluster list--help, --org string, --region string, --metalView available cluster sizes

Flags

You may use the following flags with the PlanetScale CLI commands.

FlagDescription
--api-token stringThe API token to use for authenticating against the PlanetScale API
--api-url stringThe base URL for the PlanetScale API. (default "https://api.planetscale.com/")
--config stringConfig file (default: $HOME/.config/planetscale/pscale.yml)
--debugEnable debug mode
-f, --format stringShow output in specific format. Possible values: [human, json, csv] (default: "human")
-h, --helpGet more information about a command
--no-colorDisable color output
--service-token stringService Token for authenticating
--service-token-id stringThe Service Token ID for authenticating
--versionShow pscale version

Service tokens permissions

A complete list of access permissions available for use with service tokens can be found in the PlanetScale API documentation.

Need help?

Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.