Metric

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.

post/v1/metric/definitions

Request body

OR
OR

Example request

{
  "name": "Customer Satisfaction",
  "slug": "customer_satisfaction",
  "metricId": "customer_satisfaction",
  "outputType": "BOOLEAN",
  "llmPrompt": "Evaluate whether the customer expressed satisfaction with the service provided."
}

Response

The created metric definition

Changes

Changed in 2 of the 105 revisions of this API.10266

    • the request property oneOf[subschema #1: LLM judge metric]/analysisPackageId became optional

      request-property-became-optional

    • the request property oneOf[subschema #2: Formula metric]/analysisPackageId became optional

      request-property-became-optional

    • the request property oneOf[subschema #3: Pattern metric]/analysisPackageId became optional

      request-property-became-optional

  • 887b091b3d8110263See the full diff
    • the request's body type/format changed from object/ to /

      request-body-type-changed

    • added LlmJudgeMetricResponse FormulaMetricResponse PatternMetricResponse to the data response property oneOf list for the response status 201

      response-property-one-of-added

    • the data response's property type/format changed from object/ to / for status 201

      response-property-type-changed

    • removed the required property data/description from the response with the 201 status

      response-required-property-removed

    • removed the required property data/id from the response with the 201 status

      response-required-property-removed

    • removed the required property data/metricId from the response with the 201 status

      response-required-property-removed

    • removed the required property data/name from the response with the 201 status

      response-required-property-removed

    • removed the required property data/scope from the response with the 201 status

      response-required-property-removed

    • removed the required property data/supportedContexts from the response with the 201 status

      response-required-property-removed

    • removed the required property data/type from the response with the 201 status

      response-required-property-removed

    • removed the request property analysisPackageId

      request-property-removed

    • removed the request property booleanFalseLabel

      request-property-removed

    • removed the request property booleanTrueLabel

      request-property-removed

    • removed the request property classificationOptions

      request-property-removed

    • removed the request property llmPrompt

      request-property-removed

    • removed the request property maxClassifications

      request-property-removed

    • removed the request property metricId

      request-property-removed

    • removed the request property name

      request-property-removed

    • removed the request property outputType

      request-property-removed

    • removed the request property participantRole

      request-property-removed

    • removed the request property scaleLabels

      request-property-removed

    • removed the request property scaleMax

      request-property-removed

    • removed the request property scaleMin

      request-property-removed

    • removed the request property scope

      request-property-removed

    • removed the request property supportedContexts

      request-property-removed

    • removed the optional property data/unit from the response with the 201 status

      response-optional-property-removed

    • added the new conflict enum value to the type response property for the response status 400

      response-property-enum-value-added

    • added the new conflict enum value to the type response property for the response status 401

      response-property-enum-value-added

    • added the new conflict enum value to the type response property for the response status 403

      response-property-enum-value-added

    • added the new conflict enum value to the type response property for the response status 429

      response-property-enum-value-added

    • added the new conflict enum value to the type response property for the response status 500

      response-property-enum-value-added

    • added the new payment_required enum value to the type response property for the response status 400

      response-property-enum-value-added

    • added the new payment_required enum value to the type response property for the response status 401

      response-property-enum-value-added

    • added the new payment_required enum value to the type response property for the response status 403

      response-property-enum-value-added

    • added the new payment_required enum value to the type response property for the response status 429

      response-property-enum-value-added

    • added the new payment_required enum value to the type response property for the response status 500

      response-property-enum-value-added

    • added request discriminator

      request-body-discriminator-added

    • added PromptMetricInput FormulaMetricInput PatternMetricInput to the request body oneOf list

      request-body-one-of-added

    • added discriminator to data response property for the response status 201

      response-property-discriminator-added

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog