All Products
Search
Document Center

PolarDB:CreatePolarClawCronJob

Last Updated:Oct 26, 2026

Creates a PolarClaw scheduled task.

Operation description

Request description

You can use this API to define and create a scheduled task. The task is triggered periodically based on a specified schedule and carries specific messages or instructions. This API supports advanced options such as custom execution frequency, time zone settings, and failure alert mechanisms. You can also configure details such as message content, target channels, and recipients.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

polardb:CreatePolarClawCronJob

create

*All Resource

*

None None

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

ApplicationId

string

Yes

The application ID.

pa-**************

Name

string

Yes

The unique name of the task.

daily-report

Schedule

object

Yes

The schedule configuration.

{"Kind":"cron","Expr":"0 9 * * *","Tz":"Asia/Shanghai"}

Kind

string

No

The schedule type. Valid values: cron, every, at.

cron

Expr

string

No

The cron expression.

0 9 * * *

Tz

string

No

The IANA time zone.

Asia/Shanghai

StaggerMs

integer

No

The deterministic jitter window in milliseconds.

0

EveryMs

integer

No

The interval in milliseconds.

100000

AnchorMs

integer

No

The base timestamp for interval alignment.

1777370572518

At

string

No

The ISO 8601 timestamp.

2026-04-10T09:00:00+08:00

SessionTarget

string

Yes

The session target. Valid values: main, isolated, current.

main

WakeMode

string

Yes

The wake mode. Valid values: now, next-heartbeat.

now

Payload

object

Yes

The execution payload configuration.

{"Kind":"agentTurn","Message":"Generate the daily report."}

Kind

string

No

The payload type. Valid values: agentTurn, systemEvent.

systemEvent

Message

string

No

The agent conversation prompt.

Generate the daily report.

Text

string

No

The system event text.

Generate the daily report.

Model

string

No

The model override.

bailian/qwen3.5-plus

Fallbacks

array

No

The list of fallback models.

string

No

The fallback model.

bailian/qwen-max

Thinking

string

No

The thinking level. Valid values: off, minimal, low, medium, high, xhigh.

xhigh

TimeoutSeconds

integer

No

The execution timeout in seconds.

10

LightContext

boolean

No

Specifies whether to use a lightweight context.

false

Deliver

boolean

No

Specifies whether to deliver the output to a channel.

true

Channel

string

No

The ID of the delivery channel.

feishu

To

string

No

The delivery target.

ou_***

BestEffortDeliver

boolean

No

Specifies whether to ignore delivery failures.

false

AgentId

string

No

The ID of the specified execution agent.

main

SessionKey

string

No

The session routing key.

agent:main:feishu:direct:***

Description

string

No

The task description.

Daily report generation

Enabled

boolean

No

Specifies whether the task is enabled. Default value: true.

true

DeleteAfterRun

boolean

No

Specifies whether to automatically delete the task after the first execution. Default value: false.

false

Delivery

object

No

The result delivery configuration.

{"Mode":"announce","Channel":"telegram"}

Mode

string

No

The delivery mode. Valid values: none, announce, webhook.

announce

Channel

string

No

The delivery channel.

feishu

AccountId

string

No

The channel account ID.

default

To

string

No

The delivery target.

ou_***

BestEffort

boolean

No

Specifies whether to ignore delivery failures.

false

FailureAlert

object

No

The failure alert configuration.

{"After":3,"Channel":"telegram"}

After

integer

No

The number of consecutive failures before an alert is triggered.

3

Channel

string

No

The alert channel.

feishu

AccountId

string

No

The channel account ID.

default

To

string

No

The alert target.

ou_***

CooldownMs

integer

No

The minimum interval between two alerts in milliseconds.

5000

Mode

string

No

The alert mode. Valid values: announce, webhook.

announce

RunImmediately

boolean

No

Specifies whether to run it once immediately after creation. Default value: false.

false

Restart

boolean

No

Specifies whether to restart the gateway after creation. Default value: true.

true

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

Id of the request

6BD9CDE4-5E7B-4BF3-9BB8-83C73E******

Message

string

The response message.

successful

Code

integer

The response status code.

200

ApplicationId

string

The application ID.

pa-**************

Ok

boolean

Indicates whether the operation is successful.

true

Job

object

The details of the created scheduled job.

Id

string

The job ID (UUID).

e2c57423-12f0-45cc-a387-6155168b3201

Name

string

The job name.

test

Enabled

boolean

Indicates whether the job is enabled.

true

DeleteAfterRun

boolean

Indicates whether the job is deleted after the first execution.

false

CreatedAtMs

integer

The creation timestamp in milliseconds.

1777368967284

UpdatedAtMs

integer

The update timestamp in milliseconds.

1777370572517

Schedule

object

The schedule configuration.

Kind

string

The schedule type: cron, every, or at.

cron

Expr

string

The cron expression.

0 9 * * *

Tz

string

The IANA time zone.

Asia/Shanghai

EveryMs

integer

The interval in milliseconds.

1000

AnchorMs

integer

The base timestamp for interval alignment.

1777370572518

At

string

The ISO 8601 timestamp.

2026-04-10T09:00:00+08:00

SessionTarget

string

The session target. Valid values: main, isolated, current.

main

WakeMode

string

