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

# CLI Reference

> Command-line interface for the Maitai Platform Developer API.

The Maitai CLI lets you manage Maitai product resources from the terminal, applications, intents, agents, workflows, datasets, test sets, finetune runs, sentinels, analytics, and more. It wraps the [API Reference](/api-reference) (`/api/v1`).

## Install

```bash theme={null}
pip install maitai-cli
```

## Authenticate

```bash theme={null}
# Browser login (default): opens Portal, then saves key to ~/.maitai/config
maitai login

# Or pass a pre-created key (CI / headless)
maitai login --api-key YOUR_MAITAI_API_KEY

# Or use environment variable (no login needed)
export MAITAI_API_KEY="YOUR_MAITAI_API_KEY"
```

Create API keys in the [Portal](https://portal.trymaitai.com) under **Settings > API Keys**.

## Quick usage

```bash theme={null}
# Check auth status
maitai whoami

# List resources
maitai applications --list
maitai agents --list
maitai intent-groups --list
maitai workflows --list
maitai datasets --list
maitai test-sets --list

# Get by ID
maitai applications --get 42
maitai agents --get 1

# Raw API calls (any endpoint)
maitai api GET /applications
maitai api POST /applications -b '{"application_name":"Test","application_ref_name":"test"}'
maitai api POST /workflows/123/versions -b '{"bump_type":"minor"}'
```

## Base URL

* **Production**: `https://api.trymaitai.ai/api/v1`
* Override with `MAITAI_BASE_URL` or `maitai login --base-url`

## Response format

* **Success**: `{"data": {...}}`
* **Paginated**: `{"data": [...], "pagination": {"total": N, "offset": 0, "limit": 25}}`
* **Error**: `{"error": {"status": 401, "message": "..."}}`

## Command reference

See [Commands](/cli-reference/commands) for the full list of resource commands and options.

For coverage details and intentionally excluded Portal/admin surfaces, see [API Coverage](/api-reference/coverage).
