PlanetScale
List PlanetScale database branches
PlanetScale provides a read-only branch listing through its API and pscale CLI. Both routes return the branches for one organization database so automation and terminal workflows can inspect environments without changing them.
Documentation reviewed · 2 methods with sources
Ways to do it
API
GET /v1/organizations/{organization}/databases/{database}/branches
Request a paginated JSON collection of branches for one PlanetScale organization and database.
Read source: PlanetScale List branches API- Requirements
- The organization and database slugs, plus an OAuth token or service token authorized to read branches.
- Limitations
- Follow next_page_url to read subsequent pages. For an older service token, use Authorization: TOKEN_ID:TOKEN instead of Bearer authentication.
Example shell
curl --fail --location --header "Authorization: Bearer $PLANETSCALE_SERVICE_TOKEN" "https://api.planetscale.com/v1/organizations/$PLANETSCALE_ORG/databases/$PLANETSCALE_DATABASE/branches"CLI
pscale branch list
Print the branches for a database, optionally as JSON for scripts.
Read source: PlanetScale CLI branch reference- Requirements
- The PlanetScale CLI, a completed pscale auth login or service-token configuration, and access to the organization and database.
- Limitations
- The command lists one database at a time and requires the organization context when the account contains more than one organization.
Example shell
pscale branch list "$PLANETSCALE_DATABASE" --org "$PLANETSCALE_ORG" --format json