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

# Split document (async)

> Initiates an asynchronous document splitting process. Returns an ID to track the async result.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/documents/split
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/documents/split:
    post:
      tags:
        - Document
      summary: Split document (async)
      description: >-
        Initiates an asynchronous document splitting process. Returns an ID to
        track the async result.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                document:
                  type: object
                  properties:
                    id:
                      type: string
                    fileName:
                      type: string
                  required:
                    - id
                    - fileName
                  additionalProperties: false
                  description: The document to be split.
                splitDescription:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      description:
                        type: string
                      partitionKey:
                        type: string
                    required:
                      - name
                      - description
                    additionalProperties: false
                  minItems: 1
                  description: Split description configuration.
                splitRules:
                  type: string
                  description: Optional split rules prompt for the splitter.
              required:
                - document
                - splitDescription
              additionalProperties: false
        required: true
      responses:
        '202':
          description: Accepted. Document splitting process initiated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  asyncResultId:
                    type: string
                    description: The ID to track the asynchronous splitting task.
                required:
                  - asyncResultId
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: The error message.
                  message:
                    type: string
                    description: The message.
                  statusCode:
                    type: number
                    description: The status code.
                  details:
                    type: object
                    additionalProperties: {}
                    description: The details of the error
                additionalProperties: true
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Not Found, the specified document to split does not exist.
                required:
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Internal server error while initiating splitting.
                required:
                  - error
                additionalProperties: false
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from samplehc import SampleHealthcare

            client = SampleHealthcare(
                api_key=os.environ.get("SAMPLEHC_API_KEY"),  # This is the default and can be omitted
            )
            response = client.v2.documents.split(
                document={
                    "id": "id",
                    "file_name": "fileName",
                },
                split_description=[{
                    "description": "description",
                    "name": "name",
                }],
            )
            print(response.async_result_id)

````