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

# Export

> Export dataslice metadata and/or nodes to a configured destination.

This endpoint supports exporting data from a dataslice or data connector to a destination 
system. For small datasets (fewer than 100 files), the export runs synchronously. For larger 
datasets, the export is processed in the background and returns a tracker ID for monitoring progress.

## Request Body

| Field                      | Type                       | Required | Description                                                                                       |
|----------------------------|----------------------------|----------|---------------------------------------------------------------------------------------------------|
| `dataslice_id`             | `str`                      | No       | The ID of the dataslice to export. Required if `data_connector_name` is not provided.            |
| `data_connector_name`      | `str`                      | No       | The name of the data connector to export from. Required if `dataslice_id` is not provided.       |
| `destination_name`         | `str`                      | No       | The name of the configured destination to export to.                                              |
| `export_tags`              | `List[str]`                | No       | List of specific tags to export. If empty, all tags are exported.                                |
| `export_level`             | `ExportLevel`              | No       | Level of export: `"file"`, `"chunk"`, or `"both"` (default: `"both"`).                          |
| `export_nodes`             | `bool`                     | No       | Whether to export node data (default: `true`).                                                    |
| `export_metadata`          | `bool`                     | No       | Whether to export metadata (default: `true`).                                                     |
| `metadata_format`          | `MetadataStorageFormat`    | No       | Format for metadata storage: `"column_store"` or `"json_store"`.                                |

## Response

- **200**: Export completed or initiated successfully
    - Returns: `ExportDatasliceDestinationResponse` with:
        - `message`: Status message
        - `success`: Number of successfully exported items
        - `failed`: Number of failed exports
        - `failed_items`: List of items that failed to export
        - `failed_tags`: List of tags that failed to export (if applicable)
        - `tracker_id`: Progress tracker ID for background exports (only for large datasets)
- **400**: Bad Request (e.g., missing required parameters)
- **500**: Internal Server Error

## Example Request

```json
{
  "dataslice_id": "550e8400-e29b-41d4-a716-446655440000",
  "destination_name": "my-destination",
  "export_tags": ["contracts", "invoices"],
  "export_level": "both",
  "export_nodes": true,
  "export_metadata": true,
  "metadata_format": "column_store"
}
```

## Example Response (Synchronous)

```json
{
  "message": "Export completed successfully",
  "success": 45,
  "failed": 0,
  "failed_items": [],
  "failed_tags": null,
  "tracker_id": null
}
```

## Example Response (Background Processing)

```json
{
  "message": "Export started in background. Use tracker_id to monitor progress.",
  "success": 0,
  "failed": 0,
  "failed_items": [],
  "failed_tags": null,
  "tracker_id": "export-12345678-90ab-cdef-1234-567890abcdef"
}
```



## OpenAPI

