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

# Preview Metric V3

> Evaluate a metric configuration on up to 10 call logs or runs and return the verdicts, without saving the metric. Use it to check a metric before creating or updating it. Usually 30 seconds to 3 minutes; custom-code metrics can take longer.



## OpenAPI

````yaml post /test_framework/v3/metrics/preview/
openapi: 3.1.0
info:
  title: Cekura API
  version: v1
  description: >-
    Complete API documentation for the Cekura platform. This API provides
    endpoints for testing, observing, and evaluating AI voice agents — including
    managing agents, running evaluators, defining metrics, and analyzing call
    quality.
servers:
  - url: https://api.cekura.ai
security: []
paths:
  /test_framework/v3/metrics/preview/:
    post:
      tags:
        - test_framework
      summary: Preview metric
      description: >-
        Evaluate a metric configuration on up to 10 call logs or runs and return
        the verdicts, without saving the metric. Use it to check a metric before
        creating or updating it. Usually 30 seconds to 3 minutes; custom-code
        metrics can take longer.
      operationId: metrics-v3-preview
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MetricPreview'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/MetricPreview'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/MetricPreview'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - completed
                      - failed
                    description: >-
                      `failed` when the job could not produce its result; see
                      `error` / `errors`.
                  project_id:
                    type:
                      - integer
                      - 'null'
                  agent_id:
                    type:
                      - integer
                      - 'null'
                  completed:
                    type: integer
                    description: Items evaluated.
                  total:
                    type: integer
                  results:
                    type: array
                    items:
                      type: object
                      description: >-
                        One per previewed call log (`call_log_id`, `call_id`) or
                        run (`run_id`). The verdict is `result`, or `score` /
                        `enum` for custom-code metrics.
                      properties:
                        result:
                          description: Verdict for LLM-judge metrics.
                        score:
                          type: number
                        enum:
                          type: string
                        explanation:
                          type: string
                        is_relevant:
                          type: boolean
                        call_log_id:
                          type: integer
                        call_id:
                          type:
                            - string
                            - 'null'
                        run_id:
                          type: integer
                        error:
                          type:
                            - string
                            - 'null'
                  error:
                    type:
                      - string
                      - 'null'
                    description: Why the job failed, when it did.
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  field_name:
                    type: array
                    items:
                      type: string
          description: ''
        '403':
          description: No access to the agent, project or metric the job runs on.
        '504':
          description: >-
            The job did not finish within 15 minutes. It may still complete in
            the background.
      security:
        - api_key: []
        - oauth2: []
        - embedded_session: []
        - supabase_session: []
components:
  schemas:
    MetricPreview:
      type: object
      properties:
        agent_id:
          type: integer
          description: Agent ID - all call logs/runs must belong to this agent
        project_id:
          type: integer
          description: Project ID - all call logs/runs must belong to this project
        call_log_ids:
          type: array
          items:
            type: integer
          description: >-
            List of call log IDs to evaluate (maximum 10, required if run_ids
            not provided)
          maxItems: 10
          minItems: 1
        run_ids:
          type: array
          items:
            type: integer
          description: >-
            List of run IDs to evaluate (maximum 10, required if call_log_ids
            not provided)
          maxItems: 10
          minItems: 1
        metric_data:
          allOf:
            - $ref: '#/components/schemas/MetricPreviewData'
          description: Metric configuration to evaluate
      required:
        - metric_data
    MetricPreviewData:
      type: object
      properties:
        name:
          type: string
          description: Name of the metric
          maxLength: 255
        type:
          enum:
            - basic
            - custom_prompt
            - custom_code
            - llm_judge
          type: string
          x-spec-enum-id: b44700c0a6443b40
          description: >-
            Type of metric: basic, custom_prompt, or custom_code


            * `basic` - Basic (Deprecated in favor of LLM Judge)

            * `custom_prompt` - Custom Prompt ( Deprecated in favor of LLM
            Judge)

            * `custom_code` - Custom Code

            * `llm_judge` - LLM Judge
        eval_type:
          enum:
            - binary
            - continuous_qualitative
            - numeric
            - enum
          type: string
          x-spec-enum-id: b40eac6824409cc2
          description: >-
            Evaluation type: binary, continuous_qualitative, numeric, or enum.
            Legacy values (binary_workflow_adherence, binary_qualitative) are
            accepted and mapped to binary.


            * `binary` - Binary

            * `continuous_qualitative` - Continuous Qualitative

            * `numeric` - Numeric

            * `enum` - Enum
        evaluation_trigger:
          enum:
            - always
            - automatic
            - custom
          type: string
          x-spec-enum-id: ecd3c02e0e393ef5
          default: always
          description: |-
            When to trigger evaluation: always, automatic, or custom

            * `always` - Always
            * `automatic` - Automatic
            * `custom` - Custom
        trigger_type:
          enum:
            - llm_judge
            - custom_code
          type: string
          x-spec-enum-id: 2adad4b8df61914f
          default: llm_judge
          description: >-
            Type of trigger evaluation: llm_judge or custom_code (only used when
            evaluation_trigger is custom)


            * `llm_judge` - LLM Judge

            * `custom_code` - Custom Code
        evaluation_trigger_prompt:
          type: string
          default: ''
          description: >-
            Prompt for evaluation trigger (required for custom trigger with
            llm_judge)
        evaluation_trigger_custom_code:
          type: string
          default: ''
          description: >-
            Python code for trigger evaluation (required for custom trigger with
            custom_code)
        description:
          type: string
          default: ''
          description: Description of what the metric measures (required for basic type)
        prompt:
          type: string
          default: ''
          description: Custom prompt for evaluation (required for custom_prompt type)
        custom_code:
          type: string
          default: ''
          description: Python code for custom evaluation (required for custom_code type)
        enum_values:
          type: array
          items:
            type: string
          description: List of possible enum values (required when eval_type is enum)
        audio_enabled:
          type: boolean
          default: false
          description: Whether the LLM judge must evaluate the source recording
      required:
        - eval_type
        - name
        - type
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: X-CEKURA-API-KEY
      description: >-
        API Key Authentication. It should be included in the header of each
        request.
    oauth2:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth access token issued by Cekura for connected apps.
    embedded_session:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Embedded-dashboard session token. Internal.
    supabase_session:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Cekura dashboard session token. Not a customer API credential.

````

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