Skip to content

Merge renders

Merges multiple renders into a single PDF.
A merge uses 1 API credit.

By default, the merged PDF will be returned directly in the response.
But if you pass the host parameter, the merged PDF will be uploaded to our servers and you will receive a URL in the response.

Parameters

ids array REQUIRED
The render ids of the renders that will be merged.

host boolean
If true, the merged PDF will be hosted in our servers and you will receive a URL in the response. Defaults to false.

Sample Request

Here’s a sample request to merge renders:

ENDPOINT
POST /v1/render/merge
REQUEST
fetch("https://api.templated.io/v1/render/merge", {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
ids: [
"render_id_1",
"render_id_2",
"render_id_3"
]
})
})
.then(response => response.blob())
.then(blob => {
// Handling the response
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = 'merged_renders.pdf'; // Set the download filename
// Trigger the download
document.body.appendChild(link);
link.click();
});

Response

The API returns the merged PDF file directly in the response body with the following headers:

  • Content-Type: application/pdf
  • Content-Disposition: attachment; filename="merged_renders.pdf"

The PDF file can be downloaded and saved directly from the response.

Note: Unlike other endpoints that return JSON, this endpoint streams the PDF binary data directly.