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

# Create documents from splits

> Creates new documents from specified page splits of an existing document.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/documents/create-from-splits
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/documents/create-from-splits:
    post:
      tags:
        - Document
      summary: Create documents from splits
      description: >-
        Creates new documents from specified page splits of an existing
        document.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                splits:
                  type: array
                  items:
                    type: number
                  description: >-
                    Array of page numbers indicating where to split the
                    document. Each number is the start of a new document
                    segment.
                document:
                  type: object
                  properties:
                    id:
                      type: string
                    fileName:
                      type: string
                  required:
                    - id
                    - fileName
                  additionalProperties: false
                  description: >-
                    The source document from which to create new documents based
                    on splits.
              required:
                - splits
                - document
              additionalProperties: false
        required: true
      responses:
        '200':
          description: Successfully created new documents from splits.
          content:
            application/json:
              schema:
                type: object
                properties:
                  createdDocuments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        fileName:
                          type: string
                        startPageInclusive:
                          type: number
                          description: >-
                            The starting page number of this split document
                            (1-indexed).
                        endPageInclusive:
                          type: number
                          description: >-
                            The ending page number of this split document
                            (1-indexed).
                      required:
                        - id
                        - fileName
                        - startPageInclusive
                        - endPageInclusive
                      additionalProperties: false
                    description: >-
                      An array of newly created document resources from the
                      splits.
                required:
                  - createdDocuments
                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 source document for splitting 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 creating documents from
                      splits.
                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.create_from_splits(
                document={
                    "id": "id",
                    "file_name": "fileName",
                },
                splits=[0],
            )
            print(response.created_documents)

````