> ## Documentation Index
> Fetch the complete documentation index at: https://xata.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# auth

> Commands for authenticating with Xata

The `auth` command helps you manage authentication and account profiles for the Xata CLI.

## Subcommands

### login

Log in to a Xata account.

```bash theme={null}
xata auth login [--profile <name>] [-f|--force] [--issuer <url>] [--api-url <url>] [--client-id <id>] [--client-secret <secret>] [-h|--help]
```

<ParamField path="--profile" type="string">
  Profile to log in to (default: `default`)
</ParamField>

<ParamField path="-f, --force" type="boolean">
  Force login even if already logged in
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

#### Custom environment flags

For Enterprise customers we allow connecting the CLI to a custom deployment in their cloud. Pass any of the flags below to log in against a non-production environment; if omitted, the CLI uses the default production values.

<ParamField path="--issuer" type="string">
  Issuer URL for the custom environment
</ParamField>

<ParamField path="--api-url" type="string">
  API base URL for the custom environment
</ParamField>

<ParamField path="--client-id" type="string">
  Client ID for the custom environment (defaults to `cli`)
</ParamField>

<ParamField path="--client-secret" type="string">
  Client secret for the custom environment
</ParamField>

### list

List all available Xata account profiles.

```bash theme={null}
xata auth list [--json] [-h|--help]
```

<ParamField path="--json" type="boolean">
  Output the list of profiles in JSON format
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

### logout

Log out of the current account.

```bash theme={null}
xata auth logout [--profile <name>] [--yes] [-h|--help]
```

<ParamField path="--profile" type="string">
  Profile to log out of (default: `default`)
</ParamField>

<ParamField path="--yes" type="boolean">
  Do not ask for confirmation, assume yes
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

### status

Display active account and authentication state.

```bash theme={null}
xata auth status [--profile <name>] [-h|--help]
```

<ParamField path="--profile" type="string">
  Profile to log in to (default: `default`)
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

### switch

Switch to a different Xata account profile.

```bash theme={null}
xata auth switch <profile>
xata auth switch --help
```

<ParamField path="profile" type="string" required>
  The profile to switch to
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

### access-token

Print the current access token.

```bash theme={null}
xata auth access-token [--profile <name>] [-h|--help]
```

<ParamField path="--profile" type="string">
  Profile to log in to (default: `default`)
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

### refresh-token

Print the current refresh token.

```bash theme={null}
xata auth refresh-token [--profile <name>] [-h|--help]
```

<ParamField path="--profile" type="string">
  Profile to log in to (default: `default`)
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

## Global Flags

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>
