> ## Documentation Index
> Fetch the complete documentation index at: https://e2b-automation-sdk-reference-sync.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication in CLI

There are two ways to authenticate with the E2B CLI:

## Option 1: browser authentication

<Warning>
  This option requires an interactive browser environment.
</Warning>

Run the following command to sign in through your browser:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
e2b auth login
```

This will open your default browser and prompt you to authenticate with your E2B account.

## Option 2: setup environment variables

This is the recommended option for non-interactive environments like CI/CD pipelines, servers, and containers. Set a single environment variable with your API key:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
export E2B_API_KEY=your_api_key_here
```

With the API key set, you can run CLI commands directly without `e2b auth login`. Use CLI version 2.12.1 or later.

<Info>
  Learn more about obtaining and managing your API key on the [API Key page](/api-key).
</Info>

## Switch the active project

If your E2B account has access to more than one [project](/projects), you can choose which one the CLI uses:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
e2b auth configure
```

Run this after signing in with `e2b auth login`. The CLI shows an interactive list of your projects and stores the one you select as the active project, so subsequent CLI commands use that project's API key. You need to be logged in first for this command to work.
