---
title: "Catalog sync from the ops catalog (#5034)"
method: PUT
path: "/internal/company-metrics/definitions"
tags: ["Internal"]
---

# Catalog sync from the ops catalog (#5034)

`PUT /internal/company-metrics/definitions`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/internal/company-metrics/definitions`
- Auth: HTTP bearer

The metrics writer's catalog sync. A new (metric_key, version) is inserted; an existing one with identical content is a no-op; with other content it is refused (`version_conflict`): a change needs a new version. A line change (comparators, lines or path) against the key's latest stored version is refused (`line_change_without_approval`) unless the new version is approved with `lines_approved_by` and `lines_approved_on`, or both versions are still proposed. Every row must pass the catalog rules (`invalid_definition`). All or nothing. Mounted only when COMPANY_METRICS_WRITER_SERVICE_ACCOUNT and COMPANY_METRICS_WRITER_AUDIENCE are set; the only credential is the writer's Google-signed ID token.

## Request body

- object
  - `definitions` CompanyMetricDefinition[], required
    - `metric_key` string, required
    - `version` integer, required
    - `area` string, required
    - `tier` 'war_room' | 'delivery' | 'vital' | 'diagnostic', required
    - `tags` string[], required
    - `name` string, required
    - `description` string, required
    - `why` string, required
    - `action_on_red` string, nullable, required
    - `unit` 'count' | 'usd' | 'percent' | 'hours' | 'business_hours' | 'days' | 'business_days' | 'months' | 'ratio', required
    - `direction` 'higher_better' | 'lower_better' | 'band', required
    - `aggregation` 'stock' | 'flow' | 'median' | 'rate', required
    - `grains` string[], required
    - `segment_dims` string[], required
    - `min_n` integer, nullable, required
    - `source` string, required
    - `writer` string, required
    - `query_ref` string, required
    - `stale_after_seconds` integer, required
    - `green_comparator` 'lt' | 'lte' | 'gt' | 'gte' | 'null', nullable, required
    - `green_line` number, nullable, required
    - `red_comparator` 'lt' | 'lte' | 'gt' | 'gte' | 'null', nullable, required
    - `red_line` number, nullable, required
    - `path_start` CompanyMetricPathPoint, nullable, required
      - `date` string, date, required
      - `value` number, nullable, required
      - `ref` string
    - `path_end` CompanyMetricPathPoint, nullable, required
      - `date` string, date, required
      - `value` number, nullable, required
      - `ref` string
    - `red_consecutive_periods` integer, required
    - `alerting` boolean, required
    - `owner` 'jacob' | 'augusto', required
    - `backup` 'jacob' | 'augusto' | 'null', nullable, required
    - `approval_state` 'approved' | 'proposed', required
    - `lines_approved_by` string, nullable, required
    - `lines_approved_on` string, date, nullable, required
    - `approval_ref` string, required
    - `status` 'live' | 'derive' | 'instrument' | 'not_wired', required
    - `blocker` string, nullable, required
    - `created_at` string, date-time

## Response `200`

Synced

- object
  - `success` true, required
  - `data` object, required
    - `inserted` integer, required
    - `unchanged` integer, required

## Other responses

- `401`: No credential, or a token that is not the writer's (bad signature, audience or expiry)
- `403`: `forbidden`: a signed-in person, any API key (the service tokens included), an MCP OAuth token, or another service account
- `409`: `version_conflict`; the refused rows are in `error.extensions.rows`
- `422`: `invalid_definition` or `line_change_without_approval`; the refused rows are in `error.extensions.rows`

## Changes

- **2026-11-19** `96dc1148df17`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/medianfi/apis/median-api/changes/internal/company-metrics/definitions/put.md)

---

[API](https://skmtc.dev/medianfi/apis/median-api.md) - [All operations](https://skmtc.dev/medianfi/apis/median-api/llms.txt) - [OpenAPI document](https://skmtc.dev/medianfi/apis/median-api/revisions/4f4c2d34276b?raw)