````yaml /deasy-openapi-stainless.yml post /dataslice/export/metadata/destination
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: /rest/unstructured
security: []
paths:
  /dataslice/export/metadata/destination:
    post:
      tags:
        - Destinations
      summary: Export
      description: >-
        Export dataslice metadata and/or nodes to a configured destination.


        This endpoint supports exporting data from a dataslice or data connector
        to a destination 

        system. For small datasets (fewer than 100 files), the export runs
        synchronously. For larger 

        datasets, the export is processed in the background and returns a
        tracker ID for monitoring progress.


        ## Request Body


        | Field                      | Type                       | Required |
        Description                                                                                      
        |

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

        | `dataslice_id`             | `str`                      | No       |
        The ID of the dataslice to export. Required if `data_connector_name` is
        not provided.            |

        | `data_connector_name`      | `str`                      | No       |
        The name of the data connector to export from. Required if
        `dataslice_id` is not provided.       |

        | `destination_name`         | `str`                      | No       |
        The name of the configured destination to export
        to.                                              |

        | `export_tags`              | `List[str]`                | No       |
        List of specific tags to export. If empty, all tags are
        exported.                                |

        | `export_level`             | `ExportLevel`              | No       |
        Level of export: `"file"`, `"chunk"`, or `"both"` (default:
        `"both"`).                          |

        | `export_nodes`             | `bool`                     | No       |
        Whether to export node data (default:
        `true`).                                                    |

        | `export_metadata`          | `bool`                     | No       |
        Whether to export metadata (default:
        `true`).                                                     |

        | `metadata_format`          | `MetadataStorageFormat`    | No       |
        Format for metadata storage: `"column_store"` or
        `"json_store"`.                                |


        ## Response


        - **200**: Export completed or initiated successfully
            - Returns: `ExportDatasliceDestinationResponse` with:
                - `message`: Status message
                - `success`: Number of successfully exported items
                - `failed`: Number of failed exports
                - `failed_items`: List of items that failed to export
                - `failed_tags`: List of tags that failed to export (if applicable)
                - `tracker_id`: Progress tracker ID for background exports (only for large datasets)
        - **400**: Bad Request (e.g., missing required parameters)

        - **500**: Internal Server Error


        ## Example Request


        ```json

        {
          "dataslice_id": "550e8400-e29b-41d4-a716-446655440000",
          "destination_name": "my-destination",
          "export_tags": ["contracts", "invoices"],
          "export_level": "both",
          "export_nodes": true,
          "export_metadata": true,
          "metadata_format": "column_store"
        }

        ```


        ## Example Response (Synchronous)


        ```json

        {
          "message": "Export completed successfully",
          "success": 45,
          "failed": 0,
          "failed_items": [],
          "failed_tags": null,
          "tracker_id": null
        }

        ```


        ## Example Response (Background Processing)


        ```json

        {
          "message": "Export started in background. Use tracker_id to monitor progress.",
          "success": 0,
          "failed": 0,
          "failed_items": [],
          "failed_tags": null,
          "tracker_id": "export-12345678-90ab-cdef-1234-567890abcdef"
        }

        ```
      operationId: export_destination_route_dataslice_export_metadata_destination_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportDatasliceDestinationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportDatasliceDestinationResponse'
        '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'
      security:
        - BasicAuth: []
        - BearerAuth: []
          UserIdAuth: []
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from unstructured import UnstructuredClient

            client = UnstructuredClient(
                username=os.environ.get("UNSTRUCTURED_USERNAME"),  # This is the default and can be omitted
                password=os.environ.get("UNSTRUCTURED_PASSWORD"),  # This is the default and can be omitted
            )
            response = client.destination.export()
            print(response.tracker_id)
        - lang: JavaScript
          source: |-
            import UnstructuredClient from 'unstructured-sdk';

            const client = new UnstructuredClient({
              authMethod: 'My Auth Method',
              username: process.env['UNSTRUCTURED_USERNAME'], // This is the default and can be omitted
              password: process.env['UNSTRUCTURED_PASSWORD'], // This is the default and can be omitted
            });

            const response = await client.destination.export();

            console.log(response.tracker_id);
components:
  schemas:
    ExportDatasliceDestinationRequest:
      properties:
        dataslice_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataslice Id
        data_connector_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Data Connector Name
        destination_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Destination Name
        export_tags:
          items: {}
          type: array
          title: Export Tags
          default: []
        export_level:
          $ref: '#/components/schemas/ExportLevel'
          default: both
        export_nodes:
          type: boolean
          title: Export Nodes
          default: true
        export_metadata:
          type: boolean
          title: Export Metadata
          default: true
        metadata_format:
          anyOf:
            - $ref: '#/components/schemas/MetadataStorageFormat'
            - type: 'null'
      type: object
      title: ExportDatasliceDestinationRequest
    ExportDatasliceDestinationResponse:
      properties:
        message:
          type: string
          title: Message
        success:
          type: integer
          title: Success
        failed:
          type: integer
          title: Failed
        failed_items:
          items:
            type: string
          type: array
          title: Failed Items
        failed_tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Failed Tags
        tracker_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tracker Id
      type: object
      required:
        - message
        - success
        - failed
        - failed_items
      title: ExportDatasliceDestinationResponse
    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
    ExportLevel:
      type: string
      enum:
        - file
        - chunk
        - both
      title: ExportLevel
    MetadataStorageFormat:
      type: string
      enum:
        - column_store
        - json_store
      title: MetadataStorageFormat
    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
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
    UserIdAuth:
      type: apiKey
      in: header
      name: X-User-ID

````