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

# Copy Template To Project

> Copy an existing template into a target project as a new template.

Parameters
----------
template_id : str
    The ID of the source template to copy.
body : CopyOptimizationTemplateRequest
    The target project ID.

Returns
-------
OptimizationTemplate
    The newly created copy in the target project.

Raises
------
NotFoundError
    If no template with the given ID exists.
ConflictError
    If a template with the same name already exists in the target project.



## OpenAPI

````yaml https://api.ionworks.com/openapi.json post /optimization_templates/{template_id}/copy
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /optimization_templates/{template_id}/copy:
    post:
      tags:
        - optimization_templates
      summary: Copy Template To Project
      description: |-
        Copy an existing template into a target project as a new template.

        Parameters
        ----------
        template_id : str
            The ID of the source template to copy.
        body : CopyOptimizationTemplateRequest
            The target project ID.

        Returns
        -------
        OptimizationTemplate
            The newly created copy in the target project.

        Raises
        ------
        NotFoundError
            If no template with the given ID exists.
        ConflictError
            If a template with the same name already exists in the target project.
      operationId: copy_template_to_project_optimization_templates__template_id__copy_post
      parameters:
        - name: template_id
          in: path
          required: true
          schema:
            type: string
            title: Template Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CopyOptimizationTemplateRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptimizationTemplate'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CopyOptimizationTemplateRequest:
      properties:
        project_id:
          type: string
          title: Project Id
      type: object
      required:
        - project_id
      title: CopyOptimizationTemplateRequest
      description: Request body for copying a template to another project.
    OptimizationTemplate:
      properties:
        name:
          type: string
          title: Name
          description: The name of the optimization template.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: An optional description for the template.
        initial_form_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Initial Form Data
          description: Initial form data values.
        id:
          type: string
          title: Id
          description: The unique identifier for the template.
        organization_id:
          type: string
          title: Organization Id
          description: The ID of the organization this template belongs to.
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
          description: The ID of the owner project (None for system templates).
        access_level:
          type: string
          title: Access Level
          description: 'Template scope: ''system'' for built-in, ''project'' for user-created.'
          default: project
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Timestamp of when the template was created.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Timestamp of when the template was last updated.
      type: object
      required:
        - name
        - id
        - organization_id
        - created_at
        - updated_at
      title: OptimizationTemplate
      description: Model representing an optimization template as returned by the API.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````