跳转到内容
EN

立即触发

立即触发一次并返回 Firing,仍受当前状态、补跑窗口和 overlap 约束;启动失败记在触发结果的 error 中。

POST /automation/v1/triggers/{trigger_id}/fire

鉴权

Authorization: Bearer $PRAXIS_API_KEY

请求字段

参数 类型 说明
path: trigger_id string 必填;触发器 ID(trg_)。
header: Idempotency-Key string 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256

示例

先设置以下环境变量,使用你自己的资源:

: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.com/automation/v1/triggers/{trigger_id}/fire" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{}'
import { createAutomationClient } from '@deepraxis/sdk/automation';

function env(name: string): string {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name}`);
  return value;
}
const automation = createAutomationClient({
  apiKey: env('PRAXIS_API_KEY'),
  baseUrl: 'https://api.deepraxis.com',
  maxRetries: 0,
  timeoutMs: 90_000,
});
const result = await automation.triggers.fire({
  "path": {
    "id": env("TRIGGER_ID")
  },
  "body": {}
});
console.log(result);

响应

HTTP 200

Success

响应头 类型 说明
Idempotent-Replayed boolean Present and true when replaying the first response for this key.

application/json

字段 类型 说明
id string 必填 / 必有;触发记录 ID;记录保留 30 天。
trigger_id string 必填 / 必有;所属触发器 ID(trg_ 前缀)。
scheduled_at string 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time"
fired_at string 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time"
outcome "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。
run_id string / null 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。
resolved_version string / null 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。
error object / null 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。
error(分支1).code string 必填 / 必有;失败的错误码。
error(分支1).message string 必填 / 必有;失败的说明文字。

实测响应

HTTP 200

{
  "id": "frg_00mvoxomtw54995b159460407fba5d4f6a87e4db0b",
  "trigger_id": "trg_00mvoxo8nl3301da1be1544fd9a8f7d48e115a8eea",
  "scheduled_at": "2026-10-26T07:27:07.146Z",
  "fired_at": "2026-10-26T07:27:07.146Z",
  "outcome": "started",
  "run_id": "run_00mvoxon6c87c9f20c270717963cb2e5aadb0b9632f90befb18b86bbeede86285c4a1e9e5c",
  "resolved_version": "1.0.0",
  "error": null
}

错误码

HTTP 错误码与说明
400 INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。
404 TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。
409 IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 RUN_INVALID_STATE:当前状态不允许执行该动作。
412 PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。
422 IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。
default RFC 9457 automation problem. 429 includes Retry-After.

鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。