Skip to main content

Generate Smart Report PDF

Render a PDF for an existing SmartReport using either "puppeteer" or "pdfkit", optionally compute verificationScore, and receive the base64-encoded PDF buffer alongside downloadUrl and htmlUrl.

On success, this endpoint marks the report status: "generated", persists verificationScoreSummary when scoring is enabled, and emits the smart_batch_report_generated webhook. If PDF generation fails, the report is marked status: "failed" and the smart_batch_report_generation_failed webhook is emitted.

Endpoint​

POST https://api.verifik.co/v2/smart-reports/{id}/generate

This endpoint accepts JSON payloads up to 64 MB (to accommodate custom printHtml documents). It is also reachable through the Smart-Agent proxy at https://ai.verifik.co/v2/smart-reports/{id}/generate using your own per-client Authorization: Bearer <VERIFIK_JWT>. Shared x402 execution is blocked with 403 Forbidden.

Headers​

NameValueDescription
Content-Typeapplication/jsonRequest payload format (64 MB limit).
AuthorizationBearer <VERIFIK_JWT>Client-scoped JWT (authUser.clientId).

Parameters​

NameTypeRequiredDescription
idstringYesSmartReport ObjectId.

Body​

NameTypeRequiredDescription
enginestringNoPDF rendering engine: "pdfkit" or "puppeteer".
rowIndexnumberNoZero-based row index from the linked SmartBatch. Defaults to row 0.
printHtmlstringNoFull HTML string (max 64000000 characters) used for non-themed templates containing <html.
scorebooleanNoWhether to calculate verificationScore and store verificationScoreSummary on the report.
scoreProfilestringNoScoring profile identifier used when score is enabled. Max 64 characters.

Rendering and scoring behavior​

  • Default row selection: When rowIndex is omitted, generation defaults to row 0. Requesting an out-of-range row returns 409 Conflict (row_not_found).
  • Custom HTML (printHtml): When working with non-themed templates that provide full <html markup, pass printHtml (up to 64000000 characters).
  • Verification scoring: Set score: true (and optionally scoreProfile) to compute verificationScore, return it at the top level of the response, and save verificationScoreSummary on the SmartReport. Unknown profiles fail with 409 Conflict (unknown_score_profile).

Request​

import axios from "axios";

const run = async () => {
const id = "6801a2b3c4d5e6f7a8b9c0d1";
const { data } = await axios.post(
`https://api.verifik.co/v2/smart-reports/${id}/generate`,
{
engine: "puppeteer",
rowIndex: 0,
score: true,
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);

console.log({
status: data.data.status,
pdfSize: data.pdf.size,
downloadUrl: data.pdf.downloadUrl,
});
};

run();

Response​

{
"data": {
"_id": "6801a2b3c4d5e6f7a8b9c0d1",
"template": "6801a2b3c4d5e6f7a8b9c0d2",
"smartBatch": "6801a2b3c4d5e6f7a8b9c0d3",
"name": "Background Check - Applicant 42",
"status": "generated",
"pdfEngine": "puppeteer",
"pdfSize": 148320,
"generationDurationMs": 1840,
"generatedAt": "2026-11-24T20:00:04.000Z",
"verificationScoreSummary": {},
"rowIndex": 0,
"externalRefId": "applicant-42"
},
"pdf": {
"buffer": "JVBERi0xLjQK...",
"size": 148320,
"engine": "puppeteer",
"generationDurationMs": 1840,
"downloadUrl": "/v2/smart-reports/6801a2b3c4d5e6f7a8b9c0d1/download",
"htmlUrl": "/v2/smart-reports/6801a2b3c4d5e6f7a8b9c0d1/html"
},
"verificationScore": {}
}

Error codes​

StatusError Code / TypeCause
401UnauthorizedMissing or invalid JWT.
403ForbiddenShared x402 execution was attempted; use your own per-client JWT.
404not_foundReport ID does not exist or belongs to another client.
404template_not_foundLinked template could not be found.
404batch_not_foundLinked SmartBatch could not be found.
409MissingParameterJoi validation failed on one or more fields.
409row_not_foundThe requested rowIndex does not exist in the batch.
409unknown_score_profileThe requested scoreProfile is not recognized.
422UnprocessableEntityMongoose validation error.
500InternalServerErrorPDF rendering or internal processing failure (marks report "failed" and emits smart_batch_report_generation_failed).

Webhooks & MCP Integration​

  • Webhooks: Emits smart_batch_report_generated on successful PDF creation, or smart_batch_report_generation_failed if rendering errors occur (and updates status to "failed"). See Smart Reports Webhooks.
  • MCP Equivalent: AI agents can render a report PDF directly via the smart_report_generate_pdf MCP tool. See MCP and AI Agents.

Notes​

  • pdf.buffer contains the base64-encoded PDF bytes directly in the JSON response; if you prefer a binary PDF stream, call Download Smart Report PDF.
  • verificationScore is included in the response when score is enabled.