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 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.
string
default:"default"
The profile to log in to
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
boolean
default:"false"
Print where each resolved value came from
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.
string
default:"default"
The profile to log out of
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
boolean
default:"false"
Print where each resolved value came from

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 check
boolean
default:"false"
Print where each resolved value came from

switch

Switch to a different Xata account profile
string
The profile to use
boolean
default:"false"
Print where each resolved value came from
string
The profile to switch to

list

List all available Xata account profiles
boolean
Output in JSON format
string
The profile to use
boolean
default:"false"
Print where each resolved value came from
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 refresh
boolean
default:"false"
Output in JSON format
boolean
default:"false"
Print where each resolved value came from

access-token

Print the current access token
string
default:"default"
The profile to use
boolean
default:"false"
Print where each resolved value came from

refresh-token

Print the stored refresh token, without refreshing the session
string
default:"default"
The profile to use
boolean
default:"false"
Print where each resolved value came from