# CLI Authentication

> hyperfile login authenticates through your browser and refreshes tokens for you. In CI, where no browser exists, export an API key instead.

The CLI uses browser-based OAuth to authenticate.

## Login

```bash
hyperfile login
```

This opens your browser to the Hyperfile login page. After signing in, the CLI receives an access token and stores it locally.

## Token Storage

Tokens are stored in `~/.hyperfile/credentials.json`. The CLI automatically refreshes expired tokens.

## Logout

```bash
hyperfile logout
```

This removes stored credentials from your machine.

## CI/CD Environments

For automated environments, use an API key instead of interactive login:

```bash
export HYPERFILE_API_KEY=<your-api-key>
hyperfile sync ./dist --fs <filesystem-uid>
```

Generate API keys from **Settings → API Keys** in the web app.

---

Canonical HTML version: https://hyperfile.io/docs/cli/auth/
