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

# Installation & Authentication

> Install the LexQ CLI and set up your API key.

## Requirements

* **Node.js** 18 or later
* An active LexQ account with an API key

## Installation

<CodeGroup>
  ```bash npm (global) theme={null}
  npm install -g @lexq/cli
  ```

  ```bash npx (no install) theme={null}
  npx @lexq/cli groups list
  ```

  ```bash pnpm theme={null}
  pnpm add -g @lexq/cli
  ```
</CodeGroup>

Verify: `lexq --version`

## Authentication

### Step 1: Get Your API Key

1. Log in to the [LexQ Console](https://console.lexq.io)
2. Navigate to **Management → API Keys**
3. Click **Generate New Key**
4. Copy the key (format: `lexq_us_xxxxxxxxxxxxx`)

<Warning>
  API keys grant full access to your organization's policy engine. Store them securely and never commit them to version control.
</Warning>

### Step 2: Log In

```bash theme={null}
lexq auth login
# Enter your API Key: lexq_us_xxxxxxxxxxxxx
# ✓ Authenticated successfully
```

The key is persisted at `~/.lexq/config.json`.

### Step 3: Verify

```bash theme={null}
lexq auth whoami
```

## Configuration

Config is stored at `~/.lexq/config.json`:

```json theme={null}
{
  "apiKey": "lexq_us_xxxxxxxxxxxxx",
  "baseUrl": "https://api.lexq.io/api/v1/partners",
  "format": "json"
}
```

## Global Options

Every command accepts these flags:

| Flag                     | Description                                |
| ------------------------ | ------------------------------------------ |
| `--format <json\|table>` | Output format (default: `json`)            |
| `--api-key <key>`        | Override stored API key                    |
| `--base-url <url>`       | Override API base URL                      |
| `--dry-run`              | Preview the HTTP request without executing |
| `--verbose`              | Show full request/response details         |
| `--no-color`             | Disable colored output                     |

<Tip>
  **For AI agents:** Always use `--format json` (the default). Parse JSON output programmatically. Use `--format table` only for human-readable display.
</Tip>

## Next Steps

<CardGroup cols={2}>
  <Card title="Command Reference" icon="terminal" href="/cli/commands">
    Browse all available commands.
  </Card>

  <Card title="MCP Server" icon="plug" href="/cli/mcp-server">
    Set up AI agent integration via MCP.
  </Card>
</CardGroup>
