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

# Duplicate a saved template

> Create an agent from a saved template ID.

Requires Editor, Admin, or Owner. Send a numeric `template_id` from [List saved templates](https://docs.agents.labs.bandwidth.com/api-reference/agents/templates.md) and a `workflow_name` for the copy. Trigger identifiers are regenerated.

The response contains the created agent and its definition. A missing template returns `404`; a conflicting trigger path returns `409`. Each successful request creates a new agent, so check the first response before retrying.


## OpenAPI

````yaml POST /api/v1/workflow/templates/duplicate
openapi: 3.1.0
info:
  title: Bandwidth Agent Builder API
  version: v1
  description: >-
    Manage agents, place calls, and retrieve conversation results in your
    workspace.
servers:
  - url: https://agents.labs.bandwidth.com
    description: Workspace API
security: []
paths:
  /api/v1/workflow/templates/duplicate:
    post:
      tags:
        - agents
      summary: Duplicate a saved template
      description: >-
        **Authorization:** Requires an Editor, Admin, or Owner role in the
        requested workspace.


        Create an agent from a saved template ID.
      operationId: duplicate_workflow_template_api_v1_workflow_templates_duplicate_post
      parameters:
        - description: >-
            Required with X-BW-LABS-AGENTS-API-KEY: the positive local workspace
            ID to access. The key owner must be a current member. Missing or
            invalid IDs return 400; non-member workspaces return 403. Not
            required for bearer authentication, which uses the user's selected
            workspace.
          in: header
          name: X-VOAI-ORGANIZATION-ID
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Required with X-BW-LABS-AGENTS-API-KEY: the positive local
              workspace ID to access. The key owner must be a current member.
              Missing or invalid IDs return 400; non-member workspaces return
              403. Not required for bearer authentication, which uses the user's
              selected workspace.
            title: X-Voai-Organization-Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DuplicateTemplateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResponse'
          description: Successful Response
        '400':
          description: Invalid request or missing/invalid workspace header with an API key.
        '401':
          description: Missing, invalid, or expired credential.
        '403':
          description: >-
            The account lacks access to the workspace, resource, or required
            role.
        '404':
          description: Not found
        '409':
          description: A trigger path conflicts with another agent.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - LabsAuth: []
        - LabsApiKey: []
components:
  schemas:
    DuplicateTemplateRequest:
      properties:
        template_id:
          title: Template Id
          type: integer
        workflow_name:
          title: Workflow Name
          type: string
      required:
        - template_id
        - workflow_name
      title: DuplicateTemplateRequest
      type: object
    WorkflowResponse:
      properties:
        call_disposition_codes:
          anyOf:
            - $ref: '#/components/schemas/CallDispositionCodes'
            - type: 'null'
        created_at:
          format: date-time
          title: Created At
          type: string
        current_definition_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Current Definition Id
          description: Current definition record ID; distinct from version_number.
        id:
          title: Id
          type: integer
        name:
          title: Name
          type: string
        status:
          title: Status
          type: string
        template_context_variables:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Template Context Variables
        total_runs:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Runs
        version_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version Number
          description: >-
            Human-readable sequence number. Use the version record ID for
            rollback.
        version_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Version Status
        workflow_configurations:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Workflow Configurations
        workflow_definition:
          additionalProperties: true
          title: Workflow Definition
          type: object
          description: Node and edge graph for this version.
        workflow_uuid:
          anyOf:
            - type: string
            - type: 'null'
          title: Workflow Uuid
      required:
        - id
        - name
        - status
        - created_at
        - workflow_definition
        - current_definition_id
      title: WorkflowResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    CallDispositionCodes:
      properties:
        disposition_codes:
          default: []
          items:
            type: string
          title: Disposition Codes
          type: array
      title: CallDispositionCodes
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    LabsAuth:
      description: >-
        Bandwidth Labs OAuth access token. Uses the user's selected workspace;
        the workspace header is not required. Do not also send an API key.
        Bearer-only operations may additionally require the Labs `super_user`
        role.
      scheme: bearer
      type: http
    LabsApiKey:
      description: >-
        Bandwidth Labs API key. Also send `X-VOAI-ORGANIZATION-ID` with a
        positive local workspace ID belonging to the key owner. Access follows
        the owner's current workspace role. Do not also send a bearer token. API
        keys cannot access bearer-only or Labs `super_user` operations.
      in: header
      name: X-BW-LABS-AGENTS-API-KEY
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.