All Products
Search
Document Center

Qoder CN Series:Create a schedule

Last Updated:Jul 15, 2026

Create an execution configuration that triggers a Template on a schedule or on demand.

Request headers

Header

Required

Description

Authorization

Yes

Bearer <PAT>

Content-Type

Yes

application/json

Idempotency-Key

No

Optional idempotency key for unsafe requests.

Request body

Parameter

Type

Required

Description

identity_id

string

Yes

Forward Identity ID that owns the Schedule.

template_id

string

Yes

Forward Template ID to execute.

name

string

Yes

Schedule name.

description

string

No

Schedule description.

initial_events

array

Yes

Events injected at each execution. Currently supports user.message.

execution

object

No

Execution policy. Defaults apply when omitted.

trigger_policy

object|null

No

Trigger policy. Omitted or null becomes {"type":"manual"}.

environment_id

string

Yes

Execution environment.

metadata

object

No

Custom metadata for labels or pass-through data only.

Trigger policy

type

Required input

Description

cron

type, expression, timezone

Triggers on a 5-field cron expression in the specified IANA timezone.

once

type, expression, optional timezone

Runs once at an ISO 8601 time. timezone is required when the expression has no offset.

interval

type, expression

Repeats at a fixed ISO 8601 duration interval, such as PT15M.

manual

type

Never runs automatically. Trigger with the Run Schedule endpoint.

Execution policy

Field

Type

Default

Description

session_mode

string

new_session

new_session or reuse_session.

max_concurrent_runs

integer

1

Maximum concurrent runs for this Schedule.

max_attempts

integer

1

Reserved. The value is recorded and validated, but only one attempt runs.

timeout_ms

integer

300000

Timeout per attempt.

Example request

curl -s -X POST 'https://api.qoder.com.cn/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

HTTP

Type

Code

Trigger

400

invalid_request_error

invalid_trigger_policy

Trigger policy type or expression is invalid.

400

invalid_request_error

trigger_policy_too_frequent

Trigger interval is less than one minute.

400

invalid_request_error

trigger_policy_time_too_soon

once target time is too soon.

400

invalid_request_error

unsupported_sinks_input

Request body contains sinks.

404

not_found_error

identity_not_found

Identity does not exist.

404

not_found_error

template_not_found

Template does not exist.

401

authentication_error

authentication_required

PAT is invalid or has expired.

Notes

  • The create endpoint does not accept sinks. Schedules created through the API return sinks: [].

  • manual schedules can only be triggered with POST /api/v1/forward/schedules/{schedule_id}/run.

  • once schedules are automatically archived after the first run reaches a terminal state.