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

# Rerun a simulation

> Requeue a single existing simulation to run again in place.
The currently visible result for this simulation will be overwritten when the rerun completes.




## OpenAPI

````yaml /api-reference/v1/simulations-v1.yaml post /simulations/{simulation_id}/resimulate
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/{simulation_id}/resimulate:
    post:
      tags:
        - Simulations
      summary: Rerun a simulation
      description: >
        Requeue a single existing simulation to run again in place.

        The currently visible result for this simulation will be overwritten
        when the rerun completes.
      operationId: resimulateSimulation
      parameters:
        - name: simulation_id
          in: path
          required: true
          schema:
            type: string
            minLength: 22
            maxLength: 27
          description: The simulation ID to rerun
          example: 4bgnvEcWRtj5HbtfEujWdT
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResimulateSimulationRequest'
      responses:
        '200':
          description: Simulation rerun was accepted and queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResimulateSimulationResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '412':
          $ref: '#/components/responses/FailedPrecondition'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ResimulateSimulationRequest:
      type: object
      description: >-
        Request body for resimulating a simulation. Currently no user-facing
        fields; the body may be empty or omitted.
    ResimulateSimulationResponse:
      type: object
      required:
        - simulation_id
        - run_id
        - queued
        - message
      properties:
        simulation_id:
          type: string
          description: The simulation that was queued for rerun
          example: 4bgnvEcWRtj5HbtfEujWdT
        run_id:
          type: string
          description: The parent run that owns the simulation
          example: 3zfmuDbVQsi4GaseDtiVcS
        queued:
          type: boolean
          description: Whether the resimulation job was queued successfully
          example: true
        message:
          type: string
          description: Human-readable summary of rerun behavior
          example: >-
            Simulation rerun queued. The latest database-backed versions of the
            agent, persona, test set, test case, metrics, and mutation config
            will be reloaded before execution, and the current simulation result
            will be overwritten.
    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:
    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
    FailedPrecondition:
      description: Request is valid but the simulation cannot currently be rerun
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: FAILED_PRECONDITION
              message: Simulation cannot be rerun
              details:
                - field: simulation_id
                  description: >-
                    Simulation '4bgnvEcWRtj5HbtfEujWdT' is currently active with
                    status 'IN PROGRESS' and cannot be rerun
    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.

````