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

# ana auth login

## Usage

```bash theme={null}
ana auth login [OPTIONS] [API_KEY]
```

`ana login` is a shortcut for this command and accepts the same arguments and options.

## Description

Signs you in to your Anaconda account and saves an API key in your keyring (`~/.anaconda/keyring` by default). Each login creates a new API key that expires after one year. The command displays the expiration date after you log in.

By default, the command opens your browser and displays a verification link in your terminal. Sign in and approve the request, and the login completes. To display a QR code that you can scan with another device, press **q** while ana waits. Because you can approve the request from any device, this flow also works over SSH and on headless servers. To stop ana from opening a browser, set `ANA_OPEN_BROWSER=false`. ana then displays the link and QR code right away.

If you're already logged in, ana asks before continuing:

* When you log in through your browser, ana asks "Login again?" Answer **y** (the default) to log in again and create a new API key.
* When you log in with an API key, ana asks "Overwrite existing credentials?" Answer **y** to replace your saved key. The default is **n**.

To skip these questions, use `--force`. Logging in again does not revoke your previous API key. To revoke it, go to the API keys page in your Anaconda account settings.

> [!NOTE]
>
> This command saves the API key for your Anaconda account. Anaconda.org commands such as `ana org upload` use a separate Anaconda.org token, which [`ana org login`](https://anaconda.com/docs/cli-reference/anaconda-cli/commands/org-login) creates. For more information, see [Logging in](https://anaconda.com/docs/cli-reference/anaconda-cli/commands/org#logging-in).

## Arguments

Argument

Description

`[API_KEY]`

Optional API key to save instead of signing in through your browser. Use `-` to read the key from standard input.

## Options

Option

Description

`--api-key`

Prompt for an API key with hidden input instead of signing in through your browser

`-f, --force`

Log in again or replace existing credentials without asking for confirmation

`-h, --help`

Show help for this command

## Examples

**Log in through your browser**

```bash theme={null}
ana auth login
```

**Replace your saved credentials**

```bash theme={null}
ana auth login --force
```

**Log in with an API key from an environment variable**

```bash theme={null}
printf '%s\n' "$ANACONDA_API_KEY" | ana auth login --force -
```

For more ways to log in, including in CI/CD pipelines, see [Authentication](https://anaconda.com/docs/cli-reference/anaconda-cli/authentication.md).
