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

# Quickstart

> Install the Instantly CLI, authenticate, and run your first command.

Install the CLI, authenticate with an API v2 key, and list campaigns in your workspace.

## Prerequisites

* Node.js 18 or later.
* An Instantly workspace with an [API v2 key](/getting-started/getting-started).

<Steps>
  <Step title="Install the CLI">
    Install the package globally with npm:

    ```bash theme={null}
    npm install -g @instantlyai/cli
    ```

    To run a command without installing the package globally, use `npx`:

    ```bash theme={null}
    npx @instantlyai/cli campaigns list
    ```
  </Step>

  <Step title="Authenticate">
    Run the interactive login command:

    ```bash theme={null}
    instantly login
    ```

    Enter your API key when prompted. The CLI validates the key and stores it in `~/.instantly/config.json`.

    <Warning>
      Keep your API key secure. Never share the CLI configuration file or commit it to source control.
    </Warning>
  </Step>

  <Step title="Run your first command">
    List the campaigns in your workspace:

    ```bash theme={null}
    instantly campaigns list --pretty
    ```

    The CLI returns JSON. The `--pretty` flag formats it for terminal output.
  </Step>
</Steps>

## Authenticate scripts and CI/CD workflows

Set `INSTANTLY_API_KEY` when you need non-interactive authentication:

```bash theme={null}
export INSTANTLY_API_KEY="your-api-key"
instantly campaigns list
```

The CLI resolves credentials in this order:

1. The `--api-key` command flag.
2. The `INSTANTLY_API_KEY` environment variable.
3. The key saved by `instantly login`.

## Format command output

Every command returns JSON by default. Use output flags to control what the CLI prints:

```bash theme={null}
instantly campaigns list --pretty
instantly campaigns list --fields "id,name,status"
instantly campaigns list --quiet
```

## Try more commands

```bash theme={null}
instantly accounts list
instantly analytics campaign-overview
instantly email unread-count
```

<Note>
  The CLI also includes a local MCP server. Run `instantly mcp`, or use the [hosted Instantly MCP server](/mcp/introduction) without installing the CLI.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="API reference" icon="code" href="/api-reference/introduction">
    Browse resources, request fields, and response schemas.
  </Card>

  <Card title="View on npm" icon="box" href="https://www.npmjs.com/package/@instantlyai/cli">
    Review package details and available commands.
  </Card>
</CardGroup>
