更新 Smart Report
更新属于已认证客户的现有 SmartReport。只需发送你希望修改的字段;请求中省略的字段保持不变。
如果报告 ID 不存在或属于其他客户,该端点会返回 404 Not Found({ "message": "not_found", "code": "NotFound" })。
端点
PUT https://api.verifik.co/v2/smart-reports/{id}
使用你自己的每客户 Authorization: Bearer <VERIFIK_JWT>,也可通过 Smart-Agent 代理地址 https://ai.verifik.co/v2/smart-reports/{id} 访问此端点。共享 x402 执行会被拦截并返回 403 Forbidden。
请求头
| 名称 | 值 | 说明 |
|---|---|---|
Content-Type | application/json | 请求体负载格式。 |
Authorization | Bearer <VERIFIK_JWT> | 客户作用域 JWT(authUser.clientId)。 |
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | string | 是 | 要更新的 SmartReport ObjectId。 |
请求体参数
所有请求体字段均为可选;仅传入需要更新的属性即可。
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 报告显示名称。 |
status | string | 否 | 报告状态:"draft"、"generating"、"generated"、"sent" 或 "failed"。 |
pdfUrl | string | 否 | 已生成 PDF 产物的存储 URL。 |
pdfSize | number | 否 | 已生成 PDF 的字节大小。 |
htmlSnapshot | string | 否 | 已保存的渲染后报告 HTML 快照。 |
pageCount | number | 否 | 已生成 PDF 的页数。 |
pdfEngine | string | 否 | 渲染引擎:"pdfkit" 或 "puppeteer"。 |
generatedAt | string | 否 | 报告生成的 ISO 8601 时间戳。 |
generationDurationMs | number | 否 | PDF 生成耗时(毫秒)。 |
dataSnapshot | object | 否 | 用于该报告的行数据或输入数据快照。 |
externalRefId | string | 否 | 调用方关联标识符。 |
webhookUrl | string | 否 | 单份报告级别的 http 或 https Webhook 覆盖地址。 |
rowIndex | number | 否 | 与该报告关联的从零开始的行索引。 |
createdByChannel | string | 否 | 来源渠道:"portal"、"api"、"mcp"、"x402" 或 "webhook"。 |
verificationScoreSummary | object | 否 | 来自核验评分的摘要元数据。 |
error | object 或 string | 否 | 为失败状态记录的错误负载或错误消息。 |
请求示例
- Node.js
- PHP
- Python
- Go
- cURL
import axios from "axios";
const run = async () => {
const id = "6801a2b3c4d5e6f7a8b9c0d1";
const { data } = await axios.put(
`https://api.verifik.co/v2/smart-reports/${id}`,
{
name: "Background Check - Applicant 42 (Reviewed)",
externalRefId: "applicant-42-v2",
webhookUrl: "https://webhooks.example.com/verifik",
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);
console.log(data);
};
run();
<?php
$id = "6801a2b3c4d5e6f7a8b9c0d1";
$ch = curl_init("https://api.verifik.co/v2/smart-reports/" . $id);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"name" => "Background Check - Applicant 42 (Reviewed)",
"externalRefId" => "applicant-42-v2",
"webhookUrl" => "https://webhooks.example.com/verifik",
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import os
import requests
report_id = "6801a2b3c4d5e6f7a8b9c0d1"
url = f"https://api.verifik.co/v2/smart-reports/{report_id}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"name": "Background Check - Applicant 42 (Reviewed)",
"externalRefId": "applicant-42-v2",
"webhookUrl": "https://webhooks.example.com/verifik",
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
id := "6801a2b3c4d5e6f7a8b9c0d1"
body, _ := json.Marshal(map[string]interface{}{
"name": "Background Check - Applicant 42 (Reviewed)",
"externalRefId": "applicant-42-v2",
"webhookUrl": "https://webhooks.example.com/verifik",
})
req, _ := http.NewRequest("PUT", "https://api.verifik.co/v2/smart-reports/"+id, bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+os.Getenv("VERIFIK_JWT"))
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var out map[string]interface{}
json.NewDecoder(resp.Body).Decode(&out)
fmt.Println(out)
}
curl -X PUT "https://api.verifik.co/v2/smart-reports/6801a2b3c4d5e6f7a8b9c0d1" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"name": "Background Check - Applicant 42 (Reviewed)",
"externalRefId": "applicant-42-v2",
"webhookUrl": "https://webhooks.example.com/verifik"
}'
响应示例
- 200 OK
- 401
- 403
- 404
- 409
- 422
{
"data": {
"_id": "6801a2b3c4d5e6f7a8b9c0d1",
"template": "6801a2b3c4d5e6f7a8b9c0d2",
"smartBatch": "6801a2b3c4d5e6f7a8b9c0d3",
"name": "Background Check - Applicant 42 (Reviewed)",
"status": "generated",
"externalRefId": "applicant-42-v2",
"webhookUrl": "https://webhooks.example.com/verifik",
"rowIndex": 0,
"createdByChannel": "api",
"createdAt": "2026-11-24T20:00:00.000Z",
"updatedAt": "2026-11-24T20:05:00.000Z"
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "not_found",
"code": "NotFound"
}
{
"message": "\"status\" must be one of [draft, generating, generated, sent, failed]",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
Webhooks 与 MCP 集成
- 更新
webhookUrl或externalRefId后,后续的 生成 Smart Report PDF 与 通过邮件发送 Smart Report 调用将采用新的回调 URL 与关联 ID。详见 SmartReports Webhooks。 - 如需通过 AI 智能体查看更新后的记录或执行无头报告操作,请参阅 MCP 与 AI 智能体。
注意事项
- 更新
SmartReport仅会更新已存储的报告字段,不会自动重新生成 PDF 或发送邮件。当需要重新渲染或投递时,请调用 生成 Smart Report PDF 或 通过邮件发送 Smart Report。