Product Metrics CLI
productmetrics, de command line van Product Metrics: elke openbare API-handeling als commando, met JSON-uitvoer en exitcodes voor scripts en agents.
productmetrics is de command line van Product Metrics. Hij roept de openbare API (/api/public/v1) aan en bouwt zijn commando’s, flags en help op uit de eigen lijst met handelingen van de server, dus een nieuwe API-handeling werkt zonder nieuwe CLI-release.
Stel Product Metrics van begin tot eind in vanuit de terminal.
productmetrics login, scopes en PM_TOKEN.
Elke commandogroep, met de scope en flags.
De --json-envelop, next_action en exitcodes 0 tot en met 4.
productmetrics aansturen vanuit Claude Code, Codex of een script.
Voeg Product Metrics als connector toe aan Claude, ChatGPT of Cursor.
Installeren en starten
Installeer hem vanuit npm (Node.js 22 of later):
pnpm add -g @productmetrics/cli
productmetrics --help
# of één keer, zonder te installeren
pnpm dlx @productmetrics/cli --helpDe voorbeelden op deze pagina’s schrijven productmetrics. Standaard praat hij met https://prod-backend.productmetrics.io. productmetrics status toont welke API hij gebruikt.
Inloggen en een commando uitvoeren
# opent de browser; klik op Connect Product Metrics CLI
productmetrics login
# je account (e-mailadres) en properties
productmetrics whoami
# een handeling zoeken
productmetrics capabilities --search settings
productmetrics settings get --property-id <property_id> --jsonHet laatste commando toont de instellingen als JSON:
{
"ok": true,
"data": {
"labelizer_settings": { … },
"settings_version": 4,
…
},
"request_id": "…"
}Help
# elk commando en elke API-groep
productmetrics --help
# de commando's van één groep
productmetrics google-ads --help
# één commando: verzoek, scope, flags, voorbeelden
productmetrics settings update --help
# hoe een AI-agent productmetrics moet gebruiken
productmetrics help agentsproductmetrics, productmetrics help en elke --help tonen dezelfde opbouw: gebruik, commando’s, flags met hun typen, standaardwaarden en toegestane waarden, en voorbeelden.
- Voeg
--jsontoe voor een machineleesbare beschrijving. - Helponderwerpen:
productmetrics help agents,productmetrics help exit-codes,productmetrics help json.
Hoe commando’s aansluiten op de API
Elke API-handeling is een commando. De capability-ID geeft het commando: group.command, waarbij _ wordt omgezet in -.
| Capability-ID | Commando |
|---|---|
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 |
Elke padparameter, queryparameter en elk bodyveld op het hoogste niveau is een flag in kebab-case:
| Veld | Flag |
|---|---|
propertyId | --property-id |
feed_scope | --feed-scope |
labelizer_settings | --labelizer-settings '{…}' |
productmetrics call <capability-id> voert dezelfde handeling uit op basis van de ID. Zie Commando’s.
Ingebouwde commando’s
| 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 de korte vorm van productmetrics help agents.
Algemene 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 |
Waar dingen worden opgeslagen
- Inloggegevens:
${XDG_CONFIG_HOME:-~/.config}/product-metrics/credentials.json, één item per API-origin, modus 0600 in een map met 0700. - Cache van de commandolijst (één uur):
${XDG_CACHE_HOME:-~/.cache}/product-metrics/.
Gebruik het in plaats daarvan vanuit een AI-app
productmetrics mcp-config --client claude|chatgpt|cursor toont de URL van de MCP-server en hoe je die als connector toevoegt. Connectors loggen in via de browser en hebben geen token nodig. Zie MCP.