// api reference
Combine multiple PDF documents into a single file. Great for stitching invoices, reports, and attachments together in one automated step.
Every PDF tool runs as a small CustomJS function using our built-in pdfUtils. Write a few lines of JavaScript, deploy once, and you get a private API endpoint you can call from anywhere. Make.com, n8n, or plain curl.
Paste the function below into the editor at app.customjs.space.
Set the Response Type to PDF and deploy.
Call your function URL with the x-api-key header.
Import PDF_MERGE from ./utils and return its result. Remember to set the function's Response Type · PDF
const { PDF_MERGE } = require('./utils');
const pdfInputs = [...(input.urls || []), ...(input.files || [])].filter(Boolean);
return PDF_MERGE(pdfInputs);POST to your function URL. Pass the source PDF either as a public URL or a Base64 string. The request payload is capped at 6Â MB.
| Field | Type | Description |
|---|---|---|
| urls | string[] | Array of public PDF URLs, merged in order. Combine with files if needed. |
| files | string[] | Array of Base64-encoded PDFs (total payload max 6 MB). |
curl -X POST https://e.customjs.io/<your-function-id> \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"urls": [
"https://css4.pub/2017/newsletter/drylab.pdf",
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
]
}' --output merged.pdfcurl -X POST https://e.customjs.io/<your-function-id> \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"files": [
"JVBERi0x..........EyNzg3CiUlRU9GCg==",
"JVBERi0x..........EyNzg3CiUlRU9GCg=="
]
}' --output merged.pdf// try it first
Open the interactive playground on the product page. Generate PDFs live, tweak the code, and copy the generated curl or SDK snippet straight into your stack.
curl -X POST https://e.customjs.io/<your-function-id> \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"urls": [
"https://css4.pub/2017/newsletter/drylab.pdf",
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
]
}' --output merged.pdf600 free operations / month · no credit card