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

# Create metric

> Create a metric with its first revision. To revise a metric, create a revision under `/v2/revisions`: this body refuses `parentMetricId`. `source` takes the values that `POST /metrics` takes. See [Metrics](https://docs.galtea.ai/concepts/metric).



## OpenAPI

````yaml /openapi.json post /v2/metrics
openapi: 3.0.0
info:
  version: 1.0.0
  title: Product Management Service API
  description: API documentation for Product Management Service
  contact:
    name: Galtea AI
servers:
  - url: https://api.galtea.ai
security:
  - bearerAuth: []
tags: []
externalDocs:
  description: Galtea Platform Documentation
  url: https://docs.galtea.ai
paths:
  /v2/metrics:
    post:
      tags:
        - metrics-v2
      summary: Create metric
      description: >-
        Create a metric with its first revision. To revise a metric, create a
        revision under `/v2/revisions`: this body refuses `parentMetricId`.
        `source` takes the values that `POST /metrics` takes. See
        [Metrics](https://docs.galtea.ai/concepts/metric).
      operationId: createMetricV2
      parameters:
        - $ref: '#/components/parameters/Prefer'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMetricV2Body'
      responses:
        '201':
          description: >-
            Metric created successfully. On `Prefer: return=minimal`, or when
            the read after the write fails, the answer has no body.
          headers:
            Location:
              schema:
                type: string
                description: The path of the new resource
              required: true
              description: The path of the new resource
            Content-Location:
              schema:
                type: string
                description: >-
                  The path of the resource in the body; absent when there is no
                  body
              required: false
              description: >-
                The path of the resource in the body; absent when there is no
                body
            Preference-Applied:
              schema:
                type: string
                enum:
                  - return=minimal
                description: 'Present when the API honored `Prefer: return=minimal`'
              required: false
              description: 'Present when the API honored `Prefer: return=minimal`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricV2'
        '400':
          description: >-
            Invalid request body, including an unknown field such as
            `parentMetricId`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The caller's user groups do not list metric.create
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: A user group or specification in the body is not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  parameters:
    Prefer:
      schema:
        $ref: '#/components/schemas/Prefer'
      required: false
      description: >-
        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`.
      name: Prefer
      in: header
  schemas:
    CreateMetricV2Body:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
          example: Accuracy
        source:
          type: string
          nullable: true
          enum:
            - SELF_HOSTED
            - FULL_PROMPT
            - PARTIAL_PROMPT
            - HUMAN_EVALUATION
            - GEVAL
            - DEEPEVAL
            - DETERMINISTIC
            - CLASSIFIER
          example: PARTIAL_PROMPT
        evaluationParams:
          type: array
          nullable: true
          items:
            type: string
            minLength: 1
            maxLength: 64
          maxItems: 20
          example:
            - input
            - actual_output
        judgePrompt:
          type: string
          nullable: true
          maxLength: 20000
        evaluatorModelName:
          type: string
          nullable: true
          example: gpt-4.1
          description: >-
            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.
        definition:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
          maxLength: 5000
        documentationUrl:
          type: string
          nullable: true
        tags:
          type: array
          nullable: true
          items:
            type: string
            minLength: 1
            maxLength: 64
          maxItems: 20
        areEvalParamsTop:
          type: boolean
          nullable: true
        organizationId:
          type: string
          nullable: true
          example: org_123
        userGroupIds:
          type: array
          nullable: true
          items:
            type: string
            minLength: 1
          example:
            - ug_123
        specificationIds:
          type: array
          nullable: true
          items:
            type: string
            minLength: 1
          example:
            - spec_123
        judgeGenerationSettings:
          type: object
          nullable: true
          properties:
            temperature:
              type: number
              nullable: true
              minimum: 0
              example: 0.3
            topP:
              type: number
              nullable: true
              minimum: 0
              maximum: 1
              example: 0.9
            maxOutputTokens:
              type: integer
              nullable: true
              minimum: 1
              example: 512
              description: >-
                A new metric needs at least 256, so the judge's structured
                answer fits. A metric stored before that floor keeps its cap.
            reasoningEffort:
              type: string
              nullable: true
              example: low
          additionalProperties: false
          description: >-
            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:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          example: 0.7
          description: >-
            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.
        applicabilityScope:
          type: string
          nullable: true
          enum:
            - NONE
            - DEVELOPMENT
            - PRODUCTION
            - ALL
          example: PRODUCTION
          description: >-
            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.
        applicabilityThreshold:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          example: 0.7
          description: >-
            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.
        classifierQuestion:
          type: object
          nullable: true
          properties:
            type:
              type: string
              enum:
                - yes_no
                - scale
            instructions:
              type: string
              maxLength: 2000
              description: >-
                The question, in English, naming at least one {{
                evaluation_param }}.
            goodAnswer:
              type: string
              nullable: true
              enum:
                - 'yes'
                - 'no'
              description: yes_no only, and required there.
            criteria:
              type: object
              nullable: true
              properties:
                'yes':
                  type: string
                  nullable: true
                  maxLength: 1000
                'no':
                  type: string
                  nullable: true
                  maxLength: 1000
              description: 'yes_no only: what yes and no mean.'
            levels:
              type: array
              nullable: true
              items:
                type: object
                properties:
                  description:
                    type: string
                    maxLength: 1000
                  score:
                    type: number
                    nullable: true
                    description: >-
                      From 0 to 1. Omit it on every level to space the scores
                      evenly from 0 (worst) to 1 (best).
                required:
                  - description
              maxItems: 10
              description: >-
                scale only: the scored levels, worst first, with non-decreasing
                scores.
            doesNotApply:
              type: string
              nullable: true
              maxLength: 1000
              description: >-
                scale only: the text of an extra level that skips the evaluation
                when the classifier picks it.
          required:
            - type
            - instructions
          description: >-
            CLASSIFIER only, and required there: the one question the classifier
            answers. evaluationParams is derived from its {{ param }}
            placeholders.
      required:
        - name
      additionalProperties: false
    MetricV2:
      type: object
      properties:
        id:
          type: string
          example: metric_123
          description: Metric ID.
        organizationId:
          type: string
          nullable: true
          example: org_123
          description: The organization of the metric. Null for a Galtea metric.
        userId:
          type: string
          nullable: true
          example: user_123
        name:
          type: string
          example: Accuracy
          description: Metric name, unique in its organization.
        description:
          type: string
          nullable: true
          example: Measures the accuracy of responses
        tags:
          type: array
          items:
            type: string
          example:
            - accuracy
            - quality
        documentationUrl:
          type: string
          nullable: true
          example: https://docs.example.com/metrics/accuracy
        source:
          type: string
          nullable: true
          enum:
            - SELF_HOSTED
            - FULL_PROMPT
            - PARTIAL_PROMPT
            - HUMAN_EVALUATION
            - GEVAL
            - DEEPEVAL
            - DETERMINISTIC
            - CLASSIFIER
          example: PARTIAL_PROMPT
          description: >-
            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.
        activeRevisionId:
          type: string
          nullable: true
          readOnly: true
          example: revision_123
          description: >-
            The revision that evaluations of this metric run. Null when no
            revision is active.
        createdAt:
          type: string
          format: date-time
        disabledAt:
          type: string
          nullable: true
          format: date-time
          readOnly: true
          description: >-
            The metric's own disabled date. It ignores the evaluator model of
            each revision: read a revision for that.
      required:
        - id
        - organizationId
        - userId
        - name
        - description
        - tags
        - documentationUrl
        - source
        - activeRevisionId
        - createdAt
        - disabledAt
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
    Prefer:
      type: string
      description: >-
        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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        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-...`.

````

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