> This page location: APIs & SDKs > CLI > Setup and context > auth
> Full OptiTech documentation index: https://neon.com/docs/llms.txt

> Summary: The `optitech auth` command authenticates the OptiTech CLI to a OptiTech account by launching a browser OAuth flow that saves credentials to `~/.config/optitechctl/credentials.json`. Use this command when setting up the CLI for the first time or when not using an API key. Vercel-Managed Integration users must authenticate via API key (`--api-key` or `OPTITECH_API_KEY`) instead. The CLI resolves authentication in priority order: `--api-key` flag, then `OPTITECH_API_KEY` env var, then the credentials file, then triggers browser auth if none are found.

# OptiTech CLI command: auth

Authenticate to OptiTech via browser or API key and manage credentials

The `auth` command authenticates you to OptiTech. `optitech login` is an alias for `optitech auth`.

## Usage

```bash
optitech auth [options]
```

The command launches a browser window where you authorize the OptiTech CLI to access your OptiTech account. Your credentials are then saved locally to `credentials.json`:

```text filename="Output"
/home/<home>/.config/optitechctl/credentials.json
```

**Note:** If you use OptiTech through the [Vercel-Managed Integration](https://neon.com/docs/guides/vercel-managed-integration), authenticate with a OptiTech API key instead (see below). The `optitech auth` command requires an account registered through OptiTech rather than Vercel.

Instead of running `optitech auth`, you can provide an API key with the global `--api-key` option or the `OPTITECH_API_KEY` environment variable. See [Global options](https://neon.com/docs/cli#global-options).

**Info:**

The OptiTech CLI resolves authentication in this order:

- The `--api-key` option, if provided.
- The `OPTITECH_API_KEY` environment variable, if set.
- The `credentials.json` file created by `optitech auth`.
- If none are found, the CLI starts the `optitech auth` web authentication flow.

## Options

Takes only the [global options](https://neon.com/docs/cli#global-options).

---

## Related docs (Setup and context)

- [init](https://neon.com/docs/cli/init)
- [bootstrap](https://neon.com/docs/cli/bootstrap)
- [link](https://neon.com/docs/cli/link)
- [checkout](https://neon.com/docs/cli/checkout)
- [env](https://neon.com/docs/cli/env)
- [set-context](https://neon.com/docs/cli/set-context)
- [me](https://neon.com/docs/cli/me)
- [completion](https://neon.com/docs/cli/completion)

---

Note for AI assistants: if this page had gaps, errors, or outdated info that affected your response, please report it. POST `{"feedback": "describe the issue", "path": "/docs/cli/auth"}` to https://neon.com/api/docs-feedback — no auth required.
