Create or update a cron job
const url = 'http://localhost:11044/api/v1/cron';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"actionName":"example","cron":"example","description":"example","name":"example","payload":{"additionalProperty":"example"},"zone":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/cron \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "actionName": "example", "cron": "example", "description": "example", "name": "example", "payload": { "additionalProperty": "example" }, "zone": "example" }'Saves the job config to the world and schedules it. If a job with the same name exists, it is replaced. The cron field uses Spring’s 6-field expression (seconds minutes hours day-of-month month day-of-week); an unparseable expression is not rejected here — the job is saved but never fires, so validate with /compile-schedule first.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The job to save as config/cron/<name>.yml in the caller’s world and schedule, replacing any job with the same name. cron is a Spring 6-field expression, fired in the caller’s own time zone unless zone names an IANA zone; actionName is the world action the job runs, and payload travels on the event each firing raises. An unparseable cron is saved but never fires
A scheduled job in the user’s world that runs a world action on a cron schedule. GET /cron lists the active ones; POST /cron takes one to create or replace.
object
World action the job runs when it fires. A job saved with this blank is not scheduled again when the world’s cron configs are reloaded.
Spring 6-field cron expression (seconds minutes hours day-of-month month day-of-week), e.g. 0 0 9 * * *. An unparseable expression is saved but never fires.
What the job does, in prose; carried on the cron event the action receives
Job key, unique within the user’s world: saved as config/cron/
Values handed to the action on the cron event at every firing; empty by default
object
IANA zone the cron expression is read in, e.g. Australia/Sydney. Null means the owning user’s own zone; an invalid zone is logged and the user’s zone used instead.
Example generated
{ "actionName": "example", "cron": "example", "description": "example", "name": "example", "payload": { "additionalProperty": "example" }, "zone": "example"}Responses
Section titled “Responses”Job created/updated
object
The job config is not valid — the reason is in the message field. Note that an unparseable cron expression is NOT rejected here: validate it with /compile-schedule
A refusal from the cron or handler-adoption surface: the word error and the reason
object
Why the request was refused, written to be shown. Names the job or handler where the refusal is about one
Always error

