获取配置批次统计
获取已认证客户账户下属于特定 BatchConfiguration 的所有 SmartBatch 记录的汇总执行统计信息。响应返回批次总数、行完成总数,以及按 "draft"、"pending"、"processing"、"completed"、"failed" 和 "cancelled" 划分的状态分布。
读取配置统计信息不会执行核验,也不会消耗积分。
接口
GET https://api.verifik.co/v2/smart-batches/stats/{configId}
此接口也可通过 Smart-Agent 代理 https://ai.verifik.co/v2/smart-batches/stats/{configId} 访问,需使用你自己的客户专属 Authorization: Bearer <VERIFIK_JWT>。共享 x402 执行会被拒绝并返回 403 Forbidden。
请求头
| 名称 | 值 | 描述 |
|---|---|---|
Content-Type | application/json | 请求载荷格式。 |
Authorization | Bearer <VERIFIK_JWT> | 客户作用域的 JWT(authUser.clientId)。 |
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
configId | string | 是 | 用于汇总批次统计信息的 BatchConfiguration ObjectId。 |
请求示例
- Node.js
- PHP
- Python
- Go
- cURL
import axios from "axios";
const run = async () => {
const configId = "6801a2b3c4d5e6f7a8b9c0d4";
const { data } = await axios.get(`https://api.verifik.co/v2/smart-batches/stats/${configId}`, {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
});
console.log(data);
};
run();
<?php
$configId = "6801a2b3c4d5e6f7a8b9c0d4";
$ch = curl_init("https://api.verifik.co/v2/smart-batches/stats/" . $configId);
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 = "6801a2b3c4d5e6f7a8b9c0d4"
url = f"https://api.verifik.co/v2/smart-batches/stats/{config_id}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
response = requests.get(url, headers=headers)
print(response.json())
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
configID := "6801a2b3c4d5e6f7a8b9c0d4"
req, _ := http.NewRequest("GET", "https://api.verifik.co/v2/smart-batches/stats/"+configID, 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 -X GET "https://api.verifik.co/v2/smart-batches/stats/6801a2b3c4d5e6f7a8b9c0d4" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT"
响应示例
- 200 OK
- 401
- 403
- 409
- 422
{
"data": {
"totalBatches": 4,
"totalRows": 120,
"completedRows": 95,
"failedRows": 5,
"partialRows": 4,
"pendingRows": 16,
"statusBreakdown": {
"draft": 0,
"pending": 1,
"processing": 1,
"completed": 2,
"failed": 0,
"cancelled": 0
}
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "\"configId\" is required",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
注意事项
- 统计信息仅限于已认证客户(JWT 中的
clientId)作用域。 pendingRows的计算方式为totalRows - completedRows - failedRows - partialRows。- 如需查看属于此配置的单个批次详情,可将
batchConfiguration传给列出 Smart Batch。