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

# Duplicate template

> Create a copy of an existing template with a new ID.

The duplicated template will have:
- A new auto-generated ID
- " (Copy)" appended to the template name
- All other fields copied from the original




## OpenAPI

````yaml /api-reference/v1/templates-v1.yaml post /v1/templates/{template_id}/duplicate
openapi: 3.0.3
info:
  title: Coval Templates API
  version: 1.0.0
  description: |

    Manage reusable simulation configuration templates for evaluations.
  contact:
    name: Coval API Support
    email: support@coval.dev
    url: https://docs.coval.dev
  license:
    name: Proprietary
    url: https://coval.dev/terms
servers:
  - url: https://api.coval.dev
    description: Production API
security:
  - ApiKeyAuth: []
tags:
  - name: Templates
    description: CRUD operations for simulation configuration templates
paths:
  /v1/templates/{template_id}/duplicate:
    post:
      tags:
        - Templates
      summary: Duplicate template
      description: |
        Create a copy of an existing template with a new ID.

        The duplicated template will have:
        - A new auto-generated ID
        - " (Copy)" appended to the template name
        - All other fields copied from the original
      operationId: duplicateTemplate
      parameters:
        - name: template_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[A-Za-z0-9]{22}$
          description: Template resource ID to duplicate
          example: abc123def456ghi789jklm
      responses:
        '201':
          description: Template duplicated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DuplicateTemplateResponse'
              examples:
                duplicated:
                  $ref: '#/components/examples/TemplateDuplicated'
        '400':
          description: Missing or invalid template_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Template not found or belongs to different organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFound:
                  $ref: '#/components/examples/TemplateNotFoundError'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    DuplicateTemplateResponse:
      type: object
      required:
        - template
      properties:
        template:
          $ref: '#/components/schemas/TemplateResource'
    ErrorResponse:
      type: object
      description: Standard error response
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - details
          properties:
            code:
              type: string
              description: Error code enum
              enum:
                - INVALID_ARGUMENT
                - UNAUTHENTICATED
                - NOT_FOUND
                - ALREADY_EXISTS
                - INTERNAL
              example: INVALID_ARGUMENT
            message:
              type: string
              description: Human-readable error message
              example: Invalid request parameter
            details:
              type: array
              description: Detailed error information
              items:
                type: object
                properties:
                  field:
                    type: string
                    nullable: true
                    description: Field name that caused the error
                    example: agent_id
                  description:
                    type: string
                    description: Detailed error description
                    example: Agent not found or not accessible
    TemplateResource:
      type: object
      description: >
        Template configuration resource for reusable simulation setups.


        Templates define complete simulation configurations including agent
        references,

        customer prompts, metrics, personas, and execution parameters.
      properties:
        id:
          type: string
          description: Template resource ID
          pattern: ^[A-Za-z0-9]{22}$
          example: abc123def456ghi789jklm
        name:
          type: string
          description: Resource name (templates/{id})
          pattern: ^templates/[A-Za-z0-9]{22}$
          example: templates/abc123def456ghi789jklm
        template_name:
          type: string
          description: Human-readable template name
          minLength: 1
          maxLength: 200
          example: Customer Support Voice Template
        description:
          type: string
          nullable: true
          description: Template description
          maxLength: 1000
          example: Standard voice simulation template for customer support scenarios
        simulation_type:
          $ref: '#/components/schemas/SimulationType'
        simulation_metadata:
          type: object
          description: Simulation-specific configuration (JSONB)
          additionalProperties: true
          example:
            greeting: Hello, how can I help you?
            max_duration_seconds: 300
        simulated_user_prompt:
          type: string
          nullable: true
          description: Instructions for the simulated customer behavior
          example: You are a customer calling about a delayed food delivery...
        agent_id:
          type: string
          description: Associated agent ID
          pattern: ^[A-Za-z0-9]{22}$
          example: 3zfmuDbVQsi4GaseDtiVcS
        enabled_metrics:
          type: array
          description: List of metric IDs to evaluate
          items:
            type: string
          default: []
          example:
            - metric_abc123
            - metric_def456
        persona_ids:
          type: array
          nullable: true
          description: List of persona IDs for customer simulation
          items:
            type: string
          example:
            - persona_xyz789
        test_set_id:
          type: string
          nullable: true
          description: Associated test set ID
          example: testset_abc123
        iteration_count:
          type: integer
          description: Number of simulation iterations to run
          minimum: 1
          maximum: 10000
          default: 1
          example: 10
        concurrency:
          type: integer
          description: Number of parallel simulations to run
          minimum: 1
          maximum: 100
          default: 1
          example: 5
        sub_sample_size:
          type: integer
          nullable: true
          description: Maximum number of test cases to sample from test set
          minimum: 1
          example: 50
        test_case_params_by_iteration:
          type: array
          description: Per-iteration parameter overrides (JSONB array)
          items:
            type: object
            additionalProperties: true
          default: []
          example:
            - iteration: 1
              params:
                custom_field: value1
            - iteration: 2
              params:
                custom_field: value2
        create_time:
          type: string
          format: date-time
          description: Creation timestamp (ISO 8601)
          example: '2025-10-14T12:00:00Z'
        update_time:
          type: string
          format: date-time
          nullable: true
          description: Last update timestamp (ISO 8601)
          example: '2025-10-15T14:30:00Z'
    SimulationType:
      type: string
      description: Type of simulation (matches SimulatorType enum from agents API)
      enum:
        - SIMULATOR_VOICE
        - SIMULATOR_OUTBOUND_VOICE
        - SIMULATOR_SMS
        - SIMULATOR_CHAT
        - SIMULATOR_WEBSOCKET
        - SIMULATOR_LIVEKIT
        - SIMULATOR_OPENAI_REALTIME
        - SIMULATOR_OPENAI_ENDPOINT
        - SIMULATOR_TTS
        - SIMULATOR_TRANSCRIPTION
        - SIMULATOR_VOICE_TO_VOICE
        - SIMULATOR_NOOP
      example: SIMULATOR_VOICE
  examples:
    TemplateDuplicated:
      summary: Template duplicated successfully
      value:
        template:
          id: dup123def456ghi789jklm
          name: templates/dup123def456ghi789jklm
          template_name: Customer Support Voice Template (Copy)
          description: Standard voice simulation template
          simulation_type: SIMULATOR_VOICE
          simulation_metadata:
            greeting: Hello, how can I help you?
          simulated_user_prompt: You are a customer calling about a delayed delivery...
          agent_id: 3zfmuDbVQsi4GaseDtiVcS
          enabled_metrics:
            - metric_abc123
          persona_ids:
            - persona_xyz789
          test_set_id: testset_def456
          iteration_count: 10
          concurrency: 5
          sub_sample_size: 50
          test_case_params_by_iteration:
            - iteration: 1
              params:
                custom_field: value1
          create_time: '2025-11-03T12:00:00Z'
          update_time: null
    TemplateNotFoundError:
      summary: Template not found
      value:
        error:
          code: NOT_FOUND
          message: Template not found
          details:
            - field: template_id
              description: Template not found or not accessible by your organization
  responses:
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: UNAUTHENTICATED
              message: Authentication failed
              details:
                - field: X-API-Key
                  description: Invalid or missing API key
    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
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication

````