Skip to main content

Scheduled UDFs

A cronjob runs a saved UDF on a recurring schedule. Each cronjob belongs to your team's execution environment and targets one UDF by id.

The equivalent CLI is fused cronjob.

note

Scheduled UDFs run on batch compute instances, so your team needs batch compute enabled. Teams without billing enabled receive 403 Forbidden when creating a cronjob.

The cronjob object

FieldTypeDescription
idstringCronjob id
namestringCronjob name
descriptionstring | nullOptional description
execution_environment_idstringEnvironment that owns the cronjob
enabledbooleanWhether the schedule is active
minutearray<integer>Minute (0–59). Exactly one value.
hourarray<integer>Hours (0–23)
day_of_montharray<integer>Days of month (1–31). Empty means every day.
montharray<integer>Months (1–12). Empty means every month.
day_of_weekarray<integer>Days of week (0 = Sunday). Empty means every day.
udfstringId of the UDF to run
udf_argsobject | nullArguments passed to the UDF on each run
last_runstring | nullTimestamp of the most recent run

List cronjobs

GET /cronjob/get-self

Scope: user or environment

Returns an array of cronjob objects for your environment.

Get cronjobs for a UDF

GET /cronjob/by-udf-id/{udf_id}

Scope: user or environment

Returns an array of cronjob objects scheduled for the given UDF id.

Get a cronjob

GET /cronjob/by-id/{cronjob_id}

Scope: user or environment

Returns one cronjob object.

Create a cronjob

POST /cronjob/create

Scope: user or environment

Body

FieldTypeRequiredDescription
namestringYesCronjob name
enabledbooleanYesWhether the schedule is active
minutearray<integer>YesMinute (0–59), exactly one value
hourarray<integer>YesHours (0–23)
day_of_montharray<integer>YesDays of month (1–31); empty for every day
montharray<integer>YesMonths (1–12); empty for every month
day_of_weekarray<integer>YesDays of week (0 = Sunday); empty for every day
udfstringYesId of the UDF to run
descriptionstringNoOptional description
udf_argsobjectNoArguments passed to the UDF on each run

Run a UDF every day at 06:30 UTC:

curl -X POST \
-H "Authorization: Fused-Service-Token $FUSED_SERVICE_ACCOUNT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "daily-refresh",
"enabled": true,
"minute": [30],
"hour": [6],
"day_of_month": [],
"month": [],
"day_of_week": [],
"udf": "<udf_id>",
"udf_args": {"region": "us-west-2"}
}' \
"https://www.fused.io/server/v1/cronjob/create"

Returns the created cronjob object.

Update a cronjob

POST /cronjob/by-id/{cronjob_id}

Scope: user or environment

All body fields are optional — send only what you want to change. Accepts the same fields as Create a cronjob.

Disable a schedule without deleting it:

curl -X POST \
-H "Authorization: Fused-Service-Token $FUSED_SERVICE_ACCOUNT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled": false}' \
"https://www.fused.io/server/v1/cronjob/by-id/<cronjob_id>"

Returns the updated cronjob object.

Delete a cronjob

DELETE /cronjob/by-id/{cronjob_id}

Scope: user or environment

Unschedules the UDF. Returns the deleted cronjob object.

Trigger a run now

POST /cronjob/user-run/by-id/{cronjob_id}

Scope: user or environment

Runs the cronjob's UDF immediately, without waiting for the schedule. The response contains the cronjob object and a run object describing the started job — track it with the batch job endpoints.

See also