Skip to main content

Download template sample

Render a saved Smart Report template ({id}) into a binary PDF file and stream it directly in the HTTP response (Content-Type: application/pdf). You can provide sampleData in the request body, omit it to fall back to the template's saved sampleData, or supply pre-rendered printHtml.

In headless pipelines and CI verification suites, use this endpoint after iterating with Preview template HTML to inspect real Chromium or PDFKit pagination, custom fonts, watermarks, headers/footers, and page margins on disk before promoting the template to production SmartBatch runs. JSON request bodies up to 64MB are supported.

Endpoint​

POST https://api.verifik.co/v2/smart-report-templates/{id}/download-sample

The Smart-Agent proxy (https://ai.verifik.co) exposes the same /v2/... paths and requires your own Authorization: Bearer <VERIFIK_JWT> header.

Headers​

NameValue
Content-Typeapplication/json
Acceptapplication/json
AuthorizationBearer <VERIFIK_JWT>

Note: On a 200 response, the server returns Content-Type: application/pdf with Content-Disposition: attachment; filename="SmartReport_TemplateSample_<id>.pdf". Error responses (401, 404, 409) return JSON.

Parameters​

NameTypeRequiredDescription
idstringYesSmart Report template ObjectId.

Body​

Supports JSON payloads up to 64MB. All body fields are optional.

NameTypeRequiredDescription
sampleDataobjectNoSample payload (inputData, results, batchName, rowIndex). Falls back to template.sampleData if omitted.
printHtmlstringNoOptional pre-rendered HTML string to render directly to PDF.

Request​

Because a successful response returns raw binary PDF bytes rather than JSON, configure your HTTP client for binary output (responseType: "arraybuffer" / Buffer in Node.js, raw response bytes in PHP/Python/Go, or -o sample.pdf in cURL).

const fs = require("fs");
const axios = require("axios");

async function run() {
const id = "67c1f94b2d8a1c0012a4b301";
const res = await axios.post(
`https://api.verifik.co/v2/smart-report-templates/${id}/download-sample`,
{
sampleData: {
batchName: "Driver Onboarding Sample",
rowIndex: 0,
inputData: {
documentType: "CC",
documentNumber: "1020304050",
},
results: {
identity: {
fullName: "Mateo Rojas",
status: "active",
},
},
},
},
{
responseType: "arraybuffer",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);

const pdfBuffer = Buffer.from(res.data);
fs.writeFileSync("sample.pdf", pdfBuffer);
console.log(`Saved sample.pdf (${pdfBuffer.length} bytes)`);
}

run();

Response​

HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="SmartReport_TemplateSample_67c1f94b2d8a1c0012a4b301.pdf"

<binary PDF byte stream>

Notes​

  • Do not call res.json() on a 200 response from this endpoint; read the response as a binary buffer (arraybuffer / bytes / io.Copy) and write it to disk or object storage.
  • If you omit sampleData and printHtml (for example sending {}), the endpoint uses the sampleData saved on the template itself.
  • For fast iterative layout checks without full PDF generation, use Preview template HTML.