Installation
Installation (Windows)
Basic Usage
Available Commands
Authentication
- auth login - Log in to your Xata account
- auth logout - Log out of the current account
- auth status - Display active account and authentication state
- auth switch - Switch to a different Xata account profile
- auth access-token - Print the current access token
- auth refresh-token - Print the current refresh token
Organization Management
- organization list - List all organizations
- organization describe - Describe an organization
- organization create - Create a new organization
- organization delete - Delete an organization
- organization get - Get a field from an organization description
Project Management
- init - Link a project to the current folder
- project list - List all projects
- project describe - Describe a project
- project create - Create a new project
- project delete - Delete a project
- project init - Link a project to the folder
- project get - Get a field from a project description
- project set - Set a field value for a project
Branch Management
- branch list - List all branches
- branch describe - Describe a branch
- branch create - Create a new branch
- branch delete - Delete a branch
- branch url - Print URL (connection string) for a branch
- branch checkout - Checkout a branch
- branch tree - List all branches as a tree
- branch get - Get a field from a branch description
- branch set - Set a field value for a branch
- branch wait-ready - Wait for a branch to be ready
API Key Management
- keys user list - List API keys for the current user
- keys user create - Create an API key for the current user
- keys user delete - Delete an API key for the current user
- keys organization list - List API keys for an organization
- keys organization create - Create an API key for an organization
- keys organization delete - Delete an API key for an organization
Schema Migrations
- roll baseline - Create a baseline migration for an existing database schema
- roll complete - Complete an ongoing migration
- roll init - Initialize pgroll in the target database
- roll latest - Print the name of the latest schema version or migration
- roll migrate - Apply outstanding migrations from a directory to a database
- roll update - Update outdated migrations in a directory
- roll pull - Pull migration history from the target database and write it to disk
- roll rollback - Roll back an ongoing migration
- roll start - Start a migration
- roll status - Show pgroll status
- roll convert - Convert SQL statements to a pgroll migration
Database Synchronization
- clone start - Clone a PostgreSQL database with anonymization
- clone config - Configure transforms for the clone command
- clone stream - Start a continuous data stream using logical replication
Utility Commands
- status - Get the status of the Xata CLI
- version - Get the version of the Xata CLI and pgroll
- checkout - Checkout a branch
- upgrade - Upgrade the Xata CLI
- completions install - Install shell completions
- completions uninstall - Uninstall shell completions
Global Flags
Print help information and exit
Print version information and exit
Output in JSON format (where applicable)
Environment Variables
The Xata CLI can be configured using environment variables. These are useful for CI/CD pipelines, automation workflows, and advanced configuration.Authentication & Configuration
These variables apply globally to all CLI commands.API key used to authenticate with Xata. In CI/CD environments, set this as a secret. Applies to all commands that require authentication.
Select the Xata API environment. Typically not needed unless instructed by Xata support. Applies to all commands.
Override the directory where the CLI stores its configuration files. Applies to all commands.
Project & Branch Configuration
These environment variables override the project and branch configuration normally stored in local config files. They apply to all commands that require project or branch context and are especially useful in CI/CD workflows where the CLI is not initialized interactively.Your Xata organization ID.
Your Xata project ID.
The ID of the target branch.
The name of the target branch.
The database name (default:
xata).Binary Version Overrides
The CLI ships with pinned versions of thepgroll and pgstream binaries. These environment variables allow you to override the pinned version, for example to test a newer release or to pin a specific version in your CI/CD pipeline. The CLI will automatically download the specified version if it is not already present locally.
Override the pinned
pgroll binary version used by the CLI. If not set, the CLI uses its built-in default. Applies to all xata roll subcommands, xata version, and xata upgrade.Override the pinned
pgstream binary version used by the CLI. If not set, the CLI uses its built-in default. Applies to all xata stream subcommands, all xata clone subcommands, xata version, and xata upgrade.Clone & Stream
Source PostgreSQL URL. Can be used instead of the
--source-url flag. Applies to xata clone start, xata clone stream, and xata stream destroy.Networking
Timeout in milliseconds for the private branch reachability check (default:
1000). Set to 0 to disable the check entirely. Applies to all xata roll and xata clone subcommands.