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

# Split a Document by Document Type

The **Split a Document by Document Type** endpoint allows you to split an existing document into multiple documents based on the specified document types. This operation is useful for processing documents with different types of content or sections, ensuring that each part is categorized and handled according to its document type.

**Request Body Parameters:**

* `template_ids` (array of strings): A list of `template_id`s that specify how the document should be split. Each ID corresponds to a predefined template schema.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.pardocs.com/v1/documents/{document_id}/split \
    --header 'x-api-key: <api-key>'
    --data '{
    "template_ids": [
      "<string>"
    ]
  }'
  ```

  ```python Python theme={null}
  import json
  import requests

  url = "https://api.pardocs.com/v1/documents/{document_id}/split"
  headers = {
      "x-api-key": "<api-key>",
      "Content-Type": "application/json"
  }
  data = {"template_ids": ["<string>"]}

  response = requests.post(url, headers=headers, data=json.dumps(data))

  print(response.json())
  ```
</RequestExample>


## OpenAPI

````yaml openapi-documents POST /v1/documents/{document_id}/split
openapi: 3.1.0
info:
  title: Document API
  version: 1.0.1
servers:
  - url: https://api.pardocs.com
security:
  - ApiKeyAuth: []
paths:
  /v1/documents/{document_id}/split:
    post:
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
          description: The ID of document to split.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                template_ids:
                  type: array
                  items:
                    type: string
                  description: Include all template_id to split the document.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  properties:
                    document_type:
                      type: string
                    pages:
                      type: array
                      items:
                        type: integer
        4XX:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      required:
        - detail
      type: object
      properties:
        detail:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````