Skip to main content

获取 Smart Report HTML

获取 SmartReport 渲染后的 HTML,以及关联的 batchId、templateId、rowIndex、可选的 verificationScore 和对应的 row 负载(rowIndex、status、inputData、results、errors)。

重要提示:此端点返回的响应头为 Content-Type: application/json,并将 HTML 字符串放在 data.html 字段中,而不会直接返回原始 text/html 文档。

端点​

GET https://api.verifik.co/v2/smart-reports/{id}/html

使用你自己的每客户 Authorization: Bearer <VERIFIK_JWT>,也可通过 Smart-Agent 代理地址 https://ai.verifik.co/v2/smart-reports/{id}/html 访问此端点。共享 x402 执行会被拦截并返回 403 Forbidden。

请求头​

名称值说明
Acceptapplication/jsonJSON 信封响应格式。
AuthorizationBearer <VERIFIK_JWT>客户作用域 JWT(authUser.clientId)。

参数​

名称位置类型必填说明
idpathstring是SmartReport ObjectId。
rowIndexqueryinteger否从零开始的行索引(>= 0)。
previewqueryboolean否为 true 时以预览模式渲染。
scorequeryboolean否是否计算并在 data 中包含 verificationScore。
scoreProfilequerystring否启用 score 时使用的评分配置标识符(最长 64 个字符)。

请求示例​

import axios from "axios";

const run = async () => {
const id = "6801a2b3c4d5e6f7a8b9c0d1";
const { data } = await axios.get(`https://api.verifik.co/v2/smart-reports/${id}/html`, {
params: {
rowIndex: 0,
preview: false,
score: true,
},
headers: {
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
});

console.log({
reportId: data.data.reportId,
htmlLength: data.data.html.length,
rowStatus: data.data.row?.status,
});
};

run();

响应示例​

{
"data": {
"reportId": "6801a2b3c4d5e6f7a8b9c0d1",
"batchId": "6801a2b3c4d5e6f7a8b9c0d3",
"templateId": "6801a2b3c4d5e6f7a8b9c0d2",
"rowIndex": 0,
"html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\" /></head><body><h1>Verification Report</h1></body></html>",
"verificationScore": {},
"row": {
"rowIndex": 0,
"status": "completed",
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359"
},
"results": {},
"errors": []
}
}
}

错误码说明​

状态码错误码 / 类型原因
401UnauthorizedJWT 缺失或无效。
403Forbidden尝试使用共享 x402 执行;请改用你自己的每客户 JWT。
404not_found报告 ID 不存在或属于其他客户。
404template_not_found无法找到关联的模板。
409MissingParameter查询参数或路径参数未通过 Joi 校验。
409row_not_found所请求的 rowIndex 在批次中不存在。
409unknown_score_profile所提供的 scoreProfile 未被识别。
422UnprocessableEntityMongoose 校验错误。

Webhooks 与 MCP 集成​

注意事项​

  • 由于 HTTP 响应采用 application/json,在将其嵌入 WebView、iframe 或 PDF 渲染器之前,请先从 JSON 负载中提取 data.html。
  • 传入 score=true 时响应中会包含 data.verificationScore。
  • 如果当前上下文没有关联任何批次行对象,data.row 将为 null。

相关页面​