探测示例数据
检查 sampleData 核验负载,返回包含字段路径、值结构形态、推荐的 sectionType 选择、备选区块类型、建议表格列以及绑定建议的结构化映射。
在无头报告编排与 AI 智能体流水线中,可在从 获取模拟响应 获取负载或捕获 SmartBatch 行数据后立即调用此端点。你的 UI 或智能体无需猜测 dataPath 字符串或编写脆弱的 JSON 遍历逻辑,即可使用探测得到的 nodes 与 batch 元数据直接构建有效的 sections,或丰富传入 生成模板布局 的 prompt 上下文。遍历器最多检查至第 5 层深度和最多 600 个节点。
端点
POST https://api.verifik.co/v2/smart-report-templates/introspect
Smart-Agent 代理(https://ai.verifik.co)暴露了完全相同的 /v2/... 路径,并同样要求携带你自己的 Authorization: Bearer <VERIFIK_JWT> 请求头。
请求头
| 名称 | 值 |
|---|---|
| Content-Type | application/json |
| Accept | application/json |
| Authorization | Bearer <VERIFIK_JWT> |
请求体参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
sampleData | object | 是 | 示例核验负载,包含可选的 batchName(string)、rowIndex(number)、inputData(object)和 results(object)。 |
请求示例
- Node.js
- PHP
- Python
- Go
- cURL
const fetch = require("node-fetch");
async function run() {
const res = await fetch(
"https://api.verifik.co/v2/smart-report-templates/introspect",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
body: JSON.stringify({
sampleData: {
batchName: "Driver Onboarding",
rowIndex: 0,
inputData: {
documentType: "CC",
documentNumber: "1020304050",
},
results: {
identity: {
fullName: "Mateo Rojas",
status: "active",
},
fines: [
{ code: "C02", amount: 580000, status: "pending" },
],
},
},
}),
}
);
console.log(await res.json());
}
run();
<?php
$payload = [
"sampleData" => [
"batchName" => "Driver Onboarding",
"rowIndex" => 0,
"inputData" => [
"documentType" => "CC",
"documentNumber" => "1020304050",
],
"results" => [
"identity" => [
"fullName" => "Mateo Rojas",
"status" => "active",
],
"fines" => [
["code" => "C02", "amount" => 580000, "status" => "pending"],
],
],
],
];
$ch = curl_init("https://api.verifik.co/v2/smart-report-templates/introspect");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Accept: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
curl_close($ch);
import os
import requests
url = "https://api.verifik.co/v2/smart-report-templates/introspect"
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"sampleData": {
"batchName": "Driver Onboarding",
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1020304050",
},
"results": {
"identity": {
"fullName": "Mateo Rojas",
"status": "active",
},
"fines": [
{"code": "C02", "amount": 580000, "status": "pending"},
],
},
}
}
r = requests.post(url, json=payload, headers=headers)
print(r.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]interface{}{
"sampleData": map[string]interface{}{
"batchName": "Driver Onboarding",
"rowIndex": 0,
"inputData": map[string]interface{}{
"documentType": "CC",
"documentNumber": "1020304050",
},
"results": map[string]interface{}{
"identity": map[string]interface{}{
"fullName": "Mateo Rojas",
"status": "active",
},
"fines": []map[string]interface{}{
{"code": "C02", "amount": 580000, "status": "pending"},
},
},
},
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-report-templates/introspect", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
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 POST "https://api.verifik.co/v2/smart-report-templates/introspect" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"sampleData": {
"batchName": "Driver Onboarding",
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1020304050"
},
"results": {
"identity": {
"fullName": "Mateo Rojas",
"status": "active"
},
"fines": [
{ "code": "C02", "amount": 580000, "status": "pending" }
]
}
}
}'
响应示例
- 200
- 401
- 409
{
"data": {
"nodes": [
{
"path": "results.identity",
"shape": "object",
"sectionType": "keyValueGrid",
"alternatives": ["card", "table"],
"columns": [
{ "key": "fullName", "label": "Full Name" },
{ "key": "status", "label": "Status" }
],
"suggestion": {
"type": "keyValueGrid",
"dataPath": "results.identity"
}
},
{
"path": "results.fines",
"shape": "array",
"sectionType": "dataTable",
"alternatives": ["repeater", "table"],
"columns": [
{ "key": "code", "label": "Code" },
{ "key": "amount", "label": "Amount" },
{ "key": "status", "label": "Status" }
],
"suggestion": {
"type": "dataTable",
"dataPath": "results.fines"
}
}
],
"batch": [
{
"path": "inputData",
"shape": "object",
"sectionType": "keyValueGrid"
}
],
"count": 2,
"truncated": false
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "\"sampleData\" is required",
"code": "MissingParameter"
}
注意事项
- 遍历会在第
5层深度停止,且节点上限为600个。当超大负载触及该上限时,truncated为true。 - 此端点为只读且无状态;不会保存模板,也不会消耗核验积分。