Skip to content

Compile a natural language schedule to a cron expression

POST
/api/v1/cron/compile-schedule
curl --request POST \
--url http://localhost:11044/api/v1/cron/compile-schedule \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "schedule": "example" }'

Converts a schedule description like ‘every day at 7am’ to a Spring 6-field cron expression using an LLM. The JSON body requires a schedule key. A description the LLM cannot interpret returns 200 with an error key instead of a cron key.

The schedule in words under schedule, e.g. every day at 7am; a missing one is a 400. Nothing is saved or scheduled: the answer is a cron expression, checked to parse before it is returned, to pass on to POST /cron or POST /cron/compile

Media typeapplication/json

A schedule described in natural language

object
schedule
required

The schedule in words, e.g. ‘every day at 7am’

string

Example generated

{
"schedule": "example"
}

A cron key on success, or an error key when the description is not a schedule

Media type*/*
object
key
additional properties
string

Missing schedule

Media type*/*

A refusal carrying only a human-readable reason.

object
error
required

What went wrong, in the terms the caller can act on.

string

LLM call failed

Media type*/*

A refusal carrying only a human-readable reason.

object
error
required

What went wrong, in the terms the caller can act on.

string