# How do I run a job on a schedule?

Save a job once and let it run by itself – every weekday at 7:00, every hour, on the first day of the month. Each run is a normal background job with its log, result files and price limit.

> **Paid plans.** Schedules and webhooks are available on paid plans and to accounts that have topped up at least US$15 in total (or the same in EUR or CZK). Until then the API answers `403 feature_disabled`.

## Steps

1. **Write the command** the job should run, with a time limit and a price limit for one run.
2. **Choose when** – a cron expression and your time zone, for example `0 7 * * 1-5` in `Europe/Prague` (weekdays at 7:00).
3. **Run it once now** to test it, instead of waiting for the first planned time.
4. **Check the runs** in the portal under *Schedules*, or ask your assistant.

**Ask your assistant**

No code: copy this into Claude or ChatGPT with [WBX Sandbox connected](https://sandbox.wbx.cz/docs/connect.md) and change it to fit.

```
Create a WBX schedule named "Morning report": every weekday at 7:00 Prague time, run

mkdir -p output && date > output/report.txt

as a job with a time limit of 10 minutes and a price limit of US$0.10 (2.50 Kč) per run. Show me the next three run times, then run it once now to test it.
```

Not sure how to write the time? Say it in words ("every Monday at 9", "every 2 hours") – the assistant turns it into cron.

**Python**

`pip install wbxsandbox`, your key in `WBXSANDBOX_API_KEY`.

```
from wbxsandbox import Trigger

t = Trigger.create("Morning report", "mkdir -p output && date > output/report.txt",
                   schedule="0 7 * * 1-5", timezone="Europe/Prague",    # weekdays at 7:00
                   timeout_seconds=600, save_artifacts=True, max_cost="0.10")   # for CZK use "2.50"
print(t.next_runs[:3])
t.run()                              # try it once now instead of waiting for 7:00
print(t.runs()[0])                   # status, job_id, cost
```

**TypeScript**

`npm install wbxsandbox` (Node.js 20+); save as `.mts` for top-level `await`.

```
import { WBX } from "wbxsandbox";

const wbx = new WBX();
const t = await wbx.triggers.create({
  name: "Morning report", schedule: "0 7 * * 1-5", timezone: "Europe/Prague",   // weekdays at 7:00
  maxCost: "0.10",   // for CZK use "2.50"
  job: { command: "mkdir -p output && date > output/report.txt", timeoutSeconds: 600, saveArtifacts: true },
});
console.log(t.nextRuns.slice(0, 3));
await t.run();                       // try it once now
console.log((await t.runs())[0]);    // status, job_id, cost
```

**curl**

Just `curl` and `jq`; your key in `WBXSANDBOX_API_KEY`.

```
curl -s -X POST https://sandbox.wbx.cz/v1/triggers -H "Authorization: Bearer $WBXSANDBOX_API_KEY" -d '{
  "name": "Morning report",
  "job": {"command": "mkdir -p output && date > output/report.txt", "timeout_s": 600, "save_artifacts": true},
  "schedule": {"cron": "0 7 * * 1-5", "timezone": "Europe/Prague"},
  "max_cost": "0.10"
}'   # for CZK use "2.50"
```

## How to tell it worked

- You see the next three planned times.
- The test run ends as `completed`, and its job has `output/report.txt`.
- In the portal, *Schedules* lists it with its next run and its history.

## If it doesn't work

| What you see | What to do |
| --- | --- |
| `403 feature_disabled` | Schedules are not enabled for your account yet – see the box at the top. |
| `403 schedule_too_frequent` | Your plan does not allow runs this often (at most once an hour on Free). |
| `409 trigger_limit` | You have as many schedules as your plan allows (2 on Free). Delete one you do not need. |
| The schedule is paused | After 5 failed runs in a row it pauses and you get an e-mail with the last error. Fix the command and resume it in the portal. |

## What it costs

Every run is billed like a background job, and `max_cost` limits each run. You can also set `max_cost_per_day` for all runs of one day.

## Next steps

- [Schedules & webhooks](https://sandbox.wbx.cz/docs/jobs/schedules.md): All fields, cron syntax, limits and the API.
- [Run from a webhook](https://sandbox.wbx.cz/docs/howto/webhook.md): Start the same job when another service calls a URL.
- [Cap my spending](https://sandbox.wbx.cz/docs/howto/budget.md): A monthly limit on top of the per-run limit.

Source: https://sandbox.wbx.cz/docs/howto/schedule
