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

# Combine PDF documents

> Combines multiple PDF documents into a single PDF and returns the combined document's metadata.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/documents/combine
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/documents/combine:
    post:
      tags:
        - Document
      summary: Combine PDF documents
      description: >-
        Combines multiple PDF documents into a single PDF and returns the
        combined document's metadata.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                combinedFileName:
                  type: string
                  description: >-
                    The desired file name for the combined PDF (e.g.,
                    'combined.pdf').
                documents:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                      fileName:
                        type: string
                    required:
                      - id
                      - fileName
                    additionalProperties: false
                  description: >-
                    An array of document resources to be combined. All documents
                    must be PDFs.
              required:
                - combinedFileName
                - documents
              additionalProperties: false
        required: true
      responses:
        '200':
          description: Successfully combined documents into a single PDF.
          content:
            application/json:
              schema:
                type: object
                properties:
                  document:
                    type: object
                    properties:
                      id:
                        type: string
                      fileName:
                        type: string
                    required:
                      - id
                      - fileName
                    additionalProperties: false
                    description: Metadata of the newly created combined PDF document.
                required:
                  - document
                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, one or more specified documents do 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 combining the PDF documents.
                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.combine(
                combined_file_name="combinedFileName",
                documents=[{
                    "id": "id",
                    "file_name": "fileName",
                }],
            )
            print(response.document)

````