> ## Documentation Index
> Fetch the complete documentation index at: https://6f524b4-productmetrics.manicule.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://6f524b4-productmetrics.manicule.dev/docs/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://6f524b4-productmetrics.manicule.dev/docs/api/mcp.
> Every agent surface: https://6f524b4-productmetrics.manicule.dev/docs/.well-known/llms-manifest.json

# Product Metrics CLI (/docs/cli/overview)

<!-- agent-signals: reading_time_min: 4 · est_tokens: 1645 · updated: 2026-11-16 -->
Related: [Quickstart for developers and agents](/docs/cli/quickstart.md), [CLI authentication](/docs/cli/authentication.md), [CLI commands](/docs/cli/commands.md), [Use the CLI from an AI agent](/docs/cli/for-agents.md), [JSON output and exit codes](/docs/cli/json-and-exit-codes.md)

> productmetrics, the Product Metrics command line: every public API operation as a command, with JSON output and exit codes for scripts and agents.

`productmetrics` is the Product Metrics command line. It calls the [public API](/docs/api/overview) (`/api/public/v1`) and builds its commands, flags and help from the server's own list of operations, so a new API operation works without a new CLI release.

By the end of this page you will:

1. **Run `productmetrics`** and read its help
2. **Sign in** in a browser
3. **Run your first command** and read it as JSON

## Install and run

Install it from npm (Node.js 22 or later):

```bash
npm install -g @productmetrics/cli
productmetrics --help
# or once, without installing
npx @productmetrics/cli --help
```

The examples on these pages write `productmetrics`. By default it talks to `https://prod-backend.productmetrics.io`. `productmetrics status` shows which API it uses.

## Help

```bash
# every command and API group
productmetrics --help
# the commands of one group
productmetrics google-ads --help
# one command: request, scope, flags, examples
productmetrics settings update --help
# how an AI agent should use productmetrics
productmetrics help agents
```

`productmetrics`, `productmetrics help` and every `--help` print the same layout: usage, commands, flags with their types, defaults and allowed values, and examples.

* Add `--json` for a machine-readable description.
* Help topics: `productmetrics help agents`, `productmetrics help exit-codes`, `productmetrics help json`.

## Quickstart

```bash
# opens the browser; click Connect Product Metrics CLI
productmetrics login
# your account (email) and properties
productmetrics whoami
# find an operation
productmetrics capabilities --search settings
productmetrics settings get --property-id <property_id> --json
```

The last command prints the settings as JSON:

```text
{
  "ok": true,
  "data": {
    "labelizer_settings": { … },
    "settings_version": 4,
    …
  },
  "request_id": "…"
}
```

## How commands map to the API

Every API operation is a command. Its capability id gives the command: `group.command`, with `_` turned into `-`.

| Capability id                      | Command                                           |
| ---------------------------------- | ------------------------------------------------- |
| `google_ads.list_accounts`         | `productmetrics google-ads list-accounts`         |
| `settings.recommend_min_clicks`    | `productmetrics settings recommend-min-clicks`    |
| `merchant_center.apply_auto_setup` | `productmetrics merchant-center apply-auto-setup` |

Each path parameter, query parameter and top-level body field is a kebab-case flag:

| Field                | Flag                         |
| -------------------- | ---------------------------- |
| `propertyId`         | `--property-id`              |
| `feed_scope`         | `--feed-scope`               |
| `labelizer_settings` | `--labelizer-settings '{…}'` |

`productmetrics call <capability-id>` runs the same operation by its id. See [Commands](/docs/cli/commands).

## Built-in commands

| Command                       | What it does                                                     |
| ----------------------------- | ---------------------------------------------------------------- |
| `productmetrics login`        | Sign in to Product Metrics in a browser                          |
| `productmetrics logout`       | Sign out of this API origin                                      |
| `productmetrics status`       | Show which API productmetrics uses and whether you are signed in |
| `productmetrics whoami`       | Check the sign-in against the API: your account and properties   |
| `productmetrics capabilities` | List every API operation                                         |
| `productmetrics call`         | Run an operation by its id                                       |
| `productmetrics feedback`     | Tell the Product Metrics team what worked or did not             |
| `productmetrics mcp-config`   | Show how to add Product Metrics to Claude, ChatGPT or Cursor     |
| `productmetrics help`         | Help for a command or topic                                      |

`productmetrics agents` is short for `productmetrics help agents`.

## Global flags

| Flag              | What it does                                                                                        |
| ----------------- | --------------------------------------------------------------------------------------------------- |
| `--api <origin>`  | The Product Metrics API to use (default `https://prod-backend.productmetrics.io`, env `PM_API_URL`) |
| `--json`          | Print one JSON document on stdout (\{ok, data, request_id} or \{ok: false, error, exit_code})       |
| `--select <path>` | Print only part of the JSON document, e.g. .data.properties\[].property_id (implies --json)         |
| `-q, --quiet`     | Print only the primary id of the result, or nothing                                                 |
| `--verbose`       | Log requests, timings and request ids to stderr (never tokens or bodies)                            |
| `--no-input`      | Never prompt or open a browser (on by default without a terminal; env `PM_AGENT=1`, `CI`)           |
| `--no-color`      | No colours (env `NO_COLOR`)                                                                         |
| `--refresh`       | Fetch the server's command list again (it is cached for an hour)                                    |
| `-h, --help`      | Show help; with --json, a machine-readable description                                              |
| `-v, --version`   | Show the version                                                                                    |

## Where things are stored

* **Sign-in:** `${XDG_CONFIG_HOME:-~/.config}/product-metrics/credentials.json`, one entry per API origin, mode 0600 in a 0700 directory.
* **Command list cache** (one hour): `${XDG_CACHE_HOME:-~/.cache}/product-metrics/`.

## Use it from an AI app instead

`productmetrics mcp-config --client claude|chatgpt|cursor` prints the MCP server URL and how to add it as a connector. Connectors sign in in the browser and need no token. See [MCP](/docs/mcp/overview).

## Where next

* [Authentication](/docs/cli/authentication): `productmetrics login`, scopes and `PM_TOKEN`
* [Commands](/docs/cli/commands): every command group
* [For agents](/docs/cli/for-agents): driving `productmetrics` from Claude Code, Codex or a script
* [JSON and exit codes](/docs/cli/json-and-exit-codes)
