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

# Trigger test metric execution

> Trigger execution of a metric against a simulation output for testing purposes.
This is an asynchronous operation that returns immediately with a metric output ULID.

**Retrieving the result:** poll
`GET /v1/simulations/{simulation_id}/metrics/{metric_output_id}` using the
`simulation_output_id` you passed here as `simulation_id` and the returned
26-char `metric_output_ulid`. The response includes a `status` field
(`IN QUEUE`, `IN PROGRESS`, `COMPLETED`, `FAILED`) — poll until it is
terminal. Test results belong to the simulation they ran against, so they
are not available on the conversations endpoint.




## OpenAPI

````yaml /api-reference/v1/metrics-v1.yaml post /metrics/{metric_id}/test
openapi: 3.0.3
info:
  title: Coval Metrics API
  version: 1.0.0
  description: |
    Manage custom evaluation metrics for agent testing and monitoring.
  contact:
    name: Coval API Support
    email: support@coval.dev
    url: https://docs.coval.ai
  license:
    name: Proprietary
    url: https://coval.dev/terms
servers:
  - url: https://api.coval.dev/v1
    description: Production API
security:
  - ApiKeyAuth: []
tags:
  - name: Metrics
    description: CRUD operations for custom evaluation metrics
paths:
  /metrics/{metric_id}/test:
    post:
      tags:
        - Metrics
      summary: Trigger test metric execution
      description: >
        Trigger execution of a metric against a simulation output for testing
        purposes.

        This is an asynchronous operation that returns immediately with a metric
        output ULID.


        **Retrieving the result:** poll

        `GET /v1/simulations/{simulation_id}/metrics/{metric_output_id}` using
        the

        `simulation_output_id` you passed here as `simulation_id` and the
        returned

        26-char `metric_output_ulid`. The response includes a `status` field

        (`IN QUEUE`, `IN PROGRESS`, `COMPLETED`, `FAILED`) — poll until it is

        terminal. Test results belong to the simulation they ran against, so
        they

        are not available on the conversations endpoint.
      operationId: testMetric
      parameters:
        - name: metric_id
          in: path
          required: true
          description: The metric ID (22-character ShortUUID)
          schema:
            type: string
            pattern: ^[a-zA-Z0-9]{22}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestMetricRequest'
      responses:
        '202':
          description: Test metric execution queued successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestMetricResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Metric or simulation output not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Organization routing unavailable or not ready
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    TestMetricRequest:
      type: object
      required:
        - simulation_output_id
      properties:
        simulation_output_id:
          type: string
          description: >-
            The simulation output ID (22-character ShortUUID) to run the metric
            against
          pattern: ^[a-zA-Z0-9]{22}$
        dev_id:
          type: string
          description: Optional developer identifier for debugging
      additionalProperties: false
    TestMetricResponse:
      type: object
      properties:
        metric_output_ulid:
          type: string
          description: The ULID of the created metric output, used to track result
          minLength: 26
          maxLength: 26
          pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
      additionalProperties: false
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - INVALID_ARGUMENT
                - UNAUTHENTICATED
                - PERMISSION_DENIED
                - NOT_FOUND
                - ALREADY_EXISTS
                - INTERNAL
            message:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                    nullable: true
                  description:
                    type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication

````