Skip to content

Scheduled jobs

Last updated: 5 December 2026 · API v1 (beta)

A scheduled job is a command that runs on your machine at set times or when a request arrives from outside: a nightly backup, a cleanup, a deployment triggered when a CI system finishes. If the machine is paused at that moment it is resumed for the job and paused again when the job ends; you do not wait for it in a terminal.

Limits

TopicValue
Shortest interval15 minutes
Time limit of one runUp to 60 minutes (default 30)
Jobs per organizationAt most 5
New organizationJobs cannot be created during the first 7 days (SCHEDULE_NEW_ORGANIZATION)
Failures in a row3 failed runs disable the job
Run recordThe last 4 KB of the output; the last 50 runs
URL triggerAt most 60 requests per hour per job; body at most 64 KB

The schedule is always read in Istanbul time (Europe/Istanbul). If a start arrives while a run of the same job is still going, the new run is recorded as "skipped"; two runs never overlap.

Add from the panel

  1. Open the machine page in the panel and go to the "Scheduled jobs" card.
  2. Press Add a scheduled job; enter a name, a cron expression, a command and a time limit. The form shows a plain-language reading of the cron expression and warns about an expression more frequent than 15 minutes before you send it.
  3. The job appears in the list with its next run time and last status. Run now starts the job at once; History shows the last 50 runs and the end of the output.
  4. After 3 failed runs in a row the job is marked with a "Disabled" badge. Fix the command and press Enable.

Only organization owners and admins add, change and delete jobs; members read the list and the history.

Cron expression

The expression has 5 fields: minute, hour, day of month, month, day of week. A seconds field and shortcuts such as @daily are not accepted.

ExpressionMeaning
0 3 * * *Every day at 03:00
*/30 * * * *Every 30 minutes
30 9 * * 1-5Every weekday at 09:30
0 0 1 * *The 1st of every month at 00:00

How the command runs

The command is written to a script file and run on the machine with sh in /workspace; you can write several lines. Secrets defined on the machine reach the environment as for hb exec; secret values that show up in the output are replaced with ***. The script and its output do not stay on the machine after the job; the last 4 KB of the output is kept in the history.

A paused machine is resumed for the job. If resuming is not possible because of the balance or a spend budget, the run fails and the reason shows in the history (CREDIT_INSUFFICIENT, BUDGET_EXCEEDED).

CLI

hb schedules add web yedek --cron "0 3 * * *" -- "cd /workspace/app && npm run backup"
hb schedules ls web
hb schedules run web/yedek
hb schedules runs web/yedek --output
hb schedules disable web/yedek

A job is named by its id (sch_…) or as <machine>/<job name>. All commands are on the CLI page.

API

curl -X POST https://api.hadronbox.tr/v1/sandboxes/$SANDBOX_ID/schedules \
  -H "Authorization: Bearer $HADRONBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"yedek","cron":"0 3 * * *","command":"npm run backup","timeoutMinutes":30}'

Reading needs the machines:read scope, writing the schedules:write scope (and you must be an organization owner or admin). All endpoints are on the Endpoints page.

URL trigger

You can open a trigger address for each job: a POST request to the address runs the job at once. You create the token in the panel from the job's Trigger URL panel or with hb schedules trigger-token. The token is shown only once and only its SHA-256 digest is stored; creating it again invalidates the old one at once.

curl -X POST https://api.hadronbox.tr/v1/triggers/$SCHEDULE_ID \
  -H "Authorization: Bearer $TRIGGER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ref":"main"}'

The request answers 202: {"data":{"runId":"…","status":"running"}}. A disabled job answers 409 (SCHEDULE_DISABLED); if the previous run is still going, status is skipped. The body is optional and must be valid JSON; the command gets it as the path of a file in the HB_TRIGGER_PAYLOAD environment variable (for example cat "$HB_TRIGGER_PAYLOAD").

Verify with a signature

If you prefer not to send the token with the request, you can send the HMAC-SHA256 signature of the body in the X-Hadronbox-Signature header. The signature key is not the token itself but the SHA-256 digest of the token (lower-case hexadecimal text).

BODY='{"ref":"main"}'
KEY=$(printf '%s' "$TRIGGER_TOKEN" | sha256sum | cut -d' ' -f1)
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$KEY" -hex | sed 's/^.* //')
curl -X POST https://api.hadronbox.tr/v1/triggers/$SCHEDULE_ID \
  -H "X-Hadronbox-Signature: sha256=$SIG" \
  -H "Content-Type: application/json" \
  -d "$BODY"

Because the server stores only the digest and not the token, the key is that digest. Anyone who can read the digest from the database could therefore produce a signature; keep the token in the secret store of your CI system and create it again if it leaks.

A wrong or missing credential always gets the same 401 answer (TRIGGER_UNAUTHORIZED); it does not reveal whether the address or the job exists. When the hourly limit is exceeded it answers 429.

Follow the results

When a run finishes, a schedule.run.completed or schedule.run.failed webhook event arrives; its payload carries no command or output. On the failure that disables the job automatically, autoDisabled is true. See the Webhooks page for details.

Abuse and rules

Scheduled jobs fall under the Usage rules. The limits (15 minutes, 5 jobs, closed for the first 7 days, the hourly trigger limit) exist to prevent abuse, not heavy automation. The network rules of the machine do not change: the job runs inside the machine, under the same limits as the machine.

Scheduled jobs · hadronbox docs