> ## 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.

# Batch rerun metrics

> Re-score a set of metrics against a set of existing simulations without re-running the
simulations. The same metrics are applied to every simulation (metrics x simulations).
Limits: up to 100 simulations, up to 500 metrics, and at most 500 total reruns
(simulation_ids x metric_ids) per call. Best-effort per simulation: valid simulations are
queued and a per-simulation status is returned. Existing metric results are overwritten
when each rerun completes.




## OpenAPI

````yaml /api-reference/v1/simulations-v1.yaml post /simulations:rerunMetrics
openapi: 3.0.3
info:
  title: Coval Simulations API
  version: 1.0.0
  description: |

    Launch and manage voice simulations for AI agent testing.
  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: Simulations
    description: Launch and manage individual simulation executions
  - name: Metric Outputs
    description: Retrieve metric computation results for simulations
paths:
  /simulations:rerunMetrics:
    post:
      tags:
        - Simulations
      summary: Batch rerun metrics
      description: >
        Re-score a set of metrics against a set of existing simulations without
        re-running the

        simulations. The same metrics are applied to every simulation (metrics x
        simulations).

        Limits: up to 100 simulations, up to 500 metrics, and at most 500 total
        reruns

        (simulation_ids x metric_ids) per call. Best-effort per simulation:
        valid simulations are

        queued and a per-simulation status is returned. Existing metric results
        are overwritten

        when each rerun completes.
      operationId: rerunMetrics
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerunMetricsRequest'
      responses:
        '202':
          description: All simulations were queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RerunMetricsResponse'
        '207':
          description: Some simulations could not be queued; see per-simulation statuses
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RerunMetricsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    RerunMetricsRequest:
      type: object
      required:
        - simulation_ids
        - metric_ids
      properties:
        simulation_ids:
          type: array
          description: >-
            Simulation IDs (22-character ShortUUIDs) to re-score. Up to 100 per
            call.
          minItems: 1
          maxItems: 100
          items:
            type: string
            minLength: 22
            maxLength: 22
          example:
            - 4bgnvEcWRtj5HbtfEujWdT
        metric_ids:
          type: array
          description: >-
            Metric IDs (22-character ShortUUIDs) to run against every
            simulation. Up to 500 per call.
          minItems: 1
          maxItems: 500
          items:
            type: string
            minLength: 22
            maxLength: 22
          example:
            - 29BlkepvvX19ebbLDB0y6Q
        dev_id:
          type: string
          description: >-
            Optional developer routing id; only applied when the endpoint runs
            in the dev environment (ignored in production).
          example: loren
    RerunMetricsResponse:
      type: object
      required:
        - results
        - queued_count
        - failed_count
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/RerunMetricsResultItem'
          description: One entry per requested simulation, in request order.
        queued_count:
          type: integer
          description: Number of simulations successfully queued.
          example: 2
        failed_count:
          type: integer
          description: Number of simulations that could not be queued.
          example: 0
    RerunMetricsResultItem:
      type: object
      required:
        - simulation_id
        - status
      properties:
        simulation_id:
          type: string
          example: 4bgnvEcWRtj5HbtfEujWdT
        status:
          type: string
          enum:
            - QUEUED
            - NOT_FOUND
            - ENQUEUE_FAILED
          description: Per-simulation outcome of the rerun request.
        error:
          type: string
          nullable: true
          description: >-
            Human-readable reason the simulation was not queued (null when
            QUEUED).
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorInfo'
    ErrorInfo:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - INVALID_ARGUMENT
            - UNAUTHENTICATED
            - PERMISSION_DENIED
            - NOT_FOUND
            - FAILED_PRECONDITION
            - INTERNAL
          description: Machine-readable error code
          example: INVALID_ARGUMENT
        message:
          type: string
          description: Human-readable error message
          example: Request validation failed
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
          description: Detailed information about specific error fields
    ErrorDetail:
      type: object
      required:
        - description
      properties:
        field:
          type: string
          description: The field that caused the error (if applicable)
          example: agent_id
        description:
          type: string
          description: Human-readable description of the error
          example: Agent not found or not accessible by your organization
  responses:
    BadRequest:
      description: Request validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: INVALID_ARGUMENT
              message: Request validation failed
              details:
                - field: iteration_count
                  description: Value must be between 1 and 10
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: UNAUTHENTICATED
              message: Missing API Key
              details:
                - field: X-API-Key
                  description: X-API-Key header is required
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: NOT_FOUND
              message: Agent not found
              details:
                - field: agent_id
                  description: Agent 'gk3jK9mPq2xRt5vW8yZaBc' does not exist
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: INTERNAL
              message: Internal server error
              details:
                - description: An unexpected error occurred. Please contact support.
    ServiceUnavailable:
      description: Service temporarily unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: INTERNAL
              message: Service temporarily unavailable
              details:
                - description: Database routing is temporarily unavailable. Please retry.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: |
        API key for authentication.

````