Schedules and webhooks
Start workflow runs on a cron schedule or from an HTTP call.
Two ways to start a workflow without pressing Execute
A workflow can run on a cron schedule, or when an outside system calls a secret URL. Both need the workflow to have generated code. Both start an ordinary run that you can follow on the Experiments page.
Webhooks
| Route | What it does |
|---|---|
| POST /api/v1/workflows/<workflow_id>/webhook | Create a token, or rotate the existing one. Returns webhook_url and token. The URL has the form <host>/api/v1/webhooks/<token>. |
| GET /api/v1/workflows/<workflow_id>/webhook | Read the URL. 404 when none exists. |
| DELETE /api/v1/workflows/<workflow_id>/webhook | Revoke the token. |
The management routes need you to be signed in. The receiver does not: anyone who has the URL can start the workflow, so treat the token as a secret and rotate it if it leaks.
curl -X POST http://127.0.0.1:5001/api/v1/webhooks/<token> \
-H "Content-Type: application/json" \
-d '{"source": "nightly-export"}'
- Methods GET and POST both work.
- A POST body must be a JSON object. Query string values are merged into it.
- The payload may be at most 16384 bytes.
- Success is 202 with success, run_id and message.
- An unknown token gives 404. A workflow without generated code gives 400 with Workflow has no generated code.
- The run is recorded with triggered_by set to webhook and auto_install off.
Schedules
| Route | What it does |
|---|---|
| POST /api/v1/workflows/<workflow_id>/schedule | Set a schedule. Body cron_expression (up to 256 characters, standard five field crontab) and timezone (default UTC, up to 64 characters). Returns success, next_run, cron and timezone. |
| DELETE /api/v1/workflows/<workflow_id>/schedule | Remove the schedule. |
| GET /api/v1/schedules | List schedules. You see your own. Administrators see all. |
curl -X POST http://127.0.0.1:5001/api/v1/workflows/7/schedule \
-H "X-API-Key: <your-key>" -H "Content-Type: application/json" \
-d '{"cron_expression": "0 6 * * *", "timezone": "UTC"}'
- Schedules are driven by APScheduler. If it is not installed, schedules do not fire.
- Saved schedules are loaded again when the application starts.
- A run missed by up to 300 seconds (for example while the app was busy) is still started.
- The application must be running when the time arrives. There is no separate scheduler service.