xtract.bot
POST /api/pdf-merge

Merge multiple PDFs into one. Lossless: pages are preserved verbatim with no re-rasterization. Optional title / author metadata for the resulting document.

Concatenates the supplied PDFs in order and returns a single merged document. All pages are preserved verbatim — no re-rasterization, no re-compression, original quality. Optional metadata fields (`title`, `author`, `subject`, `keywords`) populate the resulting document's info dictionary. Encrypted source PDFs are rejected by default; pass `ignoreEncryption: true` to load them anyway. Works for the common no-password-but-flagged-encrypted PDFs from scanners and form software; truly password-protected PDFs still fail.

Inputs

NameTypeDefaultDescription
pdfs*fileArray of base64-encoded PDFs to concatenate, in order.
titlestringOptional Title metadata for the merged document.
authorstringOptional Author metadata for the merged document.
ignoreEncryptionbooleanLoad PDFs flagged as encrypted anyway. Works for scanner / form-software output that's marked encrypted without a password; truly password-protected PDFs still fail. Default: false.

Response

Modes: binary, json. Cache: yes (24h TTL).

Code samples

Built from the two-page-pair example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/pdf-merge/hello.pdf
PDFS_0_=$(base64 -w0 < hello.pdf)
# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/pdf-merge/world.pdf
PDFS_1_=$(base64 -w0 < world.pdf)

curl -X POST https://api.xtract.bot/api/pdf-merge \
  -H "Content-Type: application/json" \
  -H "Accept: application/octet-stream" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "title": "merged",
  "pdfs[0]": "__BASE64_PDFS_0___",
  "pdfs[1]": "__BASE64_PDFS_1___"
}'