conv.write_metric(...), and read metric values — Poly Score included — through the Data API. poly metrics requires a subcommand.
Two kinds of subcommand live here. list, export, add, edit and import manage definitions. available, query and score read values: they call the Data API for the project’s live conversation data, need no push, and page with --limit / --offset (the API allows 100 requests a minute per key).
Metrics are defined per project, not per branch or environment. Creating, editing, or importing a metric takes effect immediately for the whole project; there is no push step and nothing is written to the local resource tree.
A metric has a name in SCREAMING_SNAKE_CASE, a type (string, int, bool, or float), an optional description, an api flag marking it as an API metric, and an active flag. String metrics can also carry a list of expected values.
poly metrics list
Show every custom metric in a table, with a count of active and inactive metrics.
Examples:
--json output shape:
poly metrics available
Show every metric the project can query: built-in metrics such as poly_score_v2, duration and handoff, plus the custom metrics defined in the project. These are the names poly metrics query and the --filter flags accept (case-insensitive).
Examples:
--json output shape:
poly metrics query
Aggregate one metric over a time window, optionally bucketed by interval and grouped by dimension. Backed by the Data API’s aggregate endpoint, which is marked experimental by the service.
Examples:
bucket column when --interval is set, one column per --by dimension, then one column per --agg. Rows are sorted by bucket ascending, then by --sort.
Buckets are labelled in the timezone they were bucketed in: UTC, or --timezone for hourly and daily buckets. The label never depends on the machine’s timezone. Daily, weekly and monthly buckets show the date they start on (2026-10-01); hourly buckets add the time and zone (2026-10-01 14:00 UTC). --json keeps the timestamps as the Data API returns them.
--json output shape:
Weekly and monthly windows
Weekly buckets are whole calendar weeks starting on Monday (UTC) and monthly buckets are whole calendar months. With--interval weekly or --interval monthly the window is widened to whole buckets: --from moves back to the start of its week or month, and a --to in the past moves forward to the end of its week or month. --from 2026-10-01 --interval weekly (a Thursday) therefore queries from Monday 28 September.
When this happens the table is preceded by a line such as Weekly buckets are whole weeks, so the window is from 2026-09-28., and --json output gains a window object with the from_datetime and to_datetime that were sent. poly metrics score uses the widened window for its headline as well, so the headline and the table rows always add up.
poly metrics score
Poly Score for the project: a one-line headline (average and conversation count over the whole window) above the bucketed table. Shortcut for poly metrics query poly_score_v2 --agg avg --agg conversation_count, defaulting to the last 7 days bucketed daily. The headline comes from a separate unbucketed request, so it covers the full window whatever --limit and --offset leave in the table.
score reads Poly Score (1 to 5), the score new conversations get (the poly_score_v2 metric). --v1 reads the previous Poly Score (0 to 10, the poly_score metric), which only older conversations have. The headline names the score and its scale, because the same number means something different on each: Poly Score (1-5) from 2026-11-03 to 2026-11-09: 3.7 average over 1,369 conversations. With --v1 it starts Previous Poly Score (0-10).
Examples:
--json output shape:
Permissions
available, query and score need an API key with read permission on conversations. They return no PII, so PII read permission is not required. See poly conversations search and poly transcripts for the routes that are PII-gated.poly metrics export
Export every metric definition as YAML, to a file or to stdout.
Examples:
To YAML:
poly metrics import reads:
--json output shape:
poly metrics add
Create a new metric. Any required field left off the command line is prompted for interactively.
Examples:
--json requires --name and --typeInteractive prompts are unavailable in JSON mode, so poly metrics add --json fails unless both flags are supplied.--json output shape:
poly metrics edit
Update an existing metric. Passing no flags opens an interactive picker showing the metric’s current values, so you can choose which fields to change.
Examples:
--json needs at least one flagThe interactive picker cannot run in JSON mode, so poly metrics edit --json fails unless at least one field flag is passed.--json output shape:
poly metrics import
Bulk-create metrics from a YAML file in the format poly metrics export produces. Metrics that already exist are skipped rather than updated.
Examples:
--json output shape:
--dry-run, the output is {"dry_run": true, "would_create": [], "would_skip": [], "remote_only": []} instead.
Related pages
- Custom metrics — how defining metrics fits alongside writing them from function code

