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

# Export Collection

> Export collection documents to JSON, CSV, or Parquet format.

    **Export Formats:**
    - **JSON**: Line-delimited JSON (JSONL) format. Good for streaming.
    - **CSV**: Comma-separated values. Best for spreadsheets.
    - **PARQUET**: Columnar format (default). Best for data pipelines.

    **Vector Export:**
    Vectors are large and exported separately. When `include_vectors=True`,
    a separate file is created for vectors with document_id mapping.

    **Field Selection:**
    Use `select_fields` to export only specific fields, reducing file size.

    **Filtering:**
    Apply filters to export a subset of documents.

    **Response:**
    Returns presigned download URLs valid for 1 hour.

    **Limits:**
    - Large exports may take time. Consider using `sample_size` for testing.
    - Vector exports significantly increase processing time.



## OpenAPI

````yaml post /v1/collections/{collection_identifier}/export
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/collections/{collection_identifier}/export:
    post:
      tags:
        - Collections
      summary: Export Collection
      description: |-
        Export collection documents to JSON, CSV, or Parquet format.

            **Export Formats:**
            - **JSON**: Line-delimited JSON (JSONL) format. Good for streaming.
            - **CSV**: Comma-separated values. Best for spreadsheets.
            - **PARQUET**: Columnar format (default). Best for data pipelines.

            **Vector Export:**
            Vectors are large and exported separately. When `include_vectors=True`,
            a separate file is created for vectors with document_id mapping.

            **Field Selection:**
            Use `select_fields` to export only specific fields, reducing file size.

            **Filtering:**
            Apply filters to export a subset of documents.

            **Response:**
            Returns presigned download URLs valid for 1 hour.

            **Limits:**
            - Large exports may take time. Consider using `sample_size` for testing.
            - Vector exports significantly increase processing time.
      operationId: export_collection_v1_collections__collection_identifier__export_post
      parameters:
        - name: collection_identifier
          in: path
          required: true
          schema:
            type: string
            description: The ID or name of the collection to export
            title: Collection Identifier
          description: The ID or name of the collection to export
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionExportRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionExportResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CollectionExportRequest:
      properties:
        format:
          $ref: '#/components/schemas/ExportFormat'
          description: 'Export format: json (line-delimited), csv, or parquet (default).'
          default: parquet
        include_vectors:
          type: boolean
          title: Include Vectors
          description: >-
            Whether to include vectors in the export. Vectors are exported to a
            separate file due to their large size. This significantly increases
            export time and file size.
          default: false
        select_fields:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Select Fields
          description: >-
            Specific fields to include in the export. If not provided, all
            fields are exported. Supports dot notation for nested fields (e.g.,
            'metadata.title', 'metadata.author').
          examples:
            - - document_id
              - metadata.title
              - metadata.category
        filters:
          anyOf:
            - $ref: '#/components/schemas/LogicalOperator-Input'
            - type: 'null'
          description: >-
            Filter conditions to export only matching documents. Uses
            LogicalOperator format (AND/OR/NOT) same as document listing.
        sample_size:
          anyOf:
            - type: integer
              maximum: 1000000
              minimum: 1
            - type: 'null'
          title: Sample Size
          description: >-
            Maximum number of documents to export. If not provided, exports all
            documents. Useful for testing exports or creating sample datasets.
      type: object
      title: CollectionExportRequest
      description: >-
        Request model for exporting collection data.


        **Export Formats:**

        - **JSON**: Line-delimited JSON (JSONL) format, one document per line.
        Good for streaming and large files.

        - **CSV**: Comma-separated values. Best for tabular data analysis in
        spreadsheets.

        - **PARQUET**: Columnar format optimized for analytics. Best for large
        datasets and data pipelines.


        **Vector Export:**

        Vectors are stored separately from document metadata due to their large
        size.

        When `include_vectors=True`, vectors are exported to a separate file
        with the naming convention:

        `{collection_name}_vectors.{format}`


        **Field Selection:**

        Use `select_fields` to export only specific fields, reducing file size
        for large collections.

        Supports dot notation for nested fields (e.g., "metadata.title").


        **Filtering:**

        Apply filters to export a subset of documents. Uses the same
        LogicalOperator format

        as the documents list endpoint.
    CollectionExportResponse:
      properties:
        download_url:
          type: string
          title: Download Url
          description: Presigned URL for downloading the exported file. Valid for 1 hour.
        s3_path:
          type: string
          title: S3 Path
          description: Full S3 path where the export is stored (for internal reference).
        format:
          $ref: '#/components/schemas/ExportFormat'
          description: The format of the exported file.
        document_count:
          type: integer
          minimum: 0
          title: Document Count
          description: Number of documents included in the export.
        file_size_bytes:
          type: integer
          minimum: 0
          title: File Size Bytes
          description: Size of the exported file in bytes.
        exported_at:
          type: string
          format: date-time
          title: Exported At
          description: Timestamp when the export was completed.
        vectors_download_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Vectors Download Url
          description: >-
            Presigned URL for downloading the vectors file (if
            include_vectors=True). Vectors are exported separately due to their
            large size.
        vectors_s3_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Vectors S3 Path
          description: Full S3 path for the vectors file (if include_vectors=True).
      type: object
      required:
        - download_url
        - s3_path
        - format
        - document_count
        - file_size_bytes
        - exported_at
      title: CollectionExportResponse
      description: |-
        Response model for collection export.

        Contains the presigned URL for downloading the exported file.
        The URL is valid for a limited time (typically 1 hour).
      examples:
        - document_count: 10000
          download_url: >-
            https://s3.amazonaws.com/bucket/org_xxx/ns_xxx/api_collections_export/col_xxx/v1/documents.parquet?...
          exported_at: '2024-01-15T10:30:00Z'
          file_size_bytes: 5242880
          format: parquet
          s3_path: >-
            s3://bucket/org_xxx/ns_xxx/api_collections_export/col_xxx/v1/documents.parquet
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ExportFormat:
      type: string
      enum:
        - json
        - csv
        - parquet
      title: ExportFormat
      description: Supported export formats for collection data.
    LogicalOperator-Input:
      properties:
        AND:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/LogicalOperator-Input'
                  - $ref: '#/components/schemas/FilterCondition'
              type: array
            - type: 'null'
          title: And
          description: Logical AND operation - all conditions must be true
          example:
            - field: name
              operator: eq
              value: John
            - field: age
              operator: gte
              value: 30
        OR:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/LogicalOperator-Input'
                  - $ref: '#/components/schemas/FilterCondition'
              type: array
            - type: 'null'
          title: Or
          description: Logical OR operation - at least one condition must be true
          example:
            - field: status
              operator: eq
              value: active
            - field: role
              operator: eq
              value: admin
        NOT:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/LogicalOperator-Input'
                  - $ref: '#/components/schemas/FilterCondition'
              type: array
            - type: 'null'
          title: Not
          description: Logical NOT operation - all conditions must be false
          example:
            - field: department
              operator: eq
              value: HR
            - field: location
              operator: eq
              value: remote
        case_sensitive:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Case Sensitive
          description: Whether to perform case-sensitive matching
          default: false
          example: true
      additionalProperties: true
      type: object
      title: LogicalOperator
      description: >-
        Represents a logical operation (AND, OR, NOT) on filter conditions.


        Allows nesting with a defined depth limit.


        Also supports shorthand syntax where field names can be passed directly

        as key-value pairs for equality filtering (e.g., {"metadata.title":
        "value"}).
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    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
    FilterCondition:
      properties:
        field:
          type: string
          title: Field
          description: Field name to filter on
        operator:
          $ref: '#/components/schemas/FilterOperator'
          description: Comparison operator
          default: eq
        value:
          anyOf:
            - $ref: '#/components/schemas/DynamicValue'
            - {}
          title: Value
          description: Value to compare against
      type: object
      required:
        - field
        - value
      title: FilterCondition
      description: |-
        Represents a single filter condition.

        Attributes:
            field: The field to filter on
            operator: The comparison operator
            value: The value to compare against
    FilterOperator:
      description: Supported filter operators across database implementations.
      enum:
        - eq
        - ne
        - gt
        - lt
        - gte
        - lte
        - in
        - nin
        - contains
        - starts_with
        - ends_with
        - regex
        - exists
        - is_null
        - text
        - phrase
      title: FilterOperator
      type: string
    DynamicValue:
      description: A value that should be dynamically resolved from the query request.
      properties:
        type:
          type: string
          const: dynamic
          title: Type
          default: dynamic
        field:
          type: string
          title: Field
          description: >-
            The dot-notation path to the value in the runtime query request,
            e.g., 'inputs.user_id'
          examples:
            - inputs.query_text
            - filters.AND[0].value
      required:
        - field
      title: DynamicValue
      type: object

````