Skip to main content

更新报告模板

更新属于你客户账户的自定义 Smart Report 模板。可发送任意需要更新的元数据、布局 sections、reportTheme、sampleData 或 PDF 渲染选项的子集;请求负载中省略的字段将保留其原有值。

在无头与 AI 流水线中,可使用此端点迭代由 生成模板布局 产出的布局、刷新品牌资源(logo、primaryColor、customFonts)、更新 SmartBatch 绑定关系,或切换 isActive 状态。内置的 "System" 模板为只读,若将其作为目标将返回 403(system_template_readonly)。

端点​

PUT https://api.verifik.co/v2/smart-report-templates/{id}

Smart-Agent 代理(https://ai.verifik.co)暴露了完全相同的 /v2/... 路径,并同样要求携带你自己的 Authorization: Bearer <VERIFIK_JWT> 请求头。

请求头​

名称值
Content-Typeapplication/json
Acceptapplication/json
AuthorizationBearer <VERIFIK_JWT>

参数​

名称类型必填说明
idstring是Smart Report 模板 ObjectId。

请求体参数​

更新时所有请求体字段均为可选。

名称类型必填说明
namestring否更新后的模板显示名称。最多 150 个字符。
descriptionstring否更新后的模板描述。最多 500 个字符。
batchConfigurationstring否关联 SmartBatch 配置的 ObjectId。
countrystring否国家标识符或标签。最多 60 个字符。
categorystring否核验领域:"citizen"、"company" 或 "vehicle"。
isActiveboolean否启用或停用该模板。
logostring否品牌 Logo URL 或 base64 Data URI。
primaryColorstring否主品牌强调色十六进制颜色。
identityColorstring否次要/身份识别强调色十六进制颜色。
pageBackgroundColorstring否页面背景十六进制颜色。
headerobject否自定义页眉布局与内容配置。
footerobject否自定义页脚布局与内容配置。
legendstring否页脚说明文字或合规声明文本。最多 2000 个字符。
legendPositionstring否说明文字对齐方式:"left"、"center" 或 "right"。
termsAndConditionsstring否法律条款与条件文本。最多 4000 个字符。
termsPositionstring否条款对齐方式:"left"、"center" 或 "right"。
sectionsobject[]否ReportSection 对象数组(id、type、order、dataPath、label、staticContent、columns、columnsPerRow、keyOverrides、valueRules、chartKind、style、condition、frame 等)。
pageSizestring否PDF 纸张尺寸:"A4"、"Letter" 或 "Legal"。
layoutVersioninteger否布局渲染器版本:1 或 2。
orientationstring否页面方向:"portrait" 或 "landscape"。
marginsobject否页边距对象 `{ "top": 40, "right": 40, "bottom": 40, "left": 40 }`。
pdfEnginestring否PDF 渲染引擎:"puppeteer" 或 "pdfkit"。
showPageNumbersboolean否在渲染后的 PDF 上显示页码。
pageNumberPositionstring否页码位置:"top-left"、"top-center"、"top-right"、"bottom-left"、"bottom-center" 或 "bottom-right"。
pageNumberDividerboolean / string否页码分隔符配置。
watermarkobject否水印叠加设置。
securityobject否PDF 保护设置 `{ "enabled": true, "password": "..." }`。传入 "******" 或省略 password 将保留现有的加密密码。
signatureobject否签名区块配置。
logoSettingsobject否Logo 尺寸与摆放配置。
sheetImagesobject[]否嵌入的模板图片资源。最多 12 项。
customFontsobject[]否自定义字体声明(Google Fonts、外部 URL 或上传文件)。最多 6 项。
headerLogosobject[]否显示在页眉中的附加 Logo。最多 16 项。
bodyTopPaddingnumber否应用于文档正文的顶部内边距,范围 0 到 600。
sampleDataobject否与模板一起保存的示例核验负载,用于预览与示例下载。
endpointDesignobject否特定于端点的展示元数据。
reportThemestring / object否主题预设 ID("premium_dark"、"light_cards"、"editorial"、"dashboard")或主题配置对象(id、scoreScale、scoreEnabled、scoreProfile、locale、density、eyebrow、coverTitle、headlines、legalNote、showVerifiedBadge、showWeights、showDeductions、showFields、showHowItWorks、blocks、tokens)。

请求示例​

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

async function run() {
const id = "67c1f94b2d8a1c0012a4b301";
const res = await fetch(
`https://api.verifik.co/v2/smart-report-templates/${id}`,
{
method: "PUT",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
body: JSON.stringify({
name: "Colombia Driver Onboarding Report v2",
primaryColor: "#0F766E",
isActive: true,
security: {
enabled: true,
password: "******",
},
reportTheme: {
id: "light_cards",
scoreEnabled: true,
scoreProfile: "cabify_driver",
scoreScale: "percent",
density: "compact",
},
}),
}
);

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

run();

响应示例​

{
"data": {
"_id": "67c1f94b2d8a1c0012a4b301",
"client": "507f1f77bcf86cd799439013",
"name": "Colombia Driver Onboarding Report v2",
"primaryColor": "#0F766E",
"isActive": true,
"security": {
"enabled": true
},
"reportTheme": {
"id": "light_cards",
"scoreEnabled": true,
"scoreProfile": "cabify_driver",
"scoreScale": "percent",
"density": "compact"
},
"updatedAt": "2026-09-10T04:10:00.000Z"
}
}

注意事项​

  • 传入 security.password: "******" 或省略 security.password 会保留模板原有的加密密码,而不是覆盖它。
  • 内置 "System" 模板不可更新(返回 403 system_template_readonly)。如需自定义系统起步模板,请通过 创建报告模板 创建自定义副本。
  • 保存更改时,请将预览辅助字段(scoreScale、themeTokens、scoreSettings)放入 reportTheme(scoreScale、tokens、scoreEnabled/scoreProfile)中。

相关页面​