> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roark.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# roark metric definition create

> Create custom metric definition

Create a new metric definition. The `calculationType` field selects the variant: `LLM_JUDGE` (LLM-evaluated), FORMULA (computed from a math expression over other metrics), or PATTERN (detects a trigger→outcome pattern within a window). To create a threshold on top of an existing metric, use `POST /metric/definitions/{idOrSlug}/thresholds` instead.

```bash Synopsis theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
roark metric definition create [options]
```

> [!NOTE]
>
> Calls `POST /v1/metric/definitions`

## Request body

This endpoint accepts one of several request shapes, so the body is supplied as
JSON through `--data` or on standard input rather than as individual flags.

**PromptMetricInput** `object`

Requires `calculationType`, `name`, `outputType`

**FormulaMetricInput** `object`

Requires `calculationType`, `name`, `outputType`, `formula`, `sources`

**PatternMetricInput** `object`

Requires `calculationType`, `name`, `operation`, `outcome`

## Example

```bash theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
roark metric definition create --data '{ ... }'
```

Every command also takes the [global options](/cli-reference/overview.md#global-options) and sets one
of the [exit codes](/cli-reference/overview.md#exit-codes).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.