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

# Generate Batch

> Classify all files in a data connector in batches with the provided tags. 
To run sensitivity detection, use tags with a strategy of SENSITIVITY or a group which includes the magic word "Sensitivity"

## Request Body

| Field                 | Type                  | Description                                                                  |
|-----------------------|-----------------------|------------------------------------------------------------------------------|
| `data_connector_name` | `str`                 | Name of the data connector (vector database profile) to use for classification. |
| `total_data_sets`     | `Optional[int]`       | Total number of files to classify.                                           |
| `tag_names`           | `Optional[List[str]]` | Names of tags to use for classification (if `tag_datas` not provided).       |
| `tag_datas`           | `Optional[Dict]`      | Tag data to use for classification.                                          |
| `overwrite`           | `bool`                | Whether to overwrite existing tags. Default: `false`                         |
| `job_id`              | `Optional[str]`       | Custom job ID for tracking the classification task.                          |
| `hierarchy_name`      | `Optional[str]`       | Name of the hierarchy/taxonomy to use (if `hierarchy_data` not provided).       |
| `hierarchy_data`      | `Optional[Dict]`      | Hierarchy/taxonomy data to use for classification. Default: `{}`                |
| `dataslice_id`        | `Optional[str]`       | ID of the dataslice to use for file filtering.                               |
| `conditions`          | `Optional[Condition]` | Conditions to use for file filtering.                                        |

## Response

- **200**: Classification job started successfully  
    - Returns: `{ "message": str, "job_id": str }`
- **500**: Internal Server Error

## Example

```json
{
  "data_connector_name": "my-connector",
  "tag_names": ["category", "sentiment"],
  "overwrite": false,
  "dataslice_id": "abc123"
}
```



## OpenAPI

````yaml /deasy-openapi-stainless.yml post /classify_bulk
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: /rest/unstructured
security: []
paths:
  /classify_bulk:
    post:
      tags:
        - Metadata
      summary: Generate Batch
      description: >-
        Classify all files in a data connector in batches with the provided
        tags. 

        To run sensitivity detection, use tags with a strategy of SENSITIVITY or
        a group which includes the magic word "Sensitivity"


        ## Request Body


        | Field                 | Type                  |
        Description                                                                 
        |

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

        | `data_connector_name` | `str`                 | Name of the data
        connector (vector database profile) to use for classification. |

        | `total_data_sets`     | `Optional[int]`       | Total number of files
        to classify.                                           |

        | `tag_names`           | `Optional[List[str]]` | Names of tags to use
        for classification (if `tag_datas` not provided).       |

        | `tag_datas`           | `Optional[Dict]`      | Tag data to use for
        classification.                                          |

        | `overwrite`           | `bool`                | Whether to overwrite
        existing tags. Default: `false`                         |

        | `job_id`              | `Optional[str]`       | Custom job ID for
        tracking the classification task.                          |

        | `hierarchy_name`      | `Optional[str]`       | Name of the
        hierarchy/taxonomy to use (if `hierarchy_data` not provided).       |

        | `hierarchy_data`      | `Optional[Dict]`      | Hierarchy/taxonomy
        data to use for classification. Default: `{}`                |

        | `dataslice_id`        | `Optional[str]`       | ID of the dataslice to
        use for file filtering.                               |

        | `conditions`          | `Optional[Condition]` | Conditions to use for
        file filtering.                                        |


        ## Response


        - **200**: Classification job started successfully  
            - Returns: `{ "message": str, "job_id": str }`
        - **500**: Internal Server Error


        ## Example


        ```json

        {
          "data_connector_name": "my-connector",
          "tag_names": ["category", "sentiment"],
          "overwrite": false,
          "dataslice_id": "abc123"
        }

        ```
      operationId: generate_batch_route_classify_bulk_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassifyBulkRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClassifyBulkResponse'
        '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.metadata.generate.generate_batch(
                data_connector_name="data_connector_name",
            )
            print(response.message)
        - 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.metadata.generate.generateBatch({
              data_connector_name: 'data_connector_name',
            });

            console.log(response.message);
components:
  schemas:
    ClassifyBulkRequest:
      properties:
        data_connector_name:
          type: string
          title: Data Connector Name
        total_data_sets:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Data Sets
        tag_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tag Names
        tag_datas:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/Tag-Input'
              type: object
            - type: 'null'
          title: Tag Datas
        overwrite:
          type: boolean
          title: Overwrite
          default: false
        job_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Job Id
        hierarchy_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Hierarchy Name
        hierarchy_data:
          anyOf:
            - type: object
            - type: 'null'
          title: Hierarchy Data
          default: {}
        dataslice_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataslice Id
        conditions:
          anyOf:
            - $ref: '#/components/schemas/Condition-Input'
            - type: 'null'
      type: object
      required:
        - data_connector_name
      title: ClassifyBulkRequest
    ClassifyBulkResponse:
      properties:
        message:
          type: string
          title: Message
      type: object
      required:
        - message
      title: ClassifyBulkResponse
    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
    Tag-Input:
      properties:
        tag_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tag Id
        username:
          anyOf:
            - type: string
            - type: 'null'
          title: Username
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          default: ''
        output_type:
          anyOf:
            - $ref: '#/components/schemas/TagOutputType'
            - type: 'null'
          default: string
        available_values:
          anyOf:
            - items:
                anyOf:
                  - type: string
                  - type: number
                  - type: integer
              type: array
            - type: 'null'
          title: Available Values
          default: []
        examples:
          anyOf:
            - items:
                anyOf:
                  - type: string
                  - type: object
              type: array
            - type: 'null'
          title: Examples
          default: []
        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
        tuned:
          anyOf:
            - type: integer
            - type: 'null'
          title: Tuned
          default: 0
        maxValues:
          anyOf:
            - type: integer
            - type: string
            - items: {}
              type: array
            - type: 'null'
          title: Maxvalues
        neg_examples:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Neg Examples
          default: []
        retry_feedback:
          anyOf:
            - type: object
            - type: 'null'
          title: Retry Feedback
        date_format:
          anyOf:
            - type: string
            - type: 'null'
          title: Date Format
        strategy:
          anyOf:
            - type: string
            - type: 'null'
          title: Strategy
          default: LLM
        scope:
          anyOf:
            - type: string
            - type: 'null'
          title: Scope
          default: ALL_PAGES
        truncated_available_values:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Truncated Available Values
          default: false
        enhance_file_metadata:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enhance File Metadata
          default: true
        regex:
          anyOf:
            - type: string
            - type: 'null'
          title: Regex
        patterns:
          anyOf:
            - items:
                $ref: '#/components/schemas/RegexPattern'
              type: array
            - type: 'null'
          title: Patterns
          default: []
        visual_rules:
          anyOf:
            - items:
                $ref: '#/components/schemas/RuleBasedRule-Input'
              type: array
            - type: 'null'
          title: Visual Rules
          default: []
        group:
          anyOf:
            - type: string
            - type: 'null'
          title: Group
        min_confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Min Confidence
        collibra_asset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Collibra Asset Id
        collibra_domain_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Collibra Domain Id
        source_asset_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Asset Type
        governance_metadata:
          anyOf:
            - $ref: '#/components/schemas/GovernanceMetadata'
            - type: 'null'
      type: object
      required:
        - name
      title: Tag
    Condition-Input:
      properties:
        condition:
          anyOf:
            - $ref: '#/components/schemas/LogicCondition'
            - type: 'null'
        children:
          anyOf:
            - items:
                $ref: '#/components/schemas/Condition-Input'
              type: array
            - type: 'null'
          title: Children
        tag:
          anyOf:
            - $ref: '#/components/schemas/BaseTag'
            - type: 'null'
      type: object
      title: Condition
    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
    TagOutputType:
      type: string
      enum:
        - string
        - binary
        - number
        - date
      title: TagOutputType
    RegexPattern:
      properties:
        pattern:
          type: string
          title: Pattern
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        output_value:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Value
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
        validator:
          anyOf:
            - type: string
            - type: 'null'
          title: Validator
        active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Active
          default: true
        context_items:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Context Items
        required_context_matches:
          anyOf:
            - type: integer
            - type: 'null'
          title: Required Context Matches
          default: 0
      type: object
      required:
        - pattern
      title: RegexPattern
      description: Model for regex pattern configuration in tags.
    RuleBasedRule-Input:
      properties:
        tag_value:
          anyOf:
            - type: string
            - type: number
            - type: integer
            - type: 'null'
          title: Tag Value
        condition:
          anyOf:
            - $ref: '#/components/schemas/Condition-Input'
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
      type: object
      title: RuleBasedRule
      description: Model for rule-based tag configuration.
    GovernanceMetadata:
      properties:
        record_code:
          type: string
          title: Record Code
          description: Unique identifier from the retention schedule (e.g., FIN-001)
        retention_period:
          type: string
          title: Retention Period
          description: How long to retain (e.g., '7 years', 'Permanent')
        retention_trigger:
          type: string
          title: Retention Trigger
          description: Event that starts the retention clock (e.g., 'Date of payment')
        disposition:
          type: string
          title: Disposition
          description: Action after retention expires (e.g., 'Destroy', 'Archive')
        ingestion_id:
          type: string
          title: Ingestion Id
          description: UUID grouping all tags from the same CSV upload
      type: object
      required:
        - record_code
        - retention_period
        - retention_trigger
        - disposition
        - ingestion_id
      title: GovernanceMetadata
      description: >-
        Structured metadata for retention/policy governance tags.


        Populated when a tag is ingested from a retention schedule (CSV or
        Collibra Standards).

        Stored as JSONB in the tagschemas table.
    LogicCondition:
      type: string
      enum:
        - AND
        - OR
      title: LogicCondition
    BaseTag:
      properties:
        name:
          type: string
          title: Name
        values:
          items:
            anyOf:
              - type: string
              - type: number
              - type: integer
          type: array
          title: Values
          default: []
        operator:
          anyOf:
            - type: string
            - type: 'null'
          title: Operator
          default: any
      type: object
      required:
        - name
      title: BaseTag
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
    UserIdAuth:
      type: apiKey
      in: header
      name: X-User-ID

````