Skip to main content
POST
Create metric

Authorizations

Authorization
string
header
required

API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....

Headers

Prefer
string

Send return=minimal to get no body back from a write and skip reading the resource: a create answers 201 with only Location, and an update answers 204.

Example:

"return=minimal"

Body

application/json
name
string
required
Required string length: 1 - 200
Example:

"Accuracy"

source
enum<string> | null
Available options:
SELF_HOSTED,
FULL_PROMPT,
PARTIAL_PROMPT,
HUMAN_EVALUATION,
GEVAL,
DEEPEVAL,
DETERMINISTIC,
CLASSIFIER
Example:

"PARTIAL_PROMPT"

evaluationParams
string[] | null
Maximum array length: 20
Required string length: 1 - 64
Example:
judgePrompt
string | null
Maximum string length: 20000
evaluatorModelName
string | null

Required for PARTIAL_PROMPT. For CLASSIFIER: The selectable classifier model to run the question under, as listed by GET /evaluatorModels with kind=CLASSIFIER and selectable=true. Omitted or null, the one selectable classifier model is used. When several are selectable, the request is refused with 400 and this field must be sent.

Example:

"gpt-4.1"

definition
string | null
description
string | null
Maximum string length: 5000
documentationUrl
string | null
tags
string[] | null
Maximum array length: 20
Required string length: 1 - 64
areEvalParamsTop
boolean | null
organizationId
string | null
Example:

"org_123"

userGroupIds
string[] | null
Minimum string length: 1
Example:
specificationIds
string[] | null
Minimum string length: 1
Example:
judgeGenerationSettings
object | null

The generation settings this metric's judge runs with. Immutable: changing one creates a revision. Only the settings GET /evaluatorModels reports as configurable for the chosen model take effect; a value the provider rejects ends that evaluation as SKIPPED carrying the provider's own message.

passThreshold
number | null

Score from 0 to 1 at or above which an evaluation of this metric passes. Omitted or null, it defaults to 0.5, or to the parent metric's threshold for a revision.

Required range: 0 <= x <= 1
Example:

0.7

applicabilityScope
enum<string> | null

Which sessions get the applicability check before this metric is judged: PRODUCTION, DEVELOPMENT, ALL or NONE (no check). A session the check finds the metric does not apply to is skipped and no judge call is made. Omitted or null, it defaults to PRODUCTION for a metric the platform scores and NONE for any other. A revision keeps the parent metric's value when the check runs for both. Fixed at create: a change creates a revision. Any value but NONE is refused with a 400 for a metric the platform does not score. A metric that scores only traces is never checked, so it takes NONE and refuses any other value. A metric that also scores another field is checked without traces: on each turn's input and actual output and its other fields. A FULL_PROMPT metric with empty evaluationParams whose judge prompt reads only traces is stored as checked, yet the evaluator judges it without the check. A FULL_PROMPT metric whose evaluationParams list only traces takes NONE even when its judge prompt reads another field: list that field in evaluationParams to get the check. The check runs only where the deployment enables it.

Available options:
NONE,
DEVELOPMENT,
PRODUCTION,
ALL
Example:

"PRODUCTION"

applicabilityThreshold
number | null

The lowest probability, from 0 to 1, that the metric applies to a session at which it is judged. Below it, the session is skipped. Omitted or null, it defaults to 0.5, or to the parent metric's value for a revision when the check runs for both. Fixed at create: a change creates a revision. Refused with a 400 for a metric the platform does not score, and for a metric that scores only traces. The check runs only where the deployment enables it.

Required range: 0 <= x <= 1
Example:

0.7

classifierQuestion
object | null

CLASSIFIER only, and required there: the one question the classifier answers. evaluationParams is derived from its {{ param }} placeholders.

Response

Metric created successfully. On Prefer: return=minimal, or when the read after the write fails, the answer has no body.

id
string
required

Metric ID.

Example:

"metric_123"

organizationId
string | null
required

The organization of the metric. Null for a Galtea metric.

Example:

"org_123"

userId
string | null
required
Example:

"user_123"

name
string
required

Metric name, unique in its organization.

Example:

"Accuracy"

description
string | null
required
Example:

"Measures the accuracy of responses"

tags
string[]
required
Example:
documentationUrl
string | null
required
Example:

"https://docs.example.com/metrics/accuracy"

source
enum<string> | null
required

Evaluation method for the metric. FULL_PROMPT is deprecated for creation — POST /metrics rejects it with a 400. Use PARTIAL_PROMPT for new AI Evaluation metrics. The value remains in the enum because existing FULL_PROMPT metrics are still returned by reads and filters. CLASSIFIER is the Classifier judge, accepted only where the deployment enables it.

Available options:
SELF_HOSTED,
FULL_PROMPT,
PARTIAL_PROMPT,
HUMAN_EVALUATION,
GEVAL,
DEEPEVAL,
DETERMINISTIC,
CLASSIFIER
Example:

"PARTIAL_PROMPT"

activeRevisionId
string | null
required
read-only

The revision that evaluations of this metric run. Null when no revision is active.

Example:

"revision_123"

createdAt
string<date-time>
required
disabledAt
string<date-time> | null
required
read-only

The metric's own disabled date. It ignores the evaluator model of each revision: read a revision for that.