branch command helps you create, list, describe, and manage branches in Xata.
Subcommands
list
List all branches.Organization ID
Project ID
Branch ID
Output in JSON format
Print help information and exit
ls
describe
Describe a branch.Organization ID
Project ID
Branch ID
Output in JSON format
Print help information and exit
The branch to describe
view, show
create
Create a new branch.Organization ID
Project ID
Parent branch ID. Pass “None” to create a branch without a parent.
Branch name
Type of instance for this branch
Number of replicas for the branch (0-4)
Region for the branch
Scale to zero status for the branch (true|false)
Inactivity period in minutes for the branch (15|30|60|120|180)
Output in JSON format
Print help information and exit
delete
Delete a branch.Organization ID
Project ID
Branch ID
Do not ask for confirmation, assume yes
Output in JSON format
Print help information and exit
The branch to delete
url
Print URL (connection string) for a branch.Organization ID
Project ID
Branch ID
Database name
Connection type. One of:
primary— direct access to the primary instance (default).primary-or-replica— routed access to the primary or a read replica.replica— read-only access guaranteed to use read replicas only. Requires at least one replica configured on the branch.pooler— pooled access to the primary. Recommended for serverless and high-concurrency workloads.
Print help information and exit
The branch to get URL for
connection-string
Examples:
checkout
Checkout a branch.Organization ID
Project ID
Branch ID
Database name
Output in JSON format
Print help information and exit
The branch to switch to
tree
List all branches as a tree.Organization ID
Project ID
Branch ID
Show branch IDs in the tree
Print help information and exit
topology
get
Get a field from a branch description.Organization ID
Project ID
Branch ID
Print help information and exit
The field to get (default:
.catalog)set
Set a field value for a branch.Organization ID
Project ID
Branch ID
Print help information and exit
The field to set. Supported fields include
name, replicas, instance-type, hibernate, scale-to-zero, inactivity-period, and postgres-version.The value to set. If omitted in interactive mode, the CLI will prompt you to select from available options.
Upgrading PostgreSQL version
Use thepostgres-version field to upgrade to a newer minor version of PostgreSQL. Only compatible upgrades within the same major version and offering type are allowed.
wait-ready
Wait for a branch to be ready.Organization ID
Project ID
Branch ID
Output in JSON format
Print help information and exit
The branch to wait for
metrics
Show branch metrics such as CPU, memory, and disk usage across instances.Organization ID
Project ID
Branch ID
Time range ending now, such as
1h, 24h, or 7dStart time as an ISO timestamp
End time as an ISO timestamp
Metrics to query:
default, all, or a comma-separated listInstances to query:
all, primary, replicas, or comma-separated instance IDsAggregations to query as a comma-separated list of
avg, max, minAggregation to render in table or TUI output. One of
avg, max, min.Refresh interval for watch mode, such as
10s, 1m, or 500msOutput format. One of
table, json, ndjson, tui.Refresh metrics continuously.
-w is an alias for --watch.Output in JSON format
Print help information and exit
The branch to show metrics for
rotate-password
Rotate the database password for a branch.Organization ID
Project ID
Branch ID
Do not ask for confirmation, assume yes
Output in JSON format
Print help information and exit
The branch to rotate the password for
Global Flags
Print help information and exit