Skip to main content
POST
Create a scheduled task
Saves a prompt the agent runs as the caller on cronExpression in timezone, or on demand. Needs ScheduledTasksCreate (403 otherwise). A cron fires at most hourly (400 otherwise), and a user can have 20 active tasks (409 past that).

Authorizations

Authorization
string
header
required

Token authentication. Send Authorization: Bearer <YOUR_TOKEN>.

Path Parameters

deploymentId
integer
required

Body

application/json

CreateScheduledTaskInput

name
string
required
Required string length: 1 - 255
prompt
string
required

What the agent is asked on every run, shown as the task's Instructions in Cube. Each run starts a new chat thread with no memory of earlier ones, so write the whole request.

Minimum string length: 1
agentId
integer | null

The agent that runs the task. Omit for the deployment default.

condition
object | null

Notify only when: on each fire the measure is read once, before the agent runs, and the agent runs only when the condition starts to hold, with the crossing facts at the top of its thread; it runs again only after the condition has stopped holding. A change or anomaly rule needs timeDimension and granularity. A request that sends notification must leave a task with a condition notifying someone (400 otherwise); one that does not, on the deprecated notificationEnabled shape, keeps its earlier behaviour. Omit to run the agent on every fire.

cronExpression
string | null

Standard 5-field cron (minute hour day-of-month month day-of-week), e.g. 0 9 * * 1-5 for 9:00 on weekdays. A task runs at most once an hour, so the minute field is a single number. Null or omitted makes the task Manual: it runs only when started with POST /scheduled-tasks/{taskId}/run.

Maximum string length: 100
description
string | null
isEnabled
boolean | null

Create the schedule paused with false. Defaults to true.

notification
object | null

Who a finished run notifies, and how. Replaces the stored setting. Picked users and groups are shared the task, view-only, so they can open the run. An id that is not an active workspace member or a group answers 400. Wins over notificationEnabled when both are sent. Omit it, and notificationEnabled, to notify nobody.

notificationEnabled
boolean | null
deprecated

Deprecated: send notification instead. true adds the creator to notification with Inbox on; false takes the creator off it only when they get Inbox, so a creator who gets only Email keeps it.

timezone
string | null

IANA time zone the cron is read in, e.g. America/New_York. Defaults to UTC.

Maximum string length: 100

Response

200 - application/json
deploymentId
integer
required
id
integer
required
isEnabled
boolean
required

False while the schedule is paused.

name
string
required
notification
object
required

Who a finished run notifies, and how.

notificationEnabled
boolean
required
deprecated

Deprecated: read notification instead. Whether a finished run notifies the creator in Cube's notification inbox.

prompt
string
required

What the agent is asked on every run, shown as the task's Instructions in Cube. Each run starts a new chat thread, so the prompt has to stand on its own.

timezone
string
required

IANA time zone the cron is read in, e.g. America/New_York. Defaults to UTC.

userId
integer
required

The creator. Every run executes as this user, and only they or an admin may change, delete or run the task.

agentId
integer | null

The agent that runs the task; null runs the deployment default.

condition
object | null

Notify only when: on each fire the measure is read once, before the agent runs, and the agent runs only when the condition starts to hold, with the crossing facts at the top of its thread; it runs again only after the condition has stopped holding. A change or anomaly rule needs timeDimension and granularity. A request that sends notification must leave a task with a condition notifying someone (400 otherwise); one that does not, on the deprecated notificationEnabled shape, keeps its earlier behaviour. Null runs the agent on every fire.

cronExpression
string | null

Standard 5-field cron (minute hour day-of-month month day-of-week), e.g. 0 9 * * 1-5 for 9:00 on weekdays. Null when the task is Manual: it runs only when started with POST /scheduled-tasks/{taskId}/run.

description
string | null
lastConditionCheck
object | null

The latest condition check; null before the first one.

nextRunAt
string | null

When the schedule next fires (ISO 8601, UTC); null for a Manual or paused task.