Skip to main content

Preview template HTML

Render any Smart Report template definition into a standalone HTML document completely in memory. No database record is created or updated, and Chromium is not launched during preview rendering, keeping response times fast for interactive template editors, CI verification checks, and AI design loops.

In headless and AI pipelines, use this endpoint to iterate on sections, reportTheme, margins, and verification score settings (score, scoreProfile, scoreScale) before persisting the template with Create a report template or Update a report template. If you render a themed or scored template without providing steps or results inside sampleData, the renderer automatically injects synthetic driver sample data so your preview stays complete.

Endpoint​

POST https://api.verifik.co/v2/smart-report-templates/preview-html

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>

Body​

This endpoint accepts preview/scoring helpers plus all public template design fields (sections, reportTheme, sampleData, margins, pageSize, orientation, pdfEngine, primaryColor, identityColor, pageBackgroundColor, logo, header, footer, legend, termsAndConditions, watermark, showPageNumbers, customFonts, etc.).

NameTypeRequiredDescription
namestringNoOptional report title shown in the preview header/metadata.
previewbooleanNoPreview mode toggle. Defaults to true.
scorebooleanNoEnable verification score computation and include verificationScore in the response.
scoreProfilestringNoScore profile ID from List score profiles. Maximum 64 characters.
scoreScalestringNoScore display scale: "unit" or "percent". Top-level preview helper; save under reportTheme.scoreScale when persisting.
themeTokensobjectNoCustom theme token overrides. Top-level preview helper; save under reportTheme.tokens when persisting.
scoreSettingsobjectNoScore presentation settings. Top-level preview helper; save under reportTheme (scoreEnabled, scoreProfile) when persisting.
sectionsobject[]NoArray of ReportSection blocks to render.
reportThemestring / objectNoTheme preset ID ("premium_dark", "light_cards", "editorial", "dashboard") or full reportTheme configuration object.
sampleDataobjectNoVerification sample payload (inputData, results, batchName, rowIndex). If omitted on themed/scored previews, a synthetic driver sample is injected.
pageSizestringNo"A4", "Letter", or "Legal". Defaults to "A4".
orientationstringNo"portrait" or "landscape". Defaults to "portrait".
marginsobjectNoMargin object `{ "top": 40, "right": 40, "bottom": 40, "left": 40 }`.

Request​

const fetch = require("node-fetch");

async function run() {
const res = await fetch(
"https://api.verifik.co/v2/smart-report-templates/preview-html",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
body: JSON.stringify({
name: "Driver Background Preview",
preview: true,
score: true,
scoreProfile: "cabify_driver",
scoreScale: "percent",
pageSize: "A4",
orientation: "portrait",
margins: { top: 40, right: 40, bottom: 40, left: 40 },
reportTheme: "light_cards",
sections: [
{
id: "sec-score",
type: "scoreGauge",
order: 0,
label: "Overall Score",
},
{
id: "sec-breakdown",
type: "categoryBreakdown",
order: 1,
label: "Category Breakdown",
},
],
}),
}
);

console.log(await res.json());
}

run();

Response​

{
"data": {
"html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\" />...</head><body>...</body></html>",
"verificationScore": {
"profile": "cabify_driver",
"scale": "percent",
"score": 92
}
}
}

Notes​

  • verificationScore is included in data only when verification scoring is active (score: true or enabled in reportTheme).
  • Because this endpoint renders purely in memory with no database write or Chromium launch, it is ideal for rapid layout iteration before calling Download template sample for final PDF pagination inspection.
  • When persisting a previewed design via Create a report template or Update a report template, place top-level preview helpers (scoreScale, themeTokens, scoreSettings) inside reportTheme (reportTheme.scoreScale, reportTheme.tokens, reportTheme.scoreEnabled/reportTheme.scoreProfile).