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

# Fork collection

> Creates a fork of an existing collection.



## OpenAPI

````yaml https://api.trychroma.com/openapi.json post /api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork
openapi: 3.1.0
info:
  title: chroma-frontend
  description: ''
  license:
    name: ''
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork:
    post:
      tags:
        - Collection
      summary: Fork collection
      description: Creates a fork of an existing collection.
      operationId: fork_collection
      parameters:
        - name: tenant
          in: path
          description: Tenant UUID
          required: true
          schema:
            type: string
          example: 1e30d217-3d78-4f8c-b244-79381dc6a254
        - name: database
          in: path
          description: Database name
          required: true
          schema:
            type: string
        - name: collection_id
          in: path
          description: Collection UUID
          required: true
          schema:
            type: string
          example: 1e30d217-3d78-4f8c-b244-79381dc6a254
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForkCollectionPayload'
        required: true
      responses:
        '200':
          description: Collection forked successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Collection'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Collection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - label: Fork collection
          lang: typescript
          source: 'const forked = await collection.fork({ name: ''forked_collection'' });'
        - label: Fork collection
          lang: python
          source: forked = collection.fork(new_name='forked_collection')
        - label: Fork collection
          lang: rust
          source: let forked = collection.fork("forked_collection").await?;
components:
  schemas:
    ForkCollectionPayload:
      type: object
      required:
        - new_name
      properties:
        new_name:
          type: string
    Collection:
      type: object
      required:
        - id
        - name
        - configuration_json
        - tenant
        - database
        - log_position
        - version
      properties:
        configuration_json:
          $ref: '#/components/schemas/CollectionConfiguration'
        database:
          type: string
        dimension:
          type:
            - integer
            - 'null'
          format: int32
        id:
          $ref: '#/components/schemas/CollectionUuid'
        log_position:
          type: integer
          format: int64
        metadata:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/HashMap'
        name:
          type: string
        schema:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Schema'
        tenant:
          type: string
        version:
          type: integer
          format: int32
    ErrorResponse:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
    CollectionConfiguration:
      type: object
      properties:
        embedding_function:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/EmbeddingFunctionConfiguration'
        hnsw:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/HnswConfiguration'
        spann:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SpannConfiguration'
    CollectionUuid:
      type: string
      format: uuid
    HashMap:
      type: object
      additionalProperties:
        oneOf:
          - type: boolean
          - type: integer
            format: int64
          - type: number
            format: double
          - type: string
          - $ref: '#/components/schemas/SparseVector'
          - type: array
            items:
              type: boolean
          - type: array
            items:
              type: integer
              format: int64
          - type: array
            items:
              type: number
              format: double
          - type: array
            items:
              type: string
      propertyNames:
        type: string
    Schema:
      type: object
      description: >-
        Schema representation for collection index configurations


        This represents the server-side schema structure used for index
        management
      required:
        - defaults
        - keys
      properties:
        cmek:
          type:
            - object
            - 'null'
          description: Customer-managed encryption key for collection data
        defaults:
          $ref: '#/components/schemas/ValueTypes'
          description: Default index configurations for each value type
        keys:
          type: object
          description: >-
            Key-specific index overrides

            TODO(Sanket): Needed for backwards compatibility. Should remove
            after deploy.
          additionalProperties:
            $ref: '#/components/schemas/ValueTypes'
          propertyNames:
            type: string
        source_attached_function_id:
          type:
            - string
            - 'null'
          description: >-
            ID of the attached function that created this output collection (if
            applicable)
    EmbeddingFunctionConfiguration:
      oneOf:
        - type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - legacy
        - allOf:
            - $ref: '#/components/schemas/EmbeddingFunctionNewConfiguration'
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - known
        - type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - unknown
    HnswConfiguration:
      type: object
      properties:
        ef_construction:
          type:
            - integer
            - 'null'
          minimum: 0
        ef_search:
          type:
            - integer
            - 'null'
          minimum: 0
        max_neighbors:
          type:
            - integer
            - 'null'
          minimum: 0
        resize_factor:
          type:
            - number
            - 'null'
          format: double
        space:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Space'
        sync_threshold:
          type:
            - integer
            - 'null'
          minimum: 0
      additionalProperties: false
    SpannConfiguration:
      type: object
      properties:
        ef_construction:
          type:
            - integer
            - 'null'
          minimum: 0
        ef_search:
          type:
            - integer
            - 'null'
          minimum: 0
        max_neighbors:
          type:
            - integer
            - 'null'
          minimum: 0
        merge_threshold:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        reassign_neighbor_count:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        search_nprobe:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        space:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Space'
        split_threshold:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        write_nprobe:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
      additionalProperties: false
    SparseVector:
      type: object
      description: >-
        Represents a sparse vector using parallel arrays for indices and values.


        On deserialization: accepts both old format `{"indices": [...],
        "values": [...]}`

        and new format `{"#type": "sparse_vector", "indices": [...], "values":
        [...]}`.


        On serialization: always includes `#type` field with value
        `"sparse_vector"`.
      required:
        - indices
        - values
      properties:
        indices:
          type: array
          items:
            type: integer
            format: int32
            minimum: 0
          description: Dimension indices
        tokens:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Tokens corresponding to each index
        values:
          type: array
          items:
            type: number
            format: float
          description: Values corresponding to each index
    ValueTypes:
      type: object
      description: |-
        Strongly-typed value type configurations
        Contains optional configurations for each supported value type
      properties:
        bool:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BoolValueType'
        float:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FloatValueType'
        float_list:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FloatListValueType'
        int:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/IntValueType'
        sparse_vector:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SparseVectorValueType'
        string:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/StringValueType'
    EmbeddingFunctionNewConfiguration:
      type: object
      required:
        - name
        - config
      properties:
        config: {}
        name:
          type: string
    Space:
      type: string
      enum:
        - l2
        - cosine
        - ip
    BoolValueType:
      type: object
      description: Boolean value type index configurations
      properties:
        bool_inverted_index:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BoolInvertedIndexType'
    FloatValueType:
      type: object
      description: Float value type index configurations
      properties:
        float_inverted_index:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FloatInvertedIndexType'
    FloatListValueType:
      type: object
      description: Float list value type index configurations (for vectors)
      properties:
        vector_index:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/VectorIndexType'
    IntValueType:
      type: object
      description: Integer value type index configurations
      properties:
        int_inverted_index:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/IntInvertedIndexType'
    SparseVectorValueType:
      type: object
      description: Sparse vector value type index configurations
      properties:
        sparse_vector_index:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SparseVectorIndexType'
    StringValueType:
      type: object
      description: String value type index configurations
      properties:
        fts_index:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FtsIndexType'
        string_inverted_index:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/StringInvertedIndexType'
    BoolInvertedIndexType:
      type: object
      required:
        - enabled
        - config
      properties:
        config:
          $ref: '#/components/schemas/BoolInvertedIndexConfig'
        enabled:
          type: boolean
    FloatInvertedIndexType:
      type: object
      required:
        - enabled
        - config
      properties:
        config:
          $ref: '#/components/schemas/FloatInvertedIndexConfig'
        enabled:
          type: boolean
    VectorIndexType:
      type: object
      required:
        - enabled
        - config
      properties:
        config:
          $ref: '#/components/schemas/VectorIndexConfig'
        enabled:
          type: boolean
    IntInvertedIndexType:
      type: object
      required:
        - enabled
        - config
      properties:
        config:
          $ref: '#/components/schemas/IntInvertedIndexConfig'
        enabled:
          type: boolean
    SparseVectorIndexType:
      type: object
      required:
        - enabled
        - config
      properties:
        config:
          $ref: '#/components/schemas/SparseVectorIndexConfig'
        enabled:
          type: boolean
    FtsIndexType:
      type: object
      required:
        - enabled
        - config
      properties:
        config:
          $ref: '#/components/schemas/FtsIndexConfig'
        enabled:
          type: boolean
    StringInvertedIndexType:
      type: object
      required:
        - enabled
        - config
      properties:
        config:
          $ref: '#/components/schemas/StringInvertedIndexConfig'
        enabled:
          type: boolean
    BoolInvertedIndexConfig:
      type: object
      additionalProperties: false
    FloatInvertedIndexConfig:
      type: object
      additionalProperties: false
    VectorIndexConfig:
      type: object
      properties:
        embedding_function:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/EmbeddingFunctionConfiguration'
              description: Embedding function configuration
        hnsw:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/HnswIndexConfig'
              description: HNSW algorithm configuration
        source_key:
          type:
            - string
            - 'null'
          description: Key to source the vector from
        space:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Space'
              description: Vector space for similarity calculation (cosine, l2, ip)
        spann:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SpannIndexConfig'
              description: SPANN algorithm configuration
      additionalProperties: false
    IntInvertedIndexConfig:
      type: object
      additionalProperties: false
    SparseVectorIndexConfig:
      type: object
      properties:
        algorithm:
          $ref: '#/components/schemas/SparseIndexAlgorithm'
          description: |-
            Sparse index algorithm (cloud-only, tenant-gated).
            Omitted from JSON when set to the default (Wand) so that old
            servers/clients that do not know about this field can still
            deserialize the schema.
        bm25:
          type:
            - boolean
            - 'null'
          description: Whether this embedding is BM25
        embedding_function:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/EmbeddingFunctionConfiguration'
              description: Embedding function configuration
        source_key:
          type:
            - string
            - 'null'
          description: Key to source the sparse vector from
      additionalProperties: false
    FtsIndexConfig:
      type: object
      additionalProperties: false
    StringInvertedIndexConfig:
      type: object
      additionalProperties: false
    HnswIndexConfig:
      type: object
      description: Configuration for HNSW vector index algorithm parameters
      properties:
        batch_size:
          type:
            - integer
            - 'null'
          minimum: 0
        ef_construction:
          type:
            - integer
            - 'null'
          minimum: 0
        ef_search:
          type:
            - integer
            - 'null'
          minimum: 0
        max_neighbors:
          type:
            - integer
            - 'null'
          minimum: 0
        num_threads:
          type:
            - integer
            - 'null'
          minimum: 0
        resize_factor:
          type:
            - number
            - 'null'
          format: double
        sync_threshold:
          type:
            - integer
            - 'null'
          minimum: 0
      additionalProperties: false
    SpannIndexConfig:
      type: object
      description: Configuration for SPANN vector index algorithm parameters
      properties:
        center_drift_threshold:
          type:
            - number
            - 'null'
          format: float
        ef_construction:
          type:
            - integer
            - 'null'
          minimum: 0
        ef_search:
          type:
            - integer
            - 'null'
          minimum: 0
        initial_lambda:
          type:
            - number
            - 'null'
          format: float
        max_neighbors:
          type:
            - integer
            - 'null'
          minimum: 0
        merge_threshold:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        nreplica_count:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        num_centers_to_merge_to:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        num_samples_kmeans:
          type:
            - integer
            - 'null'
          minimum: 0
        quantize:
          $ref: '#/components/schemas/Quantization'
          description: Quantization implementation for vector search (cloud-only feature)
        reassign_neighbor_count:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        search_nprobe:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        search_rng_epsilon:
          type:
            - number
            - 'null'
          format: float
        search_rng_factor:
          type:
            - number
            - 'null'
          format: float
        split_threshold:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        write_nprobe:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        write_rng_epsilon:
          type:
            - number
            - 'null'
          format: float
        write_rng_factor:
          type:
            - number
            - 'null'
          format: float
      additionalProperties: false
    SparseIndexAlgorithm:
      type: string
      description: |-
        Sparse vector index algorithm.

        Controls which posting list format and query engine are used for
        sparse vector search within a collection.
      enum:
        - wand
        - max_score
    Quantization:
      type: string
      description: Quantization implementation for SPANN vector index.
      enum:
        - none
        - four_bit_rabit_q_with_u_search
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-chroma-token

````