メインコンテンツへスキップ
POST /api/v1/forward/schedules 1 つの Identity、1 つの Template、初期入力イベント、トリガーポリシー、実行ポリシーを束ねる Schedule を作成します。各トリガーは個別の Schedule Run を作成します。

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT>
Content-TypeYesapplication/json
Idempotency-KeyNo安全でないリクエスト向けの任意のべき等キー。

Body parameters

ParameterTypeRequiredDescription
identity_idstringYesSchedule を所有する Forward Identity ID。
template_idstringYes実行する Forward Template ID。
namestringYesSchedule 名。
descriptionstringNoSchedule の説明。
initial_eventsarrayYes各実行時に注入されるイベント。現在の設計では user.message をサポートします。
executionobjectNo実行ポリシー。省略時はデフォルトが適用されます。
trigger_policyobject|nullNoトリガーポリシー。省略または null の場合は {"type":"manual"} になります。
environment_idstringYes実行環境。
metadataobjectNoラベルまたはパススルーデータ専用のカスタムメタデータ。

Trigger policy

trigger_policy は型付きオブジェクトです。作成および更新リクエストでは、設定フィールドである typeexpressiontimezone のみを受け付けます。upcoming_runs_atlast_run_at は Forward が算出するレスポンス専用フィールドです。
FieldTypeRequiredDescription
typestringYescrononceinterval、または manual
expressionstringConditionalトリガー式。crononceinterval では必須。manual では不要です。
timezonestringConditionalAsia/Shanghai などの IANA タイムゾーン。cron では必須。once では expression にオフセットがない場合のみ必須。intervalmanual では任意です。
upcoming_runs_atarrayResponse onlyUTC ISO 8601 形式の今後のトリガー時刻。現在の実装では [] または次回の予定時刻のみを返します。
last_run_atstring|nullResponse only直近のトリガー時刻。
typeRequired inputDescription
crontype, expression, timezone指定した IANA タイムゾーンで 5 フィールドの cron 式に従って繰り返します。
oncetype, expression, optional timezoneISO 8601 時刻に 1 回実行します。式にオフセットがない場合は timezone が必須です。
intervaltype, expressionPT15M などの ISO 8601 期間に従って繰り返します。
manualtype自動的には実行されません。Run Schedule エンドポイントでトリガーします。
typeexpression formatExampleNotes
cron標準の 5 フィールド cron0 9 * * *分単位のカレンダースケジュール。秒および 6 フィールドの cron はサポートされません。
onceISO 8601 絶対時刻2026-06-23T09:00:00 または 2026-06-23T01:00:00Z1 回実行します。対象時刻は少なくとも 1 分先である必要があります。
intervalISO 8601 期間PT15MPT1HP1D固定間隔スケジュール。最小間隔は 1 分です。
manual省略または空-スケジュール実行を作成しません。

Execution policy

FieldTypeDefaultDescription
session_modestringnew_sessionnew_session または reuse_session
max_concurrent_runsinteger1この Schedule の最大同時実行数。
max_attemptsinteger1予約済み。現在の実装では記録および検証されますが、実行は 1 回のみです。
timeout_msinteger3000001 回の試行のタイムアウト。
session_modeDescription
new_sessionトリガーごとに新しい実行 Session を作成します。以前のコンテキストは再利用されません。
reuse_sessionForward がこの Schedule 用に固定された 1 つの実行 Session を管理し、トリガー間で再利用します。呼び出し側が任意の既存 session_id を指定することはできません。

Example request

curl -s -X POST 'https://api.qoder.com/api/v1/forward/schedules' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "identity_id": "idn_019eabc123",
    "template_id": "tmpl_support",
    "name": "Daily tech brief",
    "description": "Generate a daily technology news summary",
    "initial_events": [
      {
        "type": "user.message",
        "content": "Summarize current technology news in five bullet points."
      }
    ],
    "trigger_policy": {
      "type": "cron",
      "expression": "0 9 * * *",
      "timezone": "Asia/Shanghai"
    },
    "execution": {
      "session_mode": "new_session",
      "max_concurrent_runs": 1,
      "max_attempts": 1,
      "timeout_ms": 300000
    },
    "environment_id": "env_019e64e01a137caf953ac2ac7b42ec5c"
  }'

Example response

HTTP 200 OK
{
  "id": "sched_019f00112233445566778899aabbccdd",
  "identity_id": "idn_019eabc123",
  "template_id": "tmpl_support",
  "name": "Daily tech brief",
  "description": "Generate a daily technology news summary",
  "status": "active",
  "paused_reason": null,
  "initial_events": [
    {
      "type": "user.message",
      "content": "Summarize current technology news in five bullet points."
    }
  ],
  "execution": {
    "session_mode": "new_session",
    "max_concurrent_runs": 1,
    "max_attempts": 1,
    "timeout_ms": 300000
  },
  "trigger_policy": {
    "type": "cron",
    "expression": "0 9 * * *",
    "timezone": "Asia/Shanghai",
    "upcoming_runs_at": ["2026-06-23T01:00:00Z"]
  },
  "environment_id": "env_019e64e01a137caf953ac2ac7b42ec5c",
  "sinks": [],
  "metadata": {},
  "archived_at": null,
  "created_at": "2026-06-22T10:00:00Z",
  "updated_at": "2026-06-22T10:00:00Z"
}

Errors

HTTPTypeCodeTrigger
400invalid_request_errorinvalid_trigger_policyトリガーポリシーの type または expression が無効です。
400invalid_request_errortrigger_policy_too_frequentトリガー間隔が 1 分未満です。
400invalid_request_errortrigger_policy_time_too_soononce の対象時刻が近すぎます。
400invalid_request_errorunsupported_sinks_inputリクエストボディに sinks が含まれています。
404not_found_erroridentity_not_foundIdentity が存在しません。
404not_found_errortemplate_not_foundTemplate が存在しません。

Notes

  • HTTP 作成リクエストでは sinks を受け付けません。API で直接作成したスケジュールは sinks: [] を返します。
  • manual スケジュールは POST /api/v1/forward/schedules/{schedule_id}/run でのみトリガーできます。
  • once スケジュールは、最初の予定実行が終了状態に達すると自動的にアーカイブされます。

スケジュールを実行する

スケジュールを一覧表示する