Automation / schedules
P2 · Advanced
Cron
Schedule application functions to run on their own, without servers or background processes to keep alive.
A job points at a function, runs on a schedule, and keeps a history of attempts.
Paths in the tables are relative to https://api.ultrahost.com/v1/projects/{projectId}. Pagination, idempotency, and errors are described in Conventions.
Create
| SDK | REST | Description |
|---|---|---|
cron.create(name, config) | POST /cron/jobs | Create a scheduled job |
cron.get(name) | GET /cron/jobs/{name} | Retrieve job configuration |
cron.list() | GET /cron/jobs | List scheduled jobs |
cron.update(name, config) | PATCH /cron/jobs/{name} | Update the schedule or target |
cron.delete(name) | DELETE /cron/jobs/{name} | Delete a job |
cron.enable(name) | POST /cron/jobs/{name}/enable | Enable a job |
cron.disable(name) | POST /cron/jobs/{name}/disable | Pause a job |
await ultrahost.cron.create("daily-report", {
schedule: "0 8 * * *",
timezone: "America/New_York",
function: "generate-report",
enabled: true,
retries: 3
});function is the name of a Custom Function, not a server you operate.
Configure
Jobs support:
- Recurring cron schedules and one-time schedules
- A timezone on the job
- Retry policies
- Execution timeouts
- Failure notifications
disable() pauses the job and keeps its configuration. delete() removes it.
Creating and editing jobs is control-plane work. Running an already-enabled job is not a reason to hand the browser an admin credential.
Use
| SDK | REST | Description |
|---|---|---|
cron.run(name) | POST /cron/jobs/{name}/run | Trigger immediately |
cron.history(name, options?) | GET /cron/jobs/{name}/runs | List execution history |
cron.getRun(name, runId) | GET /cron/jobs/{name}/runs/{runId} | Retrieve one execution |
cron.retry(name, runId) | POST /cron/jobs/{name}/runs/{runId}/retry | Retry a failed execution |
History is cursor-paginated like other lists. A run that is still in progress can be followed through the same operation shape used elsewhere when the execution outlives the request.