---
title: "Preview Custom Metric"
method: POST
path: "/api/v1/custom-metrics/preview"
tags: ["custom-metrics"]
---

# Preview Custom Metric

`POST /api/v1/custom-metrics/preview`

Evaluate a draft metric on ~5 recent logs without persisting results.

## Request body

- MetricPreviewRequest — Request body for POST /custom-metrics/preview (dry-run evaluation).
  - `prompt` string, required
  - `response_type` 'pass_fail' | 'yes_no' | 'numeric_score' | 'categorical' | 'text' | 'json', required
  - `config` object
  - `model` string, nullable
  - `linked_agent_ids` string[]
  - `allow_na` boolean

## Response `200`

Successful Response

- MetricPreviewResponse — Response for POST /custom-metrics/preview.
  - `results` MetricPreviewResult[], required
    - `log_id` string, required
    - `log_snippet` string, required
    - `result_state` 'pass' | 'fail' | 'na' | 'not_run' | 'error', required
    - `passed` boolean, nullable
    - `score` number, nullable
    - `categorical_value` string, nullable
    - `reasoning` string, nullable
  - `logs_evaluated` integer, required

## Other responses

- `401` — Authentication required
- `422` — Validation Error

---

[API](https://skmtc.dev/getanana/apis/cleon-api.md) · [All operations](https://skmtc.dev/getanana/apis/cleon-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/getanana/cleon-api/revisions/c0f54348e251/schema)
