Cron API Documentation

Base Path

/crons

Endpoints

Cron View Management

Get View List

GET /views

Get all cron task views.

Create View

POST /views

Request Body

{
  name: string,           // View name
  sorts?: Array<any>,     // Sort rules
  filters?: Array<any>,   // Filter rules
  filterRelation?: string // Filter relationship
}

Update View

PUT /views

Request Body

{
  id: number,            // View ID
  name: string,          // View name
  sorts?: Array<any>,    // Sort rules
  filters?: Array<any>,  // Filter rules
  filterRelation?: string // Filter relationship
}

Delete View

DELETE /views

Request Body

number[]  // Array of view IDs

Move View Position

PUT /views/move

Request Body

{
  fromIndex: number,  // Original position
  toIndex: number,    // Target position
  id: number         // View ID
}

Disable View

PUT /views/disable

Request Body

number[]  // Array of view IDs

Enable View

PUT /views/enable

Request Body

number[]  // Array of view IDs

Cron Task Management

Get Cron Task List

GET /

Get list of cron tasks.

Get Task Details

GET /detail

Get detailed information of specified task.

Create Cron Task

POST /

Request Body

{
  command: string,         // Command to execute
  schedule: string,        // Cron expression
  name?: string,          // Task name
  labels?: string[],      // Labels
  sub_id?: number,        // Sub-task ID
  extra_schedules?: any[], // Additional scheduling rules
  task_before?: string,   // Pre-task
  task_after?: string     // Post-task
}

Run Task

PUT /run

Request Body

number[]  // Array of task IDs

Stop Task

PUT /stop

Request Body

number[]  // Array of task IDs

Remove Labels

DELETE /labels

Request Body

{
  ids: number[],    // Array of task IDs
  labels: string[]  // Array of labels
}

Add Labels

POST /labels

Request Body

{
  ids: number[],    // Array of task IDs
  labels: string[]  // Array of labels
}

Disable Task

PUT /disable

Request Body

number[]  // Array of task IDs

Enable Task

PUT /enable

Request Body

number[]  // Array of task IDs

Get Task Log

GET /:id/log

Get execution log of specified task.

Update Task

PUT /

Request Body

{
  id: number,
  command: string,
  schedule: string,
  name?: string,
  labels?: string[],
  sub_id?: number,
  extra_schedules?: any[],
  task_before?: string,
  task_after?: string
}

Delete, pin and unpin tasks

Method Path Body
DELETE / Task ID array
PUT /pin Task ID array
PUT /unpin Task ID array
[12,13]

Import tasks

GET /import imports tasks from crontab. This request changes panel state.

Get a single task

GET /:id returns task details for the supplied ID.

Update task status

PUT /status accepts:

{
  ids: number[],
  status: string,
  pid?: string,
  log_path?: string,
  last_running_time?: number,
  last_execution_time?: number
}

List task log files

GET /:id/logs lists the task's log files. Use the log API to read or download a file.

Execution options and task instances

Creation and updates also accept:

Field Type Description
log_name string Custom log name, including Chinese characters; relative names have a 100-character limit and cannot contain ./.. path segments; absolute paths must remain in the log directory, except /dev/null
allow_multiple_instances number 0 or 1, allowing concurrent instances
work_dir string Working directory

Both create and update require command and schedule. Schedules support seconds; use valid step expressions such as */5, not bare /5 or Quartz expressions containing ?.

Method Full path Description
GET /open/crons/:id/instances List task instances, newest start first
POST /open/crons/:id/instances/:instanceId/stop Stop a specific instance
ql task instances 12 --json
ql task instance-stop 12 34 --json

Log chunks

GET /open/crons/:id/log accepts offset (non-negative byte offset), limit (at most 1048576 bytes), and boolean tail. Responses include data, logStatus, offset, nextOffset, total and truncated. HTTP chunk sizes use bytes; the CLI's --tail option uses lines.

See the remote CLI guide for pagination and run responses. The HTTP run endpoint accepts an ID array. An accepted request does not mean script execution has completed.