Merge Documents

Merge 2–50 images or PDFs into one document before processing.

Merge 2–50 images or PDFs into one document before processing, for multi-page documents captured as separate images. In the HTTP API, each entry in the files list uses file_url or file_base64 plus filename; the Python SDK also accepts local file_path values and converts them to base64.

HTTP API

POST/api/v1/documents/merge

Send a JSON body with an array of 2–50 files to merge and process as one document.

body parameters

FieldTypeDescription
filesrequiredarrayArray of 2–50 objects, each with file_url or file_base64 + filename.
document_typerequiredstringTarget document type for the merged result (e.g. bank_statement).
output_filenamestringCustom filename for the merged PDF. Defaults to auto-generated.
webhook_urlstringCompletion callback URL; same payload shape as single-document uploads.

cURL

curl -X POST https://api.kita.ai/api/v1/documents/merge \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
  "files": [
    { "file_url": "https://example.com/page1.pdf" },
    { "file_url": "https://example.com/page2.pdf" }
  ],
  "document_type": "bank_statement",
  "output_filename": "merged_document.pdf"
}'
Merge response
{
"document_id": 12345,
"status": "processing",
"message": "Files merged successfully. Processing as bank_statement.",
"output_filename": "merged_document.pdf",
"total_files_merged": 2
}

Python SDK

The SDK merge_documents method accepts mixed input types (URLs, local file paths, and base64 strings) in a single call.

result = client.merge_documents(
    files=[
        {"file_url": "https://example.com/cover.pdf"},
        {"file_path": "/path/to/scan.png"},
        {"file_base64": "iVBORw0KGgo...", "filename": "page3.png"},
    ],
    document_type="bank_statement",
)

Retrieving the result

The merged file is processed as a single document. Poll GET /api/v1/documents/jobs/{document_id} with the returned document_id for the extracted result.

On this page