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

# Duplicate agent into another project

> Create a new draft agent in a target project by copying operational configuration from an existing agent or version.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/agent/{agent_id}/duplicate
openapi: 3.1.0
info:
  title: Diga API
  version: 0.1.0
servers:
  - url: https://api.diga.io
    description: Production
security: []
paths:
  /v1/agent/{agent_id}/duplicate:
    post:
      tags:
        - Agents
      summary: Duplicate agent into another project
      description: >-
        Create a new draft agent in a target project by copying operational
        configuration from an existing agent or version.
      operationId: duplicate_agent_v1_agent__agent_id__duplicate_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DuplicateAgentRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponseSchema'
        '400':
          description: Bad request - Invalid duplicate configuration
          content:
            application/json:
              example:
                status: error
                error_code: BAD_PARAMETER
                message: Agent cannot be duplicated with the requested options
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
        '403':
          description: Forbidden - Insufficient target permissions
          content:
            application/json:
              example:
                status: error
                error_code: MISSING_PERMISSIONS
                message: Missing required permissions in the target project
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
        '404':
          description: Agent Not Found
          content:
            application/json:
              example:
                status: error
                error_code: AGENT_NOT_FOUND
                message: Agent 550e8400-e29b-41d4-a716-446655440000 not found
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              example:
                status: error
                error_code: INTERNAL_SERVER_ERROR
                message: 'Error: Internal Server Error'
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
        '503':
          description: Workflow Service Unavailable
          content:
            application/json:
              example:
                status: error
                error_code: WORKFLOW_SERVICE_UNAVAILABLE
                message: 'Error: Workflow Service Unavailable'
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
      security:
        - CustomHTTPBearer: []
components:
  schemas:
    DuplicateAgentRequest:
      properties:
        target_project_id:
          type: string
          format: uuid
          title: Target Project ID
          description: Project where the duplicated agent draft will be created
        source_version_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Source Version ID
          description: Specific source version to duplicate. Defaults to the current draft.
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
          description: >-
            Optional name for the duplicated agent. Defaults to "{original}
            (copy)".
      type: object
      required:
        - target_project_id
      title: DuplicateAgentRequest
    AgentResponseSchema:
      properties:
        agent_id:
          type: string
          format: uuid
          title: Agent Id
          description: The unique identifier for the agent
        modified_at:
          type: string
          format: date-time
          title: Last Update
          description: The date and time when the agent was last updated
        created_at:
          type: string
          format: date-time
          title: Creation Date
          description: The date and time when the agent was created
        version_id:
          type: string
          format: uuid
          title: Version Id
          description: The version id of the agent
        version_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Version Name
          description: The version name of the agent
        version_number:
          type: integer
          title: Version Number
          description: The version number of the agent
        version_created_at:
          type: string
          format: date-time
          title: Version Creation Date
          description: The date and time when the version was created
        is_draft:
          type: boolean
          title: Is Draft
          description: Indicates if the agent is a draft version
          default: false
        is_published:
          type: boolean
          title: Is Published
          description: Indicates if the agent is published
          default: false
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
          description: The name of the agent
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: The description given to the agent
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: The prompt given to the agent
        greeting:
          anyOf:
            - type: string
            - type: 'null'
          title: Greeting
          description: >-
            The greeting message said by the agent to the caller at the
            beginning of the call. If set, the agent will always speak first
            both in inbound and outbound calls
        time_before_start:
          anyOf:
            - type: number
            - type: 'null'
          title: Time Before Start
          description: The time in seconds before the agent starts to speak
        voice:
          $ref: '#/components/schemas/VoiceResponseSchema'
          title: Voice
          description: The voice object used by the agent
        volume:
          type: integer
          maximum: 100
          minimum: 0
          title: Volume
          description: >-
            Controls the output volume of the agent's voice. 50 is the default
            (no change), 0 is silent, 100 is maximum gain.
          default: 50
        language:
          $ref: '#/components/schemas/AvailableLanguages'
          title: Language
          description: >-
            The language used by the agent. Use `multi` for the agent using both
            english and spanish in the same call (multi will expand to more
            languages in the future)
        max_reminder_count:
          type: integer
          minimum: 0
          title: Max Reminder Count
          description: >-
            The maximum number of reminders that can be sent to the caller. If
            not provided, the default value is 3. Set this value to 0 to disable
            reminders
          default: 3
        reminder_frequency_ms:
          type: integer
          title: Reminder Frequency
          description: >-
            The frequency in milliseconds to send reminders to the caller. If
            not provided, the default value is 7500.
          default: 7500
        reminder_messages:
          items:
            type: string
          type: array
          title: Reminder Messages
          description: >-
            The list of messages to send to the caller as reminders. If not
            provided, the default value is an empty list which makes the model
            to generate the reminder messages by itself. Please, note that when
            using an empty list, the `reminder_frequency_ms` can be a little bit
            higher than specified since it has to generate the messages
          default: []
        knowledge_base_ids:
          anyOf:
            - items:
                type: string
                format: uuid
              type: array
            - type: 'null'
          title: Knowledge Bases
          description: The list of knowledge bases available for the agent to use
          default: []
        knowledge_item_ids:
          anyOf:
            - items:
                type: string
                format: uuid
              type: array
            - type: 'null'
          title: Knowledge Items
          description: The list of knowledge items directly available for the agent to use
          default: []
        mode:
          $ref: '#/components/schemas/AgentMode'
          title: Agent Mode
          description: The mode of the agent. Can be 'free' or 'path'
        conversational_path_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Conversational Path Id
          description: 'The id of the conversational path used by the agent. '
        integrations:
          items:
            $ref: '#/components/schemas/IntegrationToolsResponse'
          type: array
          title: Integrations
          description: The list of integrations and their assigned tools for the agent
          default: []
        call_tools:
          items:
            oneOf:
              - $ref: '#/components/schemas/TransferCallToolSchema'
              - $ref: '#/components/schemas/HangUpToolSchema'
              - $ref: '#/components/schemas/DetectAnsweringMachineToolSchema'
            discriminator:
              propertyName: type
              mapping:
                detect_answering_machine:
                  $ref: '#/components/schemas/DetectAnsweringMachineToolSchema'
                hang_up:
                  $ref: '#/components/schemas/HangUpToolSchema'
                transfer_call:
                  $ref: '#/components/schemas/TransferCallToolSchema'
          type: array
          title: Call Tools
          description: The list of call-tools (built-in tools) assigned to the agent
          default: []
        dynamic_variables:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Dynamic Variables
          description: >-
            Agent-level dynamic variables for template interpolation. Overridden
            by call-level variables.
          default: {}
        background_audio:
          anyOf:
            - $ref: '#/components/schemas/BackgroundAudio'
            - type: 'null'
          title: Background Audio
          description: The background audio to be used in the calls that this agent handles
        flows:
          items:
            $ref: '#/components/schemas/FlowInfoResponse'
          type: array
          title: Flows
          description: Detailed flow info assigned to the agent
          default: []
        source_template_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Source Template ID
          description: The ID of the agent template this agent was created from
        validation_issues:
          anyOf:
            - items:
                $ref: '#/components/schemas/ValidationIssueSchema'
              type: array
            - type: 'null'
          title: Validation Issues
          description: >-
            List of issues that would prevent launching/publishing. Only present
            for draft versions on dashboard endpoints.
      type: object
      required:
        - agent_id
        - modified_at
        - created_at
        - version_id
        - version_number
        - version_created_at
        - voice
        - language
        - mode
      title: AgentResponseSchema
    ErrorResponseSchema:
      properties:
        status:
          type: string
          title: Status
          description: Status of the response, always 'error' for error responses
          default: error
        error_code:
          type: string
          title: Error Code
          description: Machine-readable error code in SCREAMING_SNAKE_CASE format
          examples:
            - PROJECT_NOT_FOUND
            - INVALID_EMAIL
            - UNAUTHORIZED_ROLE
        message:
          type: string
          title: Message
          description: Human-readable error message with details
          examples:
            - Project with id 550e8400-e29b-41d4-a716-446655440000 not found
            - The email invalid@email is not valid
            - Insufficient permissions to perform this action
      type: object
      required:
        - error_code
        - message
      title: ErrorResponseSchema
      description: Standard error response format for all API errors.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    VoiceResponseSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Voice Id
          description: The unique identifier for the voice in Diga
        name:
          type: string
          title: Voice Name
          description: The name of the voice
        provider:
          $ref: '#/components/schemas/VoiceProvider'
          title: Provider
          description: The voice provider
        provider_voice_id:
          type: string
          title: Provider Voice Id
          description: The voice ID in the provider's system
        preview_urls:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Preview URLs
          description: >-
            Per-locale preview audio URLs, keyed by language code (e.g. {'en':
            '<url>', 'es': '<url>'}). NULL if no previews exist.
        gender:
          anyOf:
            - type: string
            - type: 'null'
          title: Gender
          description: The gender of the voice
        is_favourite:
          type: boolean
          title: Is Favourite
          description: Whether the voice is a favourite for the current company
      type: object
      required:
        - id
        - name
        - provider
        - provider_voice_id
        - is_favourite
      title: VoiceResponseSchema
    AvailableLanguages:
      type: string
      enum:
        - es
        - en
        - multi
        - ar
        - be
        - bn
        - bs
        - bg
        - ca
        - hr
        - cs
        - da
        - nl
        - et
        - fi
        - nl-BE
        - fr
        - de
        - de-CH
        - el
        - he
        - hi
        - hu
        - id
        - it
        - ja
        - kn
        - ko
        - lv
        - lt
        - mk
        - ms
        - mr
        - 'no'
        - fa
        - pl
        - pt
        - ro
        - ru
        - sr
        - sk
        - sl
        - sv
        - tl
        - ta
        - te
        - tr
        - uk
        - ur
        - vi
      title: AvailableLanguages
    AgentMode:
      type: string
      enum:
        - free
        - path
      title: AgentMode
      description: Enum for Agent Modes.
    IntegrationToolsResponse:
      properties:
        integration_id:
          type: string
          format: uuid
          title: Integration Id
          description: The unique identifier for the integration
        integration_name:
          type: string
          title: Integration Name
          description: The name of the integration
        tool_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Tool Ids
          description: The list of tool IDs assigned from this integration
        requires_setup:
          type: boolean
          title: Requires Setup
          description: True if this integration requires setup before it can be used
          default: false
        source_integration_template_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Source Integration Template Id
          description: The integration template ID this integration was created from
      type: object
      required:
        - integration_id
        - integration_name
        - tool_ids
      title: IntegrationToolsResponse
      description: Response schema for integration and its assigned tools.
    TransferCallToolSchema:
      properties:
        type:
          type: string
          const: transfer_call
          title: Call Tool Type
          description: Must be 'transfer_call' for this variant.
          default: transfer_call
        name:
          type: string
          title: Call Tool name
          description: >-
            Unique identifier for this call-tool. ASCII slug-style is preferred
            (e.g. 'transfer_to_owner'). Accents and spaces are auto-normalized:
            'Transferir a dueño' becomes 'Transferir_a_dueno'.
        target_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Number
          description: >-
            Phone number to transfer to (E.164, may include extension via
            '#1234'). Accepted under either 'target_number' or 'phone_number'.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: >-
            When/why to use this transfer. The agent reads this to decide when
            to invoke the tool.
        transfer_type:
          type: string
          enum:
            - transfer
            - invite
          title: Transfer Type
          description: '''transfer'' for SIP-transfer, ''invite'' for SIP-invite.'
          default: transfer
      additionalProperties: false
      type: object
      required:
        - name
      title: TransferCallToolSchema
      description: |-
        Transfer a call to another number.

        Wire shape (FLAT, all fields top-level):

            {
              "type": "transfer_call",
              "name": "transfer_to_owner",
              "target_number": "+34600112233",
              "description": "Transfer when the caller asks to speak with the owner",
              "transfer_type": "transfer"
            }
    HangUpToolSchema:
      properties:
        type:
          type: string
          const: hang_up
          title: Call Tool Type
          description: Must be 'hang_up' for this variant.
          default: hang_up
        name:
          type: string
          title: Call Tool name
          description: >-
            Unique identifier for this call-tool. ASCII slug-style is preferred
            (e.g. 'transfer_to_owner'). Accents and spaces are auto-normalized:
            'Transferir a dueño' becomes 'Transferir_a_dueno'.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: >-
            When/why to hang up. The agent reads this to decide when to invoke
            the tool.
      additionalProperties: false
      type: object
      required:
        - name
      title: HangUpToolSchema
      description: |-
        Hang up the call.

        Wire shape (FLAT):

            {"type": "hang_up", "name": "end_call", "description": "Hang up when the user is done"}
    DetectAnsweringMachineToolSchema:
      properties:
        type:
          type: string
          const: detect_answering_machine
          title: Call Tool Type
          description: Must be 'detect_answering_machine' for this variant.
          default: detect_answering_machine
        name:
          type: string
          title: Call Tool name
          description: >-
            Unique identifier for this call-tool. ASCII slug-style is preferred
            (e.g. 'transfer_to_owner'). Accents and spaces are auto-normalized:
            'Transferir a dueño' becomes 'Transferir_a_dueno'.
      additionalProperties: false
      type: object
      required:
        - name
      title: DetectAnsweringMachineToolSchema
      description: |-
        Detect whether the call landed on an answering machine.

        Wire shape (FLAT):

            {"type": "detect_answering_machine", "name": "amd"}
    BackgroundAudio:
      type: string
      enum:
        - call_center
        - cafe
        - road_traffic
        - park
        - office
        - car_garage
      title: BackgroundAudio
    FlowInfoResponse:
      properties:
        id:
          type: string
          title: Id
          description: Flow ID
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Flow name
        requires_setup:
          type: boolean
          title: Requires Setup
          description: True if this flow requires setup before it can be used
          default: false
        source_flow_template_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Source Flow Template Id
          description: The flow template ID this flow was created from
        status:
          anyOf:
            - $ref: '#/components/schemas/FlowStatus'
            - type: 'null'
          description: ENABLED, DISABLED, or null for placeholders
        produced_variables:
          items:
            type: string
          type: array
          title: Produced Variables
          description: Dynamic-variable names this flow produces (pre_call)
        consumed_variables:
          items:
            type: string
          type: array
          title: Consumed Variables
          description: Dynamic-variable names this flow consumes (function_call)
      type: object
      required:
        - id
      title: FlowInfoResponse
      description: Info about a flow assigned to an agent version.
    ValidationIssueSchema:
      properties:
        message_code:
          type: string
          title: Message Code
          description: >-
            Machine-readable code for i18n lookup, e.g.
            'tool_node_no_tool_assigned'
        message:
          type: string
          title: Message
          description: Human-readable English description of the issue
        params:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Params
          description: >-
            Structured data for translation interpolation and resource
            identification
      type: object
      required:
        - message_code
        - message
      title: ValidationIssueSchema
      description: A single validation issue that would prevent launching/publishing.
    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
    VoiceProvider:
      type: string
      enum:
        - elevenlabs
        - gemini
      title: VoiceProvider
    FlowStatus:
      type: string
      enum:
        - ENABLED
        - DISABLED
      title: FlowStatus
  securitySchemes:
    CustomHTTPBearer:
      type: http
      scheme: bearer

````