删除报告模板
删除归属于已认证客户的自定义 Smart Report 模板。被删除的模板文档会在 { "data": ... } 中返回。
在无头工作流与自动化测试流水线中,可使用此端点清理临时模板或下线已弃用的报告设计。内置的 "System" 模板不可删除,将返回 403(system_template_readonly)。删除模板不会消耗积分,也不会移除此前已生成的 SmartBatch 报告。
端点
DELETE 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: "DELETE",
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_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Accept: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
curl_close($ch);
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.delete(url, headers=headers)
print(r.json())
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
id := "67c1f94b2d8a1c0012a4b301"
req, _ := http.NewRequest("DELETE", "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 DELETE "https://api.verifik.co/v2/smart-report-templates/67c1f94b2d8a1c0012a4b301" \
-H "Accept: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT"
响应示例
- 200
- 401
- 403
- 404
- 409
{
"data": {
"_id": "67c1f94b2d8a1c0012a4b301",
"client": "507f1f77bcf86cd799439013",
"name": "Colombia Driver Onboarding Report v2",
"country": "CO",
"category": "citizen",
"isActive": true
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "system_template_readonly",
"code": "Forbidden"
}
{
"message": "not_found",
"code": "NotFound"
}
{
"message": "\"id\" must be a valid ObjectId",
"code": "MissingParameter"
}
注意事项
- 内置
"System"模板不可删除(返回403system_template_readonly)。 - 删除后,后续针对同一
{id}发起的GET、PUT或DELETE请求将分别返回{ "data": null }(GET)或404not_found(PUT/DELETE)。