---
title: "Name a result metric or define a formula"
method: PUT
path: "/v1/ads/campaign-results/metrics/{key}"
tags: ["Ad Campaign Results"]
---

# Name a result metric or define a formula

`PUT /v1/ads/campaign-results/metrics/{key}`

## Request

- Base URL: `https://zernio.com/api`
- URL: `https://zernio.com/api/v1/ads/campaign-results/metrics/{key}`
- Auth: HTTP bearer

Sets a metric key's label and kind: `count` for things you count (leads, sales), `money` with its currency (revenue), `percent` or `ratio`.

Send `formula` to make it a computed metric: `+ - * /` and parentheses over `spend`, `impressions`, `clicks`, `conversions`, `purchase_value` and the metrics you send, at most 200 characters. A formula cannot read another formula.

It is computed per campaign over the summed values of the range, and has no value when an input is missing or a division is by zero.

## Path parameters

- `key` string, required

## Request body

- object
  - `label` string, required
  - `kind` 'count' | 'money' | 'percent' | 'ratio', required
  - `currency` string, nullable: ISO 4217, money metrics only.
  - `formula` string, nullable: Makes it a computed metric. Null or absent for a number you send.

## Response `200`

The metric.

- object
  - `metric` CampaignResultMetric, required
    - `key` string, required
    - `label` string, required
    - `kind` 'count' | 'money' | 'percent' | 'ratio', required: How the value reads: `percent` values are already multiplied by 100.
    - `currency` string, nullable, required
    - `formula` string, nullable, required: Null for a number you send. For a computed metric, the formula over `spend`, `impressions`, `clicks`, `conversions`, `purchase_value` and the metrics you send, e.g. `spend / revenue * 100`.
    - `builtIn` boolean, required: One of the formulas every team has (`cac_percent`, `cost_per_sale`, `cost_per_qualified_lead`, `lead_to_sale`). Setting the same key replaces it for your team.

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid API key. `code` is `missing_credentials` when no Authorization header was sent and `invalid_credentials` when the key is unknown, revoked or expired.

## Changes

- **2026-10-30** `c319eb5d95b6`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/zernio/apis/zernio-api/changes/v1/ads/campaign-results/metrics/:key/put.md)

---

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