---
title: "Create cron trigger"
method: POST
path: "/orgs/{orgID}/projects/{projectID}/cron-triggers"
tags: ["Configs and Profiles"]
---

# Create cron trigger

`POST /orgs/{orgID}/projects/{projectID}/cron-triggers`

## Request

- Base URL: `https://api.omnara.com/v1`
- URL: `https://api.omnara.com/v1/orgs/{orgID}/projects/{projectID}/cron-triggers`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-omnara_session` and API key in header `X-Omnara-Csrf`

Creates a cron trigger that fires on a schedule. A trigger targeting an agent profile launches a new agent from the profile's current config on each firing; a trigger targeting an agent sends an input to that agent. Missed firings are coalesced, matching standard cron behavior: if one or more scheduled times pass while firing is delayed, the trigger fires once for the oldest missed time and then resumes its schedule from the current time, without retroactively firing for the other missed times.

## Path parameters

- `orgID` string, required
- `projectID` string, required

## Headers

- `Idempotency-Key` string

## Request body

- CreateCronTriggerRequest
  - `name` string, required: Human-readable name. Spaces and punctuation are allowed; leading or trailing whitespace and invisible or control characters are not.
  - `target` union, required: What each firing does: type agent sends the message to an existing agent, type profile launches a new agent from a profile, and type integration hands the firing to an integration, such as a new Slack or Discord thread.
    - AgentCronTriggerTarget
      - `type` 'agent', required: agent: send each message to an existing agent.
      - `agent_id` string, required: Agent that receives each message.
      - `delivery_mode` 'queued' | 'steering': How each message is delivered: queued (default) or steering.
    - AgentProfileCronTriggerTarget
      - `type` 'profile', required: profile: launch a new agent on each run.
      - `agent_profile_id` string, required: Profile to launch a new agent from on each run.
    - IntegrationCronTriggerTarget
      - `type` 'integration', required: integration: hand each run to an integration.
      - `integration_id` string, required: Integration that handles each run.
      - `settings` object, required: Settings validated by the target integration's published schedule input schema. Each accepted occurrence retains its own copy. Integration resource references are resolved when the integration handles the occurrence.
  - `cron` string, required: Standard five-field cron expression (minute, hour, day of month, month, day of week). `TZ=`/`CRON_TZ=` prefixes are rejected; set the `timezone` field instead.
  - `timezone` string: IANA time zone the schedule is evaluated in.
  - `message_template` string: Go text/template rendered on each firing to produce the message sent to the target. The template receives a `trigger` value with `name`, `fired_at`, `last_fired_at`, and `local_date` fields. Timestamps remain UTC; local_date is the scheduled occurrence's ISO date in the schedule timezone. Required for agent and profile targets; omitted for integration targets, which use their own settings. Rendering is capped at 64 KiB of output and one second of wall-clock time, and `printf` width and precision specifiers are capped at 1024; a firing whose template fails to render is recorded in `failure_report` without sending a message.
  - `enabled` boolean: Whether the trigger fires on schedule; false pauses it.

## Response `200`

Existing cron trigger returned.

- CronTrigger
  - `id` string, required
  - `org_id` string, required
  - `project_id` string, required: Project ID (proj_...).
  - `name` string, required: Human-readable name. Spaces and punctuation are allowed; leading or trailing whitespace and invisible or control characters are not.
  - `target` union, required: What each firing does: type agent sends the message to an existing agent, type profile launches a new agent from a profile, and type integration hands the firing to an integration, such as a new Slack or Discord thread.
    - AgentCronTriggerTarget
      - `type` 'agent', required: agent: send each message to an existing agent.
      - `agent_id` string, required: Agent that receives each message.
      - `delivery_mode` 'queued' | 'steering': How each message is delivered: queued (default) or steering.
    - AgentProfileCronTriggerTarget
      - `type` 'profile', required: profile: launch a new agent on each run.
      - `agent_profile_id` string, required: Profile to launch a new agent from on each run.
    - IntegrationCronTriggerTarget
      - `type` 'integration', required: integration: hand each run to an integration.
      - `integration_id` string, required: Integration that handles each run.
      - `settings` object, required: Settings validated by the target integration's published schedule input schema. Each accepted occurrence retains its own copy. Integration resource references are resolved when the integration handles the occurrence.
  - `cron` string, required: Standard five-field cron expression (minute, hour, day of month, month, day of week). `TZ=`/`CRON_TZ=` prefixes are rejected; set the `timezone` field instead.
  - `timezone` string, required: IANA time zone the schedule is evaluated in.
  - `message_template` string: Go text/template rendered on each firing to produce the message sent to the target. The template receives a `trigger` value with `name`, `fired_at`, `last_fired_at`, and `local_date` fields. Timestamps remain UTC; local_date is the scheduled occurrence's ISO date in the schedule timezone. Required for agent and profile targets; omitted for integration targets, which use their own settings. Rendering is capped at 64 KiB of output and one second of wall-clock time, and `printf` width and precision specifiers are capped at 1024; a firing whose template fails to render is recorded in `failure_report` without sending a message.
  - `enabled` boolean, required
  - `last_fired_at` string, date-time, nullable, required
  - `next_fire_at` string, date-time, nullable, required
  - `failure_report` CronTriggerFailureReport, nullable, required
    - `message` string, required: Why the most recent failed firing did not deliver a message.
    - `will_retry` boolean, required: Whether the firing will be retried after the claim lease expires.
    - `failed_at` string, date-time, required
  - `last_run` CronTriggerLastRun, nullable, required
    - `state` 'queued' | 'processing' | 'completed' | 'failed', required: State of the latest accepted scheduled integration action. Completed means the integration handled the occurrence; it does not indicate completion of any agent task that action started.
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `failure_message` string, nullable, required: Coarse scheduled action failure description; no raw provider errors.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `201`: Cron trigger created.
- `400`: The request was invalid.
- `401`: Authentication is required or invalid.
- `403`: The authenticated principal is not authorized.
- `404`: The requested resource was not found or is not visible.
- `409`: The request conflicts with current resource state or idempotency history.
- `503`: The service dependency required to satisfy the request is unavailable.
- `4XX`: Any other client error. The body carries the shared Error envelope restricted to client error codes; statuses with a dedicated response above are documented precisely.
- `5XX`: Any other server error. The body carries the shared Error envelope restricted to server error codes.

## Changes

- **2026-10-07** `680248a0ba72`: 4 breaking, 7 info
  - the response property `message_template` became optional for the status `200`
  - the response property `message_template` became optional for the status `201`
  - added `#/components/schemas/IntegrationCronTriggerTarget` to the `target` response property `oneOf` list for the response status `200`
  - added `#/components/schemas/IntegrationCronTriggerTarget` to the `target` response property `oneOf` list for the response status `201`
  - …7 more
- **2026-10-05** `3d9e2cf46e07`: 159 info
  - added the optional property `current_digest` to the response with the `400` status
  - added the optional property `current_digest` to the response with the `401` status
  - added the optional property `current_digest` to the response with the `403` status
  - added the optional property `current_digest` to the response with the `404` status
  - …155 more
  - …this revision’s changelog is incomplete
- **2026-09-28** `acddeb8fc6a5`: 7 warning, 7 info
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `400`
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `401`
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `403`
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `404`
  - …10 more
- …earlier changes not shown

[Operation history](https://skmtc.dev/omnara/apis/omnara-api-2/changes/orgs/:orgID/projects/:projectID/cron-triggers/post.md)

---

[API](https://skmtc.dev/omnara/apis/omnara-api-2.md) - [All operations](https://skmtc.dev/omnara/apis/omnara-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/omnara/apis/omnara-api-2/revisions/343aebb1dff1?raw)
