CreateAutomationScheduledTask - Create a scheduled task
|
Applicable editions |
Central edition, Region edition |
Endpoints and authorization information
- Get the endpoint to replace {domain} in the request syntax.
- Get a personal access token.
- Get the organization ID. This parameter is required only for the Central edition. Go to the Basic Information page in the Organization Management console to obtain the organization ID.
|
Product |
Resource |
Required permission |
|
Organization Management |
Automation scheduled tasks |
Read/Write |
Request syntax
Central edition
POST https://{domain}/oapi/v1/platform/organizations/{organizationId}/automation/scheduled-tasks
Region edition
POST https://{domain}/oapi/v1/platform/automation/scheduled-tasks
Request headers
|
Parameter |
Type |
Required |
Description |
Example value |
|
x-yunxiao-token |
string |
Yes |
Personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example value |
|
organizationId |
string |
path |
|
The organization ID. |
|
| - |
object |
body |
No |
||
| channels |
array[string] |
body |
No |
The report delivery channels. If none is selected, the task is only executed and no report is delivered. |
|
| enabled |
boolean |
body |
No |
Whether the task is enabled. Defaults to true on creation, and remains unchanged on update. |
|
| mailSubject |
string |
body |
No |
The email subject (plain text, template binding is not supported). Defaults to the task title. |
|
| model |
object |
body |
No |
The AI model. Auto is used by default at creation, and the original model is retained during updates. Set {"provider":"auto","modelId":"auto"} to switch back to Auto. The specified model must be selected from capabilities.models. Custom endpoints or keys and parameters such as temperature are not supported. If the original model is offline, an update must explicitly pass an available model or Auto. |
|
| modelId |
string |
body |
No |
The model ID (without the date suffix). Set to auto when Auto is used. |
qwen3.8-max |
| provider |
string |
body |
No |
The model provider. Set to auto when Auto is used. |
qwen |
| prompt |
string |
body |
Yes |
The AI prompt. |
Summarize yesterday's requirement progress and generate a morning report |
| recipients |
array[string] |
body |
No |
The recipient list, applied to all selected channels. If omitted, creation uses the caller and update keeps the current recipients of each channel. An explicit empty list is not allowed. |
|
| schedule |
object |
body |
Yes |
||
| cron |
string |
body |
No |
A custom 5-field cron expression. Required when frequency is custom. |
30 9 * * 1-5 |
| dayOfMonth |
integer |
body |
No |
The day of the month (1 to 31). Required when frequency is monthly. |
|
| dayOfWeek |
integer |
body |
No |
The day of the week (0 to 6, where 0 is Sunday). Required when frequency is weekly. |
|
| frequency |
string |
body |
Yes |
The scheduling frequency. Valid values: [daily weekly monthly weekdays hourly everyMinutes custom]. |
daily |
| intervalMinutes |
integer |
body |
No |
The interval in minutes (1 to 59). Required when frequency is everyMinutes. |
|
| minute |
integer |
body |
No |
The minute of the hour (0 to 59). Required when frequency is hourly. |
|
| time |
string |
body |
No |
The trigger time in HH:mm format. Required when frequency is daily, weekly, monthly, or weekdays. |
09:30 |
| title |
string |
body |
Yes |
The task title, which is also the default email subject. |
Daily R&D report |
Request examples
Central edition
curl -X 'POST' \
'https://{domain}/oapi/v1/platform/organizations/{organizationId}/automation/scheduled-tasks' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"channels": [
],
"enabled": false,
"mailSubject": "",
"model": {
"modelId": "qwen3.8-max",
"provider": "qwen"
},
"prompt": "Summarize yesterday's requirement progress and generate a morning report",
"recipients": [
],
"schedule": {
"cron": "30 9 * * 1-5",
"dayOfMonth": 0,
"dayOfWeek": 0,
"frequency": "daily",
"intervalMinutes": 0,
"minute": 0,
"time": "09:30"
},
"title": "Daily R&D report"
}'
Region edition
curl -X 'POST' \
'https://{domain}/oapi/v1/platform/automation/scheduled-tasks' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"channels": [
],
"enabled": false,
"mailSubject": "",
"model": {
"modelId": "qwen3.8-max",
"provider": "qwen"
},
"prompt": "Summarize yesterday's requirement progress and generate a morning report",
"recipients": [
],
"schedule": {
"cron": "30 9 * * 1-5",
"dayOfMonth": 0,
"dayOfWeek": 0,
"frequency": "daily",
"intervalMinutes": 0,
"minute": 0,
"time": "09:30"
},
"title": "Daily R&D report"
}'
Response parameters
|
Parameter |
Type |
Description |
Example value |
| - |
object |
||
| channels |
array[string] |
The selected report delivery channels. |
|
| createdAt |
string |
The creation time. |
|
| enabled |
boolean |
Whether the task is enabled. |
true |
| mailSubject |
string |
The independently configured email subject. Omitted when it follows the task title. |
|
| manageable |
boolean |
Whether the task form can fully manage this task. When false, the task is read-only (it can be enabled/disabled or deleted, but cannot be updated through the form). |
true |
| mode |
string |
The AI execution mode: report (generate a report) or command (execute a command). Valid values: [report command]. |
report |
| model |
object |
The AI model used by the task. Returns Auto (provider=auto, modelId=auto) when no model is configured. |
|
| modelId |
string |
The model ID (without the date suffix). Set to auto when Auto is used. |
qwen3.8-max |
| provider |
string |
The model provider. Set to auto when Auto is used. |
qwen |
| name |
string |
The task name (a stable identifier generated by the server), unique within the organization. |
sched-1a2b3c4d |
| prompt |
string |
The AI prompt. |
|
| recipients |
array[string] |
The recipient list echoed when it is consistent across all channels. Omitted when recipients differ across channels or no channel is selected. |
|
| schedule |
object |
||
| cron |
string |
The cron expression that actually takes effect. |
30 9 * * * |
| dayOfMonth |
integer |
The day of the month. A structured echo field, provided when the cron can be expressed by the form. |
|
| dayOfWeek |
integer |
The day of the week (0 to 6, where 0 is Sunday). |
|
| frequency |
string |
The structured frequency. Omitted when the cron cannot be expressed by the form. Valid values: [daily weekly monthly weekdays hourly everyMinutes custom]. |
daily |
| intervalMinutes |
integer |
The interval in minutes. |
|
| minute |
integer |
The minute of the hour. |
|
| text |
string |
The natural-language description of the schedule. |
Every day at 09:30 |
| time |
string |
The trigger time in HH:mm format. |
|
| timezone |
string |
The time zone. |
Asia/Shanghai |
| title |
string |
The task title. |
Daily R&D report |
| unmanageableReason |
string |
The reason code when manageable is false, such as custom_condition / unsupported_dag_shape / divergent_recipients. |
|
| updatedAt |
string |
The update time. |
|
| version |
integer |
The rule version number, incremented on each update. |
Response example
{
"channels": [
],
"createdAt": "",
"enabled": true,
"mailSubject": "",
"manageable": true,
"mode": "report",
"model": {
"modelId": "qwen3.8-max",
"provider": "qwen"
},
"name": "sched-1a2b3c4d",
"prompt": "",
"recipients": [
],
"schedule": {
"cron": "30 9 * * *",
"dayOfMonth": 0,
"dayOfWeek": 0,
"frequency": "daily",
"intervalMinutes": 0,
"minute": 0,
"text": "Every day at 09:30",
"time": "",
"timezone": "Asia/Shanghai"
},
"title": "Daily R&D report",
"unmanageableReason": "",
"updatedAt": "",
"version": 0
}
Error codes
For more information about API error codes, see the Error Code Center.