列出执行记录
GET /v1/executions——决策最近的运行,包含回答、行动、原因和指标,可按决策和状态筛选,并使用游标分页。从不返回输入。
GET https://api.dcision.io/v1/executions按从新到旧的顺序列出 API 密钥所属工作区的执行记录:每次运行的回答、行动和原因、目的地、状态和错误码以及指标。用它来监控部署、把结果导出到你的数据仓库,或根据实际发生的情况校准阈值。
从不返回输入
一次运行的状态可能包含个人数据,因此此端点从不返回它。工作区成员可以在应用的执行记录页面中查看已存储的输入。
请求
查询参数
| 参数 | 说明 |
|---|---|
limit | 每页执行记录数,1 到 100。默认 20。 |
decision | 仅返回此 slug 对应决策的执行记录。 |
status | success 或 error。 |
cursor | 上一页的 next_cursor,用于读取下一页。 |
无效的值会以 400 INVALID_REQUEST 失败——例如 limit=1000 或格式错误的 cursor。
curl "https://api.dcision.io/v1/executions?decision=lead-qualification&status=error&limit=50" \
-H "Authorization: Bearer $DCISION_API_KEY"响应
{
"data": [
{
"execution_id": "exec_8HsT2kQw9ZyR4vMn1cXe",
"decision": "lead-qualification",
"version": 1,
"source": "api",
"status": "success",
"error_code": null,
"result": { "purchase_intent": 0.9412, "priority": "high", "route": "sales" },
"confidence": { "purchase_intent": 0.8824, "priority": 0.69, "route": 0.85 },
"action": "continue",
"action_reason": { "type": "default" },
"destinations": [
{ "key": "sales_crm", "type": "workflow", "status": "queued", "delivery_id": "dlv_8kJx2mQp4LzN7vR1tY6w" }
],
"metrics": { "latency_ms": 412, "engine": "jev", "model": "jev-1.13.0", "estimated_cost_usd": 0.00001575 },
"created_at": "2026-10-05T14:03:27.512Z"
},
{
"execution_id": "exec_2Lm7Qw4Xz9Tk1Rb6Vn3C",
"decision": "lead-qualification",
"version": 1,
"source": "api",
"status": "error",
"error_code": "INVALID_STATE",
"result": null,
"confidence": null,
"action": null,
"action_reason": null,
"destinations": null,
"metrics": { "latency_ms": 2, "engine": "jev", "model": null, "estimated_cost_usd": 0 },
"created_at": "2026-10-05T14:01:09.880Z"
}
],
"next_cursor": "exec_2Lm7Qw4Xz9Tk1Rb6Vn3C"
}| 字段 | 类型 | 说明 |
|---|---|---|
data | array | 本页的执行记录,从新到旧。 |
data[].execution_id | string | 运行的 ID——其响应返回的 execution_id。 |
data[].decision | string | 决策的 slug。 |
data[].version | integer 或 null | 运行的版本;Playground 运行使用草稿,为 null。 |
data[].source | string | api、webhook(对决策 webhook URL 的调用)或 playground。 |
data[].status | string | success 或 error。 |
data[].error_code | string 或 null | 失败运行的错误码。 |
data[].result | object 或 null | 按问题为键的回答。失败的运行以及决策的 storeOutput 关闭时为 null。 |
data[].confidence | object 或 null | 每个回答的置信度,规则与 result 相同。 |
data[].action | string 或 null | 返回的行动;失败的运行为 null。 |
data[].action_reason | object 或 null | 选择该行动的原因。 |
data[].output | object | 本次运行的结构化输出——仅当构建了结构化输出且决策的 storeOutput 开启时才存在。 |
data[].destinations | array 或 null | 本次运行返回的目的地条目——回复、LLM 和智能体回答、函数、带 delivery_id 的排队投递、被跳过的目的地。没有触发任何目的地时为 null。排队的条目保留运行作答时的状态:投递的进度在应用中查看。 |
data[].metrics | object | 本次运行的 latency_ms、engine、model 和 estimated_cost_usd。 |
data[].created_at | string | 运行发生的时间,ISO 8601。 |
next_cursor | string 或 null | 作为 cursor 传入以读取下一页;最后一页为 null。 |
失败的运行也会被列出——无效的状态、引擎错误——这样你就能看到你的集成发送了什么。以引擎错误 fallback 作答的运行会以 error 状态和引擎的错误码出现,尽管调用本身返回了 200。
只会列出仍在你的日志保留期内的执行记录。
目的地条目可能包含个人数据
状态本身从不返回,但 destinations 会按运行返回时的样子保存——不论决策的 storeInput 和 storeOutput 设置如何:包括从状态映射的函数参数、固定回复、LLM 文本和智能体回答。结构化输出是例外:storeOutput 关闭时其对象会被清空。只把你的代码需要的值映射到参数中。
分页
async function* executions(params = {}) {
let cursor;
do {
const query = new URLSearchParams({ limit: "100", ...params, ...(cursor ? { cursor } : {}) });
const page = await fetch(`https://api.dcision.io/v1/executions?${query}`, {
headers: { Authorization: `Bearer ${process.env.DCISION_API_KEY}` },
}).then((response) => response.json());
yield* page.data;
cursor = page.next_cursor;
} while (cursor);
}
for await (const run of executions({ decision: "voice-banking", status: "success" })) {
console.log(run.created_at, run.result?.intent, run.confidence?.intent, run.action);
}错误
| 状态码 | 代码 | 何时 |
|---|---|---|
| 400 | INVALID_REQUEST | 查询参数无效:limit 超出 1–100、格式错误的 decision slug、status 或 cursor。 |
| 401 | INVALID_API_KEY | 密钥缺失、格式错误、未知或已被撤销。 |
| 429 | RATE_LIMITED | 当前分钟内的读取请求过多。 |
GET /v1/executions 与 GET /v1/me 共享读取的速率限制窗口,与决策分开。一个密钥只能看到其所属工作区的执行记录。