# Authentication

There are two ways to authenticate with the Zuplo Command Line Interface (CLI):
using an API Key or via OAuth.

## Using OAuth

The Zuplo CLI supports OAuth authentication. To authenticate using OAuth, run
the following command:

```bash
zuplo login
```

Your browser will open and prompt you to log in to your Zuplo account. After
logging in, you will be redirected to a page that confirms your authentication.
You can then return to your terminal, which will now be authenticated.

## Using an API key

API key authentication is useful for CI/CD pipelines or other automated
workflows where interactive login isn't feasible. See the following instructions
to obtain and use an API key with the Zuplo CLI.

:::tip

The API key is scoped to your account. So you can use the same one for all
projects under the same account. If you are a member of multiple accounts, be
sure to select the right one.

:::

The Zuplo CLI uses API Keys to authenticate. You can find your API Key by
following these steps:

1. Navigate to [portal.zuplo.com](https://portal.zuplo.com) and log in.
2. Select the account that you want to work on.
3. Click the **Settings** tab and navigate to the "API Keys" section. Select an
   existing API Key or create a new one to use with the CLI.

Most commands take an `--api-key` argument. For example, to list your available
Zuplo API Gateways, run:

```bash
zuplo list --api-key zpka_d67b7e241bb948758f415b79aa8exxxx_2efbxxxx
```

If you don't want to pass your API Key to every command, you can set it as an
environment variable:

```bash
export ZUPLO_API_KEY=zpka_d67b7e241bb948758f415b79aa8exxxx_2efbxxxx
zuplo list
```
