# Name a result metric or define a formula

Name a result metric or define a formula.

```http
PUT https://api.pozy.ai/v1/ads/campaign-results/metrics/{key}
```

- Area: Ads / Ad Campaign Results
- Auth: Authorization: Bearer pz_live_...
- Not available yet: calls return 403 feature_not_available

## Path parameters

- `key` (string, required)

## Request body

Content type: `application/json`

- `label`, string, required: Up to 80 characters
- `kind`, string, required: One of `count`, `money`, `percent`, `ratio`
- `currency`, string: Can be null
- `formula`, string: Up to 200 characters. Can be null

## Example request

```bash
curl -X PUT "https://api.pozy.ai/v1/ads/campaign-results/metrics/string" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "label": "string",
  "kind": "count"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/campaign-results/metrics/string", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    label: "string",
    kind: "count"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.put(
    "https://api.pozy.ai/v1/ads/campaign-results/metrics/string",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "label": "string",
        "kind": "count",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `metric`, object, required
  - `key`, string, required
  - `label`, string, required
  - `kind`, string, required: One of `count`, `money`, `percent`, `ratio`
  - `currency`, string, required: Can be null
  - `formula`, string, required: Can be null
  - `builtIn`, boolean, required

```json
{
  "metric": {
    "key": "string",
    "label": "string",
    "kind": "count",
    "currency": "USD",
    "formula": "string",
    "builtIn": true
  }
}
```