The wake mode. Valid values: now, next-heartbeat.

now

Payload

object

The execution payload.

Kind

string

The payload type. Valid values: agentTurn, systemEvent.

agentTurn

Message

string

The agent conversation prompt.

Generate the daily report.

Text

string

The system event text.

Generate the daily report.

Model

string

The model override.

bailian/qwen3.5-plus

TimeoutSeconds

integer

The execution timeout in seconds.

10

LightContext

boolean

Specifies whether to use a lightweight context.

false

Deliver

boolean

Specifies whether to deliver the output to a channel.

false

Channel

string

The ID of the delivery channel.

feishu

To

string

The delivery target.

ou_***

BestEffortDeliver

boolean

Specifies whether to ignore delivery failures.

false

AgentId

string

The ID of the execution agent.

main

SessionKey

string

The session routing key.

agent:main:feishu:direct:***

Description

string

The task description.

test

Delivery

object

The result delivery configuration.

Mode

string

The delivery mode. Valid values: none, announce, webhook.

announce

Channel

string

The delivery channel.

feishu

AccountId

string

The channel account ID.

default

To

string

The delivery target.

ou_***

BestEffort

boolean

Specifies whether to ignore delivery failures.

false

State

object

The execution status.

NextRunAtMs

integer

The timestamp of the next execution in milliseconds.

1777424400000

LastRunAtMs

integer

The timestamp of the last execution in milliseconds.

1777370544931

LastRunStatus

string

The status of the last execution.

ok

ConsecutiveErrors

integer

The number of consecutive failures.

0

Runs

array<object>

The execution history.

array<object>

Ts

integer

The execution timestamp in milliseconds.

1777370572518

JobId

string

The ID of the associated job.

f83f5278-1abe-40a6-b10e-ad3ecdc05de2

Action

string

The action. Valid values: finished, error, and skipped.

finished

Status

string

The status. Valid values: ok, error, and skipped.

ok

Summary

string

The execution summary text.

Generate the daily report.

Delivered

boolean

Indicates whether the run was delivered.

false

DeliveryStatus

string

The delivery status.

not-requested

SessionId

string

The ID of the associated session.

***

RunAtMs

integer

The actual execution timestamp in milliseconds.

1777370544931

DurationMs

integer

The execution duration in milliseconds.

27586

NextRunAtMs

integer

The timestamp of the next execution in milliseconds.

1777424400000

Model

string

The model used.

bailian/qwen3.5-plus

Provider

string

The model provider.

bailian

Usage

object

The token usage details.

InputTokens

integer

The number of input tokens.

30250

OutputTokens

integer

The number of output tokens.

30250

TotalTokens

integer

The total number of tokens.

60500

JobName

string

The job name.

test

RanImmediately

boolean

Indicates whether the job was executed immediately and successfully.

false

Examples

Success response

JSON format

{
  "RequestId": "6BD9CDE4-5E7B-4BF3-9BB8-83C73E******",
  "Message": "successful",
  "Code": 200,
  "ApplicationId": "pa-**************",
  "Ok": true,
  "Job": {
    "Id": "e2c57423-12f0-45cc-a387-6155168b3201",
    "Name": "test",
    "Enabled": true,
    "DeleteAfterRun": false,
    "CreatedAtMs": 1777368967284,
    "UpdatedAtMs": 1777370572517,
    "Schedule": {
      "Kind": "cron",
      "Expr": "0 9 * * *",
      "Tz": "Asia/Shanghai",
      "EveryMs": 1000,
      "AnchorMs": 1777370572518,
      "At": "2026-04-10T09:00:00+08:00"
    },
    "SessionTarget": "main",
    "WakeMode": "now",
    "Payload": {
      "Kind": "agentTurn",
      "Message": "Generate the daily report.",
      "Text": "Generate the daily report.",
      "Model": "bailian/qwen3.5-plus",
      "TimeoutSeconds": 10,
      "LightContext": false,
      "Deliver": false,
      "Channel": "feishu",
      "To": "ou_***",
      "BestEffortDeliver": false
    },
    "AgentId": "main",
    "SessionKey": "agent:main:feishu:direct:***",
    "Description": "test",
    "Delivery": {
      "Mode": "announce",
      "Channel": "feishu",
      "AccountId": "default",
      "To": "ou_***",
      "BestEffort": false
    },
    "State": {
      "NextRunAtMs": 1777424400000,
      "LastRunAtMs": 1777370544931,
      "LastRunStatus": "ok",
      "ConsecutiveErrors": 0
    },
    "Runs": [
      {
        "Ts": 1777370572518,
        "JobId": "f83f5278-1abe-40a6-b10e-ad3ecdc05de2",
        "Action": "finished",
        "Status": "ok",
        "Summary": "Generate the daily report.",
        "Delivered": false,
        "DeliveryStatus": "not-requested",
        "SessionId": "***",
        "RunAtMs": 1777370544931,
        "DurationMs": 27586,
        "NextRunAtMs": 1777424400000,
        "Model": "bailian/qwen3.5-plus",
        "Provider": "bailian",
        "Usage": {
          "InputTokens": 30250,
          "OutputTokens": 30250,
          "TotalTokens": 60500
        },
        "JobName": "test"
      }
    ]
  },
  "RanImmediately": false
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.