Command-line Interface
Complete reference for the Xata CLI
The Xata CLI is a powerful tool for managing your Xata databases, projects, and organizations from the command line. It provides commands for authentication, project management, database operations, and more.
Installation (macOS/Linux)
# Install using npm
curl -fsSL https://xata.io/install.sh | bash
Installation (Windows)
# Install using npm
powershell -c "irm https://xata.io/install.ps1 | iex"
Note: xata clone
currently doesn't work with the native Windows installation. We currently recommend using WSL with the Linux binaries if you need the clone functionality on Windows. Track progress here.
Basic Usage
xata [command] [subcommand] [options]
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
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
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
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 wait-ready - Wait for a branch to be ready
Schema Migrations
- roll complete - Complete an ongoing migration
- roll init - Initialize pgroll in the target database
- roll latest - Print the name of the latest schema version
- roll migrate - Apply outstanding migrations
- roll pull - Pull migration history from the target database
- 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
Utility Commands
- status - Get the status of the Xata CLI
- version - Get the version of the Xata CLI and pgroll
- upgrade - Upgrade the Xata CLI
- completions install - Install shell completions
- completions uninstall - Uninstall shell completions
Global Flags
-h, --help
- Print help information and exit-v, --version
- Print version information and exit--json
- Output in JSON format (where applicable)