Skip to main content
Sessions are stored as profiles, so several accounts and environments can be used side by side. Commands run against the active profile unless --profile names another one. Every command below also takes -h, --help.

login

Log in to a Xata account Prints a URL and a code to authorize this machine, or stores an API key with --api-key for non-interactive use. The issuer, API URL, console URL and client flags log in against a deployment other than production, which is how Enterprise customers connect the CLI to a custom deployment in their own cloud. Omit them and the CLI uses the default production values.
boolean
default:"false"
Force login even if already logged in, revoking the previous session
string
Log in non-interactively with an API key instead of the browser OAuth flow
string
Issuer URL for custom environment
string
API base URL for custom environment
string
Client ID for custom environment (defaults to “cli”)
string
Client secret for custom environment
string
Console URL for custom environment, used by AI features
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.
Examples:

logout

Log out of the current account Revokes the session of the profile with the identity provider and removes the stored credentials. Because the CLI is a single application to the identity provider, revoking may also sign out other CLI installations that were authorized from the same browser session. Use --local when the identity provider is unreachable to remove the stored credentials without revoking the session. Profiles that use an API key are only removed locally; the key itself stays valid.
boolean
default:"false"
Do not ask for confirmation, assume yes.
boolean
default:"false"
Only remove the stored credentials, do not revoke the session with the identity provider
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.

status

Display active account and authentication state Reads the stored session without contacting the server, so it stays fast and works offline. It reports an expiry the stored session has already passed, but it cannot see a session revoked server-side. Use xata auth refresh to verify against the server.
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.

switch

Switch to a different Xata account profile
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.
string
The profile to switch to

list

List all available Xata account profiles
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.
Aliases: xata auth ls

refresh

Refresh the access token of the current session Refreshes the session even when the current access token is still valid, and stores the new one. Every command already refreshes on its own when the token is about to expire, so this is for scripts that want to fail early, or to rotate the token before a long job.
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.

access-token

Print the current access token
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.

refresh-token

Print the stored refresh token, without refreshing the session
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.