Fusionar PDFs
Fusionar PDFs es una API que junta varios PDFs en uno solo, en el orden que le mandes. Perfecto para juntar facturas, anexos o informes en un único archivo desde n8n, Make o Zapier, sin montar servidores.
Cómo funciona
Le mandas dos o más PDFs (codificados en base64, dentro de un JSON) y te devuelve un único PDF con todas las páginas de todos ellos, en el mismo orden en que los mandaste. No guarda nada: el PDF se genera al momento.
A diferencia del resto de herramientas de PDF, esta necesita varios archivos a la vez, así que solo admite el cuerpo en JSON (no hay modo "pega el PDF a pelo").
Lo único que necesitas
- Tu API key. La creas en tu panel con "+ Crear llave". Se muestra una sola vez, así que cópiala y guárdala.
- En tu plataforma de automatización, un paso de tipo "HTTP Request" / "Hacer una petición HTTP" (lo tienen n8n, Make, Zapier, Pipedream…).
- Cada PDF convertido a base64 antes de mandarlo (ver el paso a paso de abajo).
Los PDFs viajan dentro de un JSON, así que entre todos los archivos que fusiones no pueden superar unos 4 MB combinados. Para PDFs más grandes, redúcelos antes o fusiona en varias tandas.
Cómo usarlo en n8n (paso a paso)
En el nodo HTTP Request:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-merge - Send Headers: actívalo y añade dos:
x-api-key= tu llave, yContent-Type=application/json - Send Body: actívalo → Body Content Type: JSON →
{ "files": ["<base64 del primer PDF>", "<base64 del segundo PDF>"], "output": "binary" } - En Options → Response → Response Format: elige File (porque pediste
output: "binary")
Si el PDF te llega como archivo binario de un paso anterior (por ejemplo de Google Drive o de un email), conviértelo a base64 con un nodo Code y la expresión {{'{{'}}$binary.data.toString('base64'){{'}}'}}, o con el nodo Move Binary Data en modo "Binary to Property".
En Make (módulo HTTP → Make a request): mismo método y URL, Headers las dos cabeceras, Body type: Raw, Content type: JSON (application/json), y en Request content el mismo JSON con el array files. El módulo "Get a file" de Make ya te da el contenido en base64 directamente.
En resumen: POST a …/pdf-merge, cabeceras x-api-key y Content-Type: application/json, cuerpo JSON con files (array de PDFs en base64) y output: "binary", Response Format en File.
Opciones (dentro del JSON)
| Opción | Por defecto | Para qué sirve |
|---|---|---|
files | — | Obligatorio. Array de 2 a 20 PDFs en base64, en el orden en que quieres fusionarlos. |
output | json | Pon binary para recibir el PDF directamente en vez de en base64. |
Resumen de la API
- Endpoint:
POST https://api.cofferdock.com/pdf-merge - Auth: cabecera
x-api-key: TU_LLAVE. - Entrada: SOLO
application/json—{ "files": ["<base64>", ...] }, de 2 a 20 ficheros. No hay modo "a pelo" (no cabe más de un fichero en ese modo). - Salida: por defecto JSON con el PDF en base64; con
"output": "binary"devuelve el binario (application/pdf) directamente. - Límites: el JSON completo (todos los ficheros en base64 juntos) tiene un tope de 6 MB, es decir, unos 4 MB reales de PDF combinados entre todos los archivos. 30 peticiones/min por IP. 1 fusión = 1 crédito, sin importar cuántos ficheros combines.
Opciones
| Opción | Por defecto | Descripción |
|---|---|---|
files | — | Obligatorio. Array de 2 a 20 strings en base64. |
output | json | json (base64) o binary (PDF crudo). |
Ejemplos
curl (codifica dos PDFs en base64 y fusiónalos):
B64_1=$(base64 -w0 archivo1.pdf)
B64_2=$(base64 -w0 archivo2.pdf)
curl -X POST "https://api.cofferdock.com/pdf-merge" \
-H "x-api-key: TU_LLAVE" \
-H "Content-Type: application/json" \
-d "{\"files\":[\"$B64_1\",\"$B64_2\"],\"output\":\"binary\"}" \
-o fusionado.pdf
JavaScript (Node 18+):
const fs = require('fs');
const files = ['archivo1.pdf', 'archivo2.pdf'].map((f) => fs.readFileSync(f).toString('base64'));
const r = await fetch('https://api.cofferdock.com/pdf-merge', {
method: 'POST',
headers: { 'x-api-key': 'TU_LLAVE', 'Content-Type': 'application/json' },
body: JSON.stringify({ files, output: 'binary' }),
});
const buffer = Buffer.from(await r.arrayBuffer());
fs.writeFileSync('fusionado.pdf', buffer);
Python:
import base64, requests
files = [base64.b64encode(open(f, 'rb').read()).decode() for f in ['archivo1.pdf', 'archivo2.pdf']]
r = requests.post(
'https://api.cofferdock.com/pdf-merge',
headers={'x-api-key': 'TU_LLAVE', 'Content-Type': 'application/json'},
json={'files': files, 'output': 'binary'},
)
open('fusionado.pdf', 'wb').write(r.content)
Respuesta por defecto (JSON con base64)
Sin output, la respuesta trae el PDF fusionado en base64:
{ "files": ["JVBERi0xLjQ…", "JVBERi0xLjQ…"] }
→ { "success": true, "pdf": "JVBERi0xLjQ…", "mime_type": "application/pdf",
"meta": { "files_merged": 2, "total_pages": 7, "used": 12, "remaining": 488 } }
Lo que recibes
Por defecto, un JSON con el PDF fusionado en base64 y datos como el número total de páginas. Con "output": "binary" recibes el PDF directamente, listo para guardar o enviar.
Merge PDFs
Merge PDFs is an API that combines several PDFs into one, in the order you send them. Great for joining invoices, attachments or reports into a single file from n8n, Make or Zapier, with no servers to maintain.
How it works
You send two or more PDFs (base64-encoded, inside a JSON body) and get back a single PDF with every page from all of them, in the same order you sent them. Nothing is stored: the PDF is generated on the fly.
Unlike the other PDF tools, this one needs several files at once, so it only accepts a JSON body (there's no "paste the raw PDF" mode).
All you need
- Your API key. Create it in your dashboard with "+ Create key". It's shown only once, so copy and save it.
- In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream… all have one).
- Each PDF converted to base64 before sending it (see the step-by-step below).
The PDFs travel inside a JSON body, so all the files you merge together can't add up to more than about 4 MB combined. For bigger PDFs, shrink them first or merge in batches.
How to use it in n8n (step by step)
In the HTTP Request node:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-merge - Send Headers: on → add two:
x-api-key= your key, andContent-Type=application/json - Send Body: on → Body Content Type: JSON →
{ "files": ["<first PDF base64>", "<second PDF base64>"], "output": "binary" } - Under Options → Response → Response Format: choose File (since you asked for
output: "binary")
If the PDF arrives as binary data from an earlier step (say, from Google Drive or an email), convert it to base64 with a Code node using {{'{{'}}$binary.data.toString('base64'){{'}}'}}, or with the Move Binary Data node in "Binary to Property" mode.
In Make (HTTP → Make a request module): same method and URL, Headers with the two headers, Body type: Raw, Content type: JSON (application/json), and the same JSON with the files array in Request content. Make's "Get a file" module already gives you base64 content directly.
In short: POST to …/pdf-merge, headers x-api-key and Content-Type: application/json, a JSON body with files (array of base64 PDFs) and output: "binary", Response Format as File.
Options (inside the JSON)
| Option | Default | What it does |
|---|---|---|
files | — | Required. Array of 2 to 20 base64 PDFs, in the order you want them merged. |
output | json | Set to binary to receive the PDF directly instead of base64. |
API overview
- Endpoint:
POST https://api.cofferdock.com/pdf-merge - Auth: header
x-api-key: YOUR_KEY. - Input:
application/jsonONLY —{ "files": ["<base64>", ...] }, 2 to 20 files. There's no raw mode (more than one file doesn't fit in it). - Output: JSON with the base64 PDF by default; with
"output": "binary"it returns the binary (application/pdf) directly. - Limits: the full JSON body (all base64 files together) is capped at 6 MB, meaning about 4 MB of real combined PDF across all files. 30 requests/min per IP. 1 merge = 1 credit, no matter how many files you combine.
Options
| Option | Default | Description |
|---|---|---|
files | — | Required. Array of 2 to 20 base64 strings. |
output | json | json (base64) or binary (raw PDF). |
Examples
curl (base64-encode two PDFs and merge them):
B64_1=$(base64 -w0 file1.pdf)
B64_2=$(base64 -w0 file2.pdf)
curl -X POST "https://api.cofferdock.com/pdf-merge" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d "{\"files\":[\"$B64_1\",\"$B64_2\"],\"output\":\"binary\"}" \
-o merged.pdf
JavaScript (Node 18+):
const fs = require('fs');
const files = ['file1.pdf', 'file2.pdf'].map((f) => fs.readFileSync(f).toString('base64'));
const r = await fetch('https://api.cofferdock.com/pdf-merge', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ files, output: 'binary' }),
});
const buffer = Buffer.from(await r.arrayBuffer());
fs.writeFileSync('merged.pdf', buffer);
Python:
import base64, requests
files = [base64.b64encode(open(f, 'rb').read()).decode() for f in ['file1.pdf', 'file2.pdf']]
r = requests.post(
'https://api.cofferdock.com/pdf-merge',
headers={'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/json'},
json={'files': files, 'output': 'binary'},
)
open('merged.pdf', 'wb').write(r.content)
Default response (JSON with base64)
Without output, the response carries the merged PDF in base64:
{ "files": ["JVBERi0xLjQ…", "JVBERi0xLjQ…"] }
→ { "success": true, "pdf": "JVBERi0xLjQ…", "mime_type": "application/pdf",
"meta": { "files_merged": 2, "total_pages": 7, "used": 12, "remaining": 488 } }
What you get back
By default, a JSON object with the merged PDF in base64 plus data like the total page count. With "output": "binary" you get the PDF itself, ready to save or send.