获取配置输入模式
在提交数据行之前,解析已保存的 BatchConfiguration 所需的准确输入契约。此接口会返回 preferredReportTemplate(若未设置,则回退至关联到该配置的最新启用中 SmartReportTemplate)、webhookUrl、stepCount、estimatedCreditsPerRow、requiredFields、optionalFields、标准的 jsonSchema 以及可直接发送的 exampleInput 载荷。
解析器会自动跳过已禁用的步骤、未启用的 dependencyGroup 选项、内部标志,以及已通过 parameterDefaults 或 visitaFlow 步骤链({{results.N.field}})传入的字段,同时根据 inputFieldMapping 重新映射列名。该路由注册在 /{id} 之前,因此 /input-schema 会直接解析;同时它也作为 smart_report_get_input_schema MCP 工具提供。
接口
GET https://api.verifik.co/v2/batch-configurations/{id}/input-schema
也可以通过 Smart-Agent 代理 https://ai.verifik.co/v2/batch-configurations/{id}/input-schema 访问,并使用你自己的客户专属 Authorization: Bearer <VERIFIK_JWT> 请求头。共享 x402 执行会被拒绝并返回 403 Forbidden。
请求头
| 名称 | 值 |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <VERIFIK_JWT> |
令牌必须是客户 JWT。缺少凭证或凭证无效将返回 401 Unauthorized。
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
id | string | 是 | 要查看的 BatchConfiguration ObjectId。 |
请求示例
- Node.js
- PHP
- Python
- Go
- cURL
const fetch = require("node-fetch");
async function run() {
const id = "67d1b4a0e4f5a60718293b12";
const res = await fetch(`https://api.verifik.co/v2/batch-configurations/${id}/input-schema`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
});
console.log(await res.json());
}
run();
<?php
$id = "67d1b4a0e4f5a60718293b12";
$ch = curl_init("https://api.verifik.co/v2/batch-configurations/" . $id . "/input-schema");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: 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
config_id = "67d1b4a0e4f5a60718293b12"
url = f"https://api.verifik.co/v2/batch-configurations/{config_id}/input-schema"
headers = {
"Content-Type": "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 := "67d1b4a0e4f5a60718293b12"
req, _ := http.NewRequest("GET", "https://api.verifik.co/v2/batch-configurations/"+id+"/input-schema", nil)
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 -sS "https://api.verifik.co/v2/batch-configurations/67d1b4a0e4f5a60718293b12/input-schema" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT"
响应示例
- 200
- 401
- 403
- 404
{
"data": {
"configurationId": "67d1b4a0e4f5a60718293b12",
"name": "Colombia Citizen Essential",
"country": "CO",
"preferredReportTemplate": "67d1b4a1e4f5a60718293b15",
"webhookUrl": "https://example.com/webhooks/smart-reports",
"stepCount": 2,
"estimatedCreditsPerRow": 0.15,
"requiredFields": [
{
"field": "documentType",
"apiField": "documentType",
"type": "string",
"required": true,
"enum": ["CC", "CE"]
},
{
"field": "documentNumber",
"apiField": "documentNumber",
"type": "string",
"required": true
}
],
"optionalFields": [],
"jsonSchema": {
"type": "object",
"properties": {
"documentType": {
"type": "string",
"enum": ["CC", "CE"]
},
"documentNumber": {
"type": "string"
}
},
"required": ["documentType", "documentNumber"]
},
"exampleInput": {
"documentType": "CC",
"documentNumber": "123456789"
}
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Access forbidden",
"code": "Forbidden"
}
{
"message": "not_found",
"code": "NotFound"
}
注意事项
- 查看输入模式不会执行查询,也不会消耗积分。
- 如果配置上未设置
preferredReportTemplate,服务器将回退使用关联到{id}的最新启用中SmartReportTemplate(若不存在则为null)。 - 当
inputFieldMapping将输入列名映射为 API 参数时,requiredFields、optionalFields、jsonSchema和exampleInput将暴露映射后的输入列名,而非原始的 API 参数名。 - 不存在或跨客户的
{id}会返回404(not_found),这与返回200及data: null的查询批处理配置不同。 - 对于 AI 智能体和无头流水线,该接口对应于
smart_report_get_input_schemaMCP 工具。