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

# Copy Template

> Copy a workflow template to the user's project.

This creates a new flow in the user's project with the template content.
The flow will be created in a disabled state for the user to configure.

Args:
    template_id: ID of the template to copy
    request: Optional request body with custom flow name
    auth_context: Authentication context
    session: Database session

Returns:
    CopyTemplateResponse with flow_id, flow_name, and edit_url



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workflow/templates/{template_id}/copy
openapi: 3.1.0
info:
  title: Diga API
  version: 0.1.0
servers:
  - url: https://api.diga.io
    description: Production
security: []
paths:
  /v1/workflow/templates/{template_id}/copy:
    post:
      tags:
        - Workflows
      summary: Copy Template
      description: |-
        Copy a workflow template to the user's project.

        This creates a new flow in the user's project with the template content.
        The flow will be created in a disabled state for the user to configure.

        Args:
            template_id: ID of the template to copy
            request: Optional request body with custom flow name
            auth_context: Authentication context
            session: Database session

        Returns:
            CopyTemplateResponse with flow_id, flow_name, and edit_url
      operationId: copy_template_v1_workflow_templates__template_id__copy_post
      parameters:
        - name: template_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Template Id
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/CopyTemplateRequest'
                - type: 'null'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CopyTemplateResponse'
        '400':
          description: Invalid template
        '404':
          description: Template not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: Workflow service unavailable
      security:
        - CustomHTTPBearer: []
components:
  schemas:
    CopyTemplateRequest:
      properties:
        flow_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Flow Name
          description: Custom name for the created flow. Defaults to template name.
        variables:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Variables
          description: >-
            Values to replace <<variable>> placeholders. Supports string,
            number, boolean.
        connections:
          anyOf:
            - items:
                $ref: '#/components/schemas/ConnectionCredential'
              type: array
            - type: 'null'
          title: Connections
          description: Credentials for connections required by the template.
      type: object
      title: CopyTemplateRequest
      description: Request to copy a template to the user's project.
    CopyTemplateResponse:
      properties:
        flow_id:
          type: string
          title: Flow Id
          description: Flow ID
        flow_name:
          type: string
          title: Flow Name
          description: Name of the created flow
        edit_url:
          type: string
          title: Edit Url
          description: URL to edit the flow
      type: object
      required:
        - flow_id
        - flow_name
        - edit_url
      title: CopyTemplateResponse
      description: Response after copying a template.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ConnectionCredential:
      properties:
        key:
          type: string
          title: Key
          description: Connection key from template
        value:
          type: string
          title: Value
          description: Secret value (API key, token, etc.)
      type: object
      required:
        - key
        - value
      title: ConnectionCredential
      description: Credentials for a single connection.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    CustomHTTPBearer:
      type: http
      scheme: bearer

````