获取报告模板
按 ObjectId({id})获取单个 Smart Report 模板。此接口会返回完整的模板定义,包括 sections、reportTheme、sampleData、页面布局设置,以及已填充的 batchConfiguration 与 client 引用。
在无头与 AI 工作流中,可在以 append 或 edit 模式调用 生成模板布局 之前使用此端点加载当前的 sections 数组、获取已保存的 sampleData 以便用于 预览模板 HTML,或在执行 PUT 更新前检查模板内容。出于安全性和负载体积考虑,此端点会排除 security.password 与 thumbnail.image 字段。
端点
GET https://api.verifik.co/v2/smart-report-templates/{id}
Smart-Agent 代理(https://ai.verifik.co)暴露了完全相同的 /v2/... 路径,并同样要求携带你自己的 Authorization: Bearer <VERIFIK_JWT> 请求头。
请求头
| 名称 | 值 |
|---|---|
| Accept | application/json |
| Authorization | Bearer <VERIFIK_JWT> |
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | string | 是 | Smart Report 模板 ObjectId。 |
请求示例
- Node.js
- PHP
- Python
- Go
- cURL
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: "GET",
headers: {
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);
console.log(await res.json());
}
run();
<?php
$id = "67c1f94b2d8a1c0012a4b301";
$ch = curl_init("https://api.verifik.co/v2/smart-report-templates/" . $id);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Accept: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import os
import requests
template_id = "67c1f94b2d8a1c0012a4b301"
url = f"https://api.verifik.co/v2/smart-report-templates/{template_id}"
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
r = requests.get(url, headers=headers)
print(r.json())
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
id := "67c1f94b2d8a1c0012a4b301"
req, _ := http.NewRequest("GET", "https://api.verifik.co/v2/smart-report-templates/"+id, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+os.Getenv("VERIFIK_JWT"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var out map[string]interface{}
json.NewDecoder(resp.Body).Decode(&out)
fmt.Println(out)
}
curl -X GET "https://api.verifik.co/v2/smart-report-templates/67c1f94b2d8a1c0012a4b301" \
-H "Accept: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT"
响应示例
- 200
- 200(未找到)
- 401
- 409
{
"data": {
"_id": "67c1f94b2d8a1c0012a4b301",
"name": "Colombia Driver Onboarding Report",
"description": "Themed driver verification report for fleet onboarding",
"client": {
"_id": "507f1f77bcf86cd799439013",
"name": "Acme Mobility"
},
"batchConfiguration": {
"_id": "67c1f8102d8a1c0012a4b210",
"name": "Colombia Driver Onboarding"
},
"country": "CO",
"category": "citizen",
"isActive": true,
"pageSize": "A4",
"layoutVersion": 2,
"orientation": "portrait",
"margins": {
"top": 40,
"right": 40,
"bottom": 40,
"left": 40
},
"pdfEngine": "puppeteer",
"primaryColor": "#4F46E5",
"identityColor": "#111827",
"pageBackgroundColor": "#ffffff",
"reportTheme": {
"id": "light_cards",
"scoreEnabled": true,
"scoreProfile": "cabify_driver",
"scoreScale": "percent"
},
"sections": [
{
"id": "sec-header",
"type": "header",
"order": 0,
"label": "Driver Verification Report"
}
],
"createdAt": "2026-09-10T03:32:00.000Z",
"updatedAt": "2026-09-10T03:35:12.000Z"
}
}
{
"data": null
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "\"id\" must be a valid ObjectId",
"code": "MissingParameter"
}
注意事项
- 当模板不存在或属于其他客户时,此端点返回 HTTP
200及{ "data": null },而非404。 - 返回文档中不包含
security.password与thumbnail.image。如需渲染或查看模板缩略图,请使用 列出报告模板。