Skip to main content
POST
Create a Trigger

Headers

kimi-api-version
enum<string>

API version for this request, in YYYY-MM-DD form. Send 2026-09-01-beta for the version documented here. Required outside /v1/files*: a missing header there is rejected with 400 invalid_request_error; on /v1/files* its absence selects the compatibility behavior. An unknown value is rejected with 400 invalid_request_error on every endpoint. API versions served by the platform. New dated versions are added as they ship; a version is removed after its announced Sunset date.

Available options:
2026-09-01-beta
Idempotency-Key
string

Optional idempotency key. Reusing the same key with the same request target, API version, and body replays the first response for 24 hours. Reusing it with a different target, API version, or body, or while the first request is still being processed, returns 409.

Body

application/json

Schedule, target Agent and Environment, and Session behavior for the new Trigger.

Request body for creating a Trigger.

name
string
required

Human-readable trigger name.

Required string length: 1 - 256
Example:

"Daily summary"

agent_id
string
required

Agent started by each run.

Required string length: 1 - 128
Example:

"agent_01h455vb4pex5vsknk084sn02q"

environment_id
string
required

Environment for Sessions started by the Trigger.

Required string length: 1 - 128
Example:

"env_01h455vb4pex5vsknk084sn02q"

policy
Cron schedule · object
required

Policy that determines when the Trigger runs.

Example:
agent_version
string

Agent version to use ("1", "2", …). If omitted, the latest version is used when the Trigger fires.

Maximum string length: 128
Example:

"1"

resources
(File · object | Vault · object | Memory Store · object | GitHub repository · object)[]

Resources bound to Sessions created by the Trigger. Repository tokens are write-only and are never returned.

Maximum array length: 16

An uploaded file available to a Session.

Example:
initial_events
User message · object[]

Opening messages added to the target Session on every run. Only user.message is supported.

Maximum array length: 16
Example:
session_mode
enum<string>

Session target for each Trigger run.

Available options:
new_session,
reuse_session
Example:

"new_session"

notification
object

Webhook configuration for TriggerRun notifications. Absent disables delivery.

Example:

Response

The new Trigger in the active state.

A saved rule that starts an Agent on a schedule or by request.

id
string
required

Trigger ID.

Example:

"trig_01h455vb4pex5vsknk084sn02q"

name
string
required

Human-readable trigger name.

Example:

"Daily summary"

status
enum<string>
required

Current lifecycle status.

Available options:
active,
paused,
archived
Example:

"active"

agent_id
string
required

Agent started by each run.

Example:

"agent_01h455vb4pex5vsknk084sn02q"

session_mode
enum<string>
required

Session target for each Trigger run.

Available options:
new_session,
reuse_session
Example:

"new_session"

policy
Cron schedule · object
required

Policy that determines when the Trigger runs.

Example:
scope
enum<string>
required

Scope in which the Trigger is visible.

Available options:
official,
org,
project,
user
Example:

"project"

created_by
string
required

ID of the user who created the Trigger.

Example:

"user_example"

created_at
string<date-time>
required

Creation timestamp.

Example:

"2026-08-01T09:00:00Z"

updated_at
string<date-time>
required

Time when the Trigger was last updated.

Example:

"2026-08-01T09:00:00Z"

paused_reason
object

Why the trigger is paused. Absent while active.

Example:
agent_version
string

Agent version to use ("1", "2", …). If absent, the latest version is used when the Trigger fires. With reuse_session, the version is fixed when the first run creates the managed Session.

Example:

"1"

environment_id
string

Environment for Sessions started by the Trigger.

Example:

"env_01h455vb4pex5vsknk084sn02q"

resources
(File · object | Vault · object | Memory Store · object | GitHub repository · object)[]

Resources bound to Sessions created by the Trigger. Repository tokens are write-only and are never returned.

An uploaded file available to a Session.

Example:
initial_events
User message · object[]

Opening messages added to the target Session on every run. Only user.message is supported.

Example:
origin_type
string

Type of the immutable configuration that created or last updated this Trigger, currently dream_policy_version. Managed Triggers (this field is set) reject update, pause, unpause, and archive. Their lifecycle follows the owning resource. Manual runs remain allowed.

Example:

"dream_policy_version"

origin_id
string

ID of that immutable configuration, such as a DreamPolicyVersion ID.

Example:

"dpv_01h455vb4pex5vsknk084sn02q"

last_run_at
string<date-time>

Last time the trigger fired.

Example:

"2026-08-01T09:00:00Z"

upcoming_runs_at
string<date-time>[]

Approximate upcoming run times in UTC (up to 5). Present only on active cron Triggers.

Example:
archived_at
string<date-time>

Time when the Trigger was archived. Absent while active or paused.

Example:

"2026-08-03T09:00:00Z"

notification
object

Webhook configuration for TriggerRun notifications. Absent disables delivery.

Example: