Skip to main content

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 databases straight from the command line.

The service-token command

This command allows you to create, list, and manage access for service tokens. Usage:

Available sub-commands

Service token automation: service-token

Legend: 🚫 unavailable with a service token (all sub-commands). All service-token sub-commands are unavailable when authenticated with a service token. Exact error: pscale service-token <sub-command> is unavailable when authenticated with a service token. Do not retry the CLI. Use the alternatives below. Read operations (list, show-access): use pscale api with the same service token. Create and manage operations: run under pscale auth login; there is no service-token CLI path for those sub-commands. Setup and commands to avoid: CLI overview · Service tokens

Sub-command flag descriptions

Some of the sub-commands have additional flags unique to the sub-command. This section covers what each of those does. See the above table for which context.

Available flags

Global flags

Examples

Adding service token access for a database

Command:
This will add the following permissions to the specified access token: read_branch, delete_branch, create_branch. The output will show the updated permissions on all databases. You can find a list of all permissions in the PlanetScale API documentation. Output:

Adding service token access for an organization

Command:
This will grant the service token the read_organization access on the organization. Output:

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.