Installation
Installation (Docker)
Installation (Windows)
Basic Usage
Container image
Available Commands
Every command page opens with an index of the commands on it.xata init— Link this folder to a project and branchxata auth— Authenticate with Xataxata auth login— Log in to a Xata accountxata auth logout— Log out of the current accountxata auth status— Display active account and authentication statexata auth switch— Switch to a different Xata account profilexata auth list— List all available Xata account profilesxata auth access-token— Print the current access tokenxata auth refresh-token— Print the current refresh token
xata organization— Create, list, and manage organizationsxata organization list— List all organizationsxata organization describe— Describe an organizationxata organization create— Create a new organizationxata organization delete— Delete an organizationxata organization get— Get a field from an organization descriptionxata organization members— Manage organization membersxata organization members list— List all members of an organizationxata organization members invite— Send an invitation to join an organizationxata organization members remove— Remove a member from an organization
xata organization invitations— Manage organization invitationsxata organization invitations list— List all invitations for an organizationxata organization invitations get— Get details of a specific invitationxata organization invitations create— Create and send an invitation to join an organizationxata organization invitations delete— Delete an invitationxata organization invitations resend— Resend an invitation
xata project— Create, list, and manage projectsxata project list— List all projectsxata project describe— Describe a projectxata project create— Create a new projectxata project delete— Delete a projectxata project init— Link this folder to a project and branchxata project get— Get a field from a project descriptionxata project set— Set a field value for a projectxata project ip-filter— Manage IP filtering for a projectxata project ip-filter list— Show IP filtering status and configured CIDR entriesxata project ip-filter enable— Enable IP filtering for a projectxata project ip-filter disable— Disable IP filtering for a projectxata project ip-filter add— Add a CIDR entry to the IP filter allow listxata project ip-filter remove— Remove a CIDR entry from the IP filter allow list
xata branch— Create, list, and manage Xata branchesxata branch list— List all branchesxata branch describe— Describe a branchxata branch create— Create a new branchxata branch delete— Delete a branchxata branch logs— Retrieve the PostgreSQL logs of a branchxata branch url— Print URL (connection string) for a branchxata branch checkout— Check out a branch in this folderxata branch tree— List all branches as a treexata branch get— Get a field from a branch descriptionxata branch metrics— Show CPU, memory and disk usage for a branchxata branch set— Set a field value for a branchxata branch rotate-password— Rotate the database password for a branchxata branch wait-ready— Wait for a branch to be readyxata branch query-insights— Inspect query statistics and active queries for a branchxata branch query-insights list— List historical query statistics for a branch, by total execution timexata branch query-insights show— Show full query statistics for a query IDxata branch query-insights active— List currently running queries for a branchxata branch query-insights enable— Enable pg_stat_statements for query insights on a branchxata branch query-insights reset— Reset accumulated query statistics for a branch
xata keys— Create, list, and delete API keysxata keys user— Manage API keys for the current userxata keys user list— List all API keys of the current userxata keys user create— Create a new API keyxata keys user delete— Delete one or more API keys
xata keys organization— Manage API keys for an organizationxata keys organization list— List all API keys for an organizationxata keys organization create— Create a new API keyxata keys organization delete— Delete one or more API keys
xata roll— Run pgroll to manage PostgreSQL schema migrationsxata roll baseline— Create a baseline migration for an existing database schemaxata roll complete— Complete an ongoing migration with the operations present in the given filexata roll init— Initialize pgroll in the target databasexata roll latest— Print the name of the latest schema version or migrationxata roll latest migration— Print the latest migration namexata roll latest schema— Print the latest version schema name
xata roll migrate— Apply outstanding migrations from a directory to a databasexata roll update— Update outdated migrations in a directoryxata roll pull— Pull migration history from the target database and write it to diskxata roll rollback— Roll back an ongoing migrationxata roll start— Start a migration for the operations present in the given filexata roll status— Show pgroll statusxata roll convert— Convert SQL statements to a pgroll migration
xata clone— Clone another PostgreSQL database with anonymizationxata clone start— Snapshot a PostgreSQL database into a Xata branchxata clone config— Write the anonymization rules that clone start and stream applyxata clone stream— Stream a PostgreSQL database into a Xata branch continuously
xata status— Show the organization, project, and branch this folder usesxata version— Get the version of the Xata CLI, pgroll and pgstreamxata checkout— Check out a branch in this folderxata scratch— Run SQL or a Postgres client command against a temporary scratch branchxata upgrade— Upgrade the Xata CLIxata completions— Install or uninstall shell completions for the Xata CLIxata completions install— Installs bash autocomplete support for xataxata completions uninstall— Uninstalls bash autocomplete support for xata
Global Flags
boolean
Print help information and exit
boolean
Print version information and exit
boolean
Output in JSON format (where applicable)
Required scopes
Most commands work with a key scoped tobranch:read. These need more:
A key that only has
branch:read returns a 401 on the commands above. Scopes are set when you create the key, so a key created before a scope existed does not have it. See API keys for how to create and scope one.
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.string
API key used to authenticate with Xata. In CI/CD environments, set this as a secret. Applies to all commands that require authentication.
string
Select the Xata API environment. Typically not needed unless instructed by Xata support. Applies to all commands.
string
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.Earlier CLI versions used names without an underscore between words (for example
XATA_ORGANIZATIONID, XATA_PROJECTID, XATA_BRANCHID, XATA_BRANCHNAME, XATA_DATABASENAME). These legacy names are still supported, but the snake_case names below are preferred and take precedence when both are set.string
Your Xata organization ID.
string
Your Xata project ID.
string
The ID of the target branch.
string
The name of the target branch.
string
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.
string
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.string
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
string
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
string
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.