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

# Duplicate

> Create a copy of a taxonomy owned by the caller.

The copy gets a fresh `taxonomy_id`, regenerated graph node/edge ids, the
caller as owner, and reset run history/stats. `kind`, description, tag
membership, sharing/permissions and project associations are inherited from
the source.

## Request Body

| Field                | Type  | Description                          |
|----------------------|-------|--------------------------------------|
| `source_taxonomy_id` | `str` | Taxonomy being copied (keyed by id). |
| `new_taxonomy_name`  | `str` | Name for the copy.                   |

## Response

- **200**: Returns the new `DeasyTaxonomy`.
- **400**: Empty `new_taxonomy_name`.
- **403**: Caller is not the owner of the source.
- **404**: Source taxonomy not found or not accessible.
- **409**: `new_taxonomy_name` collides with an existing taxonomy.



## OpenAPI

````yaml /deasy-openapi.yml post /taxonomy/duplicate
openapi: 3.1.0
info:
  title: Collibra Unstructured API
  description: >
    REST API for Collibra Unstructured.


    ## Authentication


    Every endpoint accepts either HTTP Basic credentials, or a bearer token sent
    together with the

    `X-User-ID` header identifying the user the call runs as.


    ## Base URL


    Your Unstructured deployment, for example
    `https://unstructured.your-company.com/rest/unstructured`.
  version: 0.1.14
servers:
  - url: /rest/unstructured
security:
  - BasicAuth: []
  - BearerAuth: []
    UserIdAuth: []
tags:
  - name: Core
    description: Endpoints for core functionality
  - name: Data
    description: Endpoints for source data
  - name: Metadata
    description: Endpoints for metadata management
  - name: Tags
    description: Endpoints for tag management
  - name: Taxonomy
    description: Endpoints for taxonomy management
  - name: Dataslice
    description: Endpoints for dataslice management
  - name: Progress Tracker
    description: Endpoints for tracking progress
  - name: Classification
    description: Endpoints for classification
  - name: Ingestion
    description: Endpoints for document ingestion
  - name: Workflows
    description: Endpoints for workflow management
  - name: Projects
    description: Endpoints for project management
  - name: Versioning
    description: Endpoints for metadata versioning
  - name: Deduplication
    description: Endpoints for deduplication
paths:
  /taxonomy/duplicate:
    post:
      tags:
        - Taxonomies
      summary: Duplicate
      description: >-
        Create a copy of a taxonomy owned by the caller.


        The copy gets a fresh `taxonomy_id`, regenerated graph node/edge ids,
        the

        caller as owner, and reset run history/stats. `kind`, description, tag

        membership, sharing/permissions and project associations are inherited
        from

        the source.


        ## Request Body


        | Field                | Type  | Description                          |

        |----------------------|-------|--------------------------------------|

        | `source_taxonomy_id` | `str` | Taxonomy being copied (keyed by id). |

        | `new_taxonomy_name`  | `str` | Name for the copy.                   |


        ## Response


        - **200**: Returns the new `DeasyTaxonomy`.

        - **400**: Empty `new_taxonomy_name`.

        - **403**: Caller is not the owner of the source.

        - **404**: Source taxonomy not found or not accessible.

        - **409**: `new_taxonomy_name` collides with an existing taxonomy.
      operationId: duplicate_taxonomy_route_taxonomy_duplicate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DuplicateTaxonomyRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeasyTaxonomy'
        '403':
          description: Missing token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '500':
          description: >-
            Internal Server Error. An unexpected error occurred while processing
            the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
      x-codeSamples:
        - lang: Python
          source: |
            # pip install deasy-sdk
            import os
            from deasy import DeasyClient

            client = DeasyClient(
                base_url=os.environ["UNSTRUCTURED_CLIENT_BASE_URL"],
                username=os.environ["UNSTRUCTURED_USERNAME"],
                password=os.environ["UNSTRUCTURED_PASSWORD"],
                auth_method="basic",
            )

            response = client.taxonomy.duplicate(
                new_taxonomy_name="example_new_taxonomy_name",
                source_taxonomy_id="example_source_taxonomy_id",
            )
            print(response.taxonomy_id)
