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

# Authentication

> Authenticate brew-cli with a Brew API key, understand brand vs organization scoping, and point the CLI at different environments.

The CLI authenticates with the same [API keys](/api-reference/api/authentication) as the Public API. Create one in the dashboard under [Settings, then API](https://brew.new/settings/api).

## Sign In

```bash theme={null}
brew-cli login
```

Paste your key when prompted. The CLI validates it against the API before storing anything, then saves it to `~/.config/brew-cli/config.json` with owner-only file permissions. `brew-cli logout` removes it, and `brew-cli whoami` shows the resolved credential (always masked) at any time.

Non-interactive environments skip `login` entirely and set an environment variable instead:

```bash theme={null}
export BREW_API_KEY=brew_your_key_here
```

## Precedence

When several sources are present, the CLI resolves the key in this order:

1. `--api-key` flag
2. `BREW_API_KEY` environment variable
3. The stored login

The same pattern applies to the brand: `--brand`, then `BREW_BRAND_ID`, then `brew-cli config set brandId ...`.

## Brand vs Organization Keys

A key is scoped either to one brand or to your whole organization:

* **Brand-scoped key**: the brand is implicit. Every command just works.
* **Organization-scoped key**: brand-level commands need to know which brand you mean. Pass `--brand <brandId>`, export `BREW_BRAND_ID`, or store a default with `brew-cli config set brandId <brandId>`. Find ids with `brew-cli brands list`. Omitting the brand returns a `BRAND_ID_REQUIRED` error rather than guessing.

Organization-level commands (`brands`, `templates`, `usage`) ignore the brand entirely.

## Key Hygiene

Keys start with `brew_` and are shown masked in every CLI output, including errors. Treat them like passwords: prefer `login` or environment variables over `--api-key` in shared shells (flags can land in shell history), scope keys to a single brand when you can, and rotate any key that leaks from the dashboard page where you created it.

## Need Help?

Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:

<Tabs>
  <Tab title="Self-Service Tools">
    <CardGroup cols="2">
      <Card title="Search Documentation" icon="magnifying-glass" color="#c44925">
        Type in the "Ask any question" search bar at the top left to instantly find relevant documentation pages.
      </Card>

      <Card title="ChatGPT/Claude Integration" icon="robot" color="#c44925">
        Click "Open in ChatGPT" at the top right of any page to explore it further with ChatGPT or Claude.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Talk to Our Team">
    <CardGroup cols="2">
      <Card title="Schedule a Call" icon="calendar" color="#c44925" href="https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ1iYoRUG1J792XQpbuQLjSRRDupr7MwraFK-HQRCtTYdBmrQi8nZu2qXfzKQigb8gbKJK3KN3-R">
        Book time with our founders for personalized guidance on strategy, best practices, or complex implementation questions.
      </Card>

      <Card title="Call Us Directly" icon="phone" color="#c44925">
        Need immediate assistance? Reach us at **+1-(332)-203-2145** for urgent issues or time-sensitive questions.
      </Card>

      <Card title="Slack Channel" icon="slack" color="#c44925">
        Our preferred support channel. You'll receive an invite after signup for direct founder support and fast responses.
      </Card>

      <Card title="Email Support" icon="envelope" color="#c44925" href="mailto:support@brew.new">
        Contact us at **[support@brew.new](mailto:support@brew.new)** for detailed inquiries or if you prefer not to use Slack.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