components:
  schemas:
    DuplicateTaxonomyRequest:
      properties:
        source_taxonomy_id:
          type: string
          title: Source Taxonomy Id
        new_taxonomy_name:
          type: string
          title: New Taxonomy Name
      type: object
      required:
        - source_taxonomy_id
        - new_taxonomy_name
      title: DuplicateTaxonomyRequest
    DeasyTaxonomy:
      properties:
        taxonomy_id:
          type: string
          title: Taxonomy Id
        taxonomy_name:
          type: string
          title: Taxonomy Name
        taxonomy_description:
          type: string
          title: Taxonomy Description
        taxonomy_data:
          $ref: '#/components/schemas/TaxonomyGraph'
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
        refreshed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Refreshed At
        kind:
          anyOf:
            - type: string
            - type: 'null'
          title: Kind
        retention_schedule_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Retention Schedule Version
        schedule_up_to_date:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Schedule Up To Date
        is_owner:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Owner
        owner_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner Name
      type: object
      required:
        - taxonomy_id
        - taxonomy_name
        - taxonomy_description
        - taxonomy_data
      title: DeasyTaxonomy
    HTTPError:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: HTTPError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TaxonomyGraph:
      properties:
        nodes:
          items:
            $ref: '#/components/schemas/TaxonomyNode'
          type: array
          title: Nodes
        edges:
          items:
            $ref: '#/components/schemas/TaxonomyEdge'
          type: array
          title: Edges
        root_node_id:
          type: string
          title: Root Node Id
          description: ID of the root node
          default: root
      type: object
      title: TaxonomyGraph
      description: |-
        A node/edge style graph representation of a taxonomy.

        Example (simple case - single condition per edge):
            graph = TaxonomyGraph(
                nodes=[
                    TaxonomyNode(node_id="1", name="Document Type", active_values=["Contract", "Invoice"]),
                    TaxonomyNode(node_id="2", name="Contract Type", active_values=["NDA", "Employment"]),
                ],
                edges=[
                    TaxonomyEdge(
                        target_node_ids=["1"],
                        conditions=[EdgeCondition(node_id="root", tag_value_name="Contract")],
                    ),
                    TaxonomyEdge(
                        target_node_ids=["2"],
                        conditions=[EdgeCondition(node_id="1", tag_value_name="NDA")],
                    ),
                ]
            )

        Example (AND case - multiple conditions):
            # Edge only followed when Document Type = Contract AND Region = US
            TaxonomyEdge(
                target_node_ids=["us_contract_node"],
                conditions=[
                    EdgeCondition(node_id="doc_type_node", tag_value_name="Contract"),
                    EdgeCondition(node_id="region_node", tag_value_name="US"),
                ],
            )
    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
    TaxonomyNode:
      properties:
        node_id:
          type: string
          title: Node Id
        node_type:
          $ref: '#/components/schemas/TaxonomyNodeType'
          default: tag
        name:
          type: string
          title: Name
          description: The tag name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: >-
            Description of what this tag represents. Short and specific,
            capturing the relevant context.
        active_values:
          items:
            type: string
          type: array
          title: Active Values
          description: >-
            Allowed values for this tag. Empty list means all values from the
            tag definition are allowed.
      type: object
      required:
        - name
      title: TaxonomyNode
      description: >-
        A node in the taxonomy graph representing a tag.


        Nodes are tags with their metadata. The graph structure is defined

        by edges that connect parent nodes to child nodes with optional
        conditions.
    TaxonomyEdge:
      properties:
        edge_id:
          type: string
          title: Edge Id
        target_node_ids:
          items:
            type: string
          type: array
          title: Target Node Ids
          description: IDs of the child nodes
        conditions:
          items:
            $ref: '#/components/schemas/EdgeCondition'
          type: array
          title: Conditions
          description: >-
            Conditions that must ALL be true for this edge to be followed (AND
            logic)
      type: object
      required:
        - target_node_ids
        - conditions
      title: TaxonomyEdge
      description: >-
        An edge in the taxonomy graph connecting to child tags based on one or
        more conditions.


        For simple cases, use a single condition in the list.

        For AND cases, use multiple conditions - all must be satisfied.
    TaxonomyNodeType:
      type: string
      enum:
        - root
        - tag
      title: TaxonomyNodeType
      description: Types of nodes in a taxonomy graph
    EdgeCondition:
      properties:
        node_id:
          type: string
          title: Node Id
          description: ID of the node whose value must match
        tag_value_name:
          type: string
          title: Tag Value Name
          description: The tag value that must match
      type: object
      required:
        - node_id
        - tag_value_name
      title: EdgeCondition
      description: A single condition that must be met for an edge to be followed.
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
    UserIdAuth:
      type: apiKey
      in: header
      name: X-User-ID

````