Webhook Trigger
POST /api/flows/{flow_id}/trigger lets any system that can send an HTTP request
start a flow run, without learning the rest of the REST API. A pre-shared secret
controls access. Ciaren also has a second, outbound webhook that alerts you when
a run fails; it is covered under Failure notifications.
Configuration
Set CIAREN_WEBHOOK_SECRET to any non-empty string before starting the server:
# .env file (recommended)
CIAREN_WEBHOOK_SECRET=my-strong-secret-hereor inline:
CIAREN_WEBHOOK_SECRET=my-strong-secret-here ciaren serveWhen the variable is unset, the trigger endpoint returns 404, so a fresh
install has no open trigger surface. The endpoint is exempt from
CIAREN_API_TOKEN: it authenticates with the webhook secret alone.
Generating a strong secret
python -c "import secrets; print(secrets.token_urlsafe(32))"Checking whether the webhook is active
curl http://localhost:8055/api/settings/webhook
# → {"configured": true}The response never includes the secret itself.
Triggering a run
Send a POST to /api/flows/{flow_id}/trigger with the secret in the
X-Ciaren-Secret header. The body is optional.
curl -X POST http://localhost:8055/api/flows/FLOW_ID/trigger \
-H "X-Ciaren-Secret: my-strong-secret-here" \
-H "Content-Type: application/json"The request blocks until the run finishes and returns the run object:
{
"id": "run-abc123",
"flow_id": "FLOW_ID",
"status": "success",
"trigger": "webhook",
"engine": "polars",
"started_at": "2026-06-25T14:00:01",
"finished_at": "2026-06-25T14:00:03",
"output_location": "run-abc123/out1.csv",
...
}Check status: "success" or "failed". On failure, error_message holds the
reason. A flow that fails while running still answers with HTTP 200, so test
status rather than the HTTP code.
Passing options
curl -X POST http://localhost:8055/api/flows/FLOW_ID/trigger \
-H "X-Ciaren-Secret: my-strong-secret-here" \
-H "Content-Type: application/json" \
-d '{
"engine": "pandas",
"parameters": { "date": "2026-06-25", "limit": 5000 }
}'The flow must declare date and limit as parameters; a
flow without them answers 400 with declares no parameters, but overrides were given.
| Field | Type | Description |
|---|---|---|
engine | "polars" | "pandas" | Engine override for this run |
parameters | object | Flow-parameter overrides (name → value) |
Avoiding duplicate runs on retry
A client that retries a request it isn't sure landed (a timeout, a dropped
connection) risks starting the same run twice. Pass an Idempotency-Key
header with a value unique to that logical trigger (e.g. the CI job's run id):
curl -X POST http://localhost:8055/api/flows/FLOW_ID/trigger \
-H "X-Ciaren-Secret: my-strong-secret-here" \
-H "Idempotency-Key: ci-run-482910" \
-H "Content-Type: application/json"A second request with the same key for the same flow returns the original run instead of starting a new one, so you can retry safely. A different flow, or a request with no key, always starts a fresh run.
Error responses
| Status | Reason |
|---|---|
404 | CIAREN_WEBHOOK_SECRET is not configured, or the flow ID does not exist |
403 | The header is missing or does not match the secret |
400 | The flow is disabled, the engine is unknown, or the body sets parameters the flow does not declare |
GitHub Actions example
- name: Trigger Ciaren pipeline
run: |
status=$(curl -sf -X POST ${{ vars.CIAREN_URL }}/api/flows/${{ vars.FLOW_ID }}/trigger \
-H "X-Ciaren-Secret: ${{ secrets.CIAREN_WEBHOOK_SECRET }}" \
-H "Content-Type: application/json" \
| python3 -c "import json, sys; print(json.load(sys.stdin)['status'])")
echo "Run status: $status"
test "$status" = "success"Store the server URL and flow ID as Actions variables and the secret as an Actions
secret. curl -f fails the step on an HTTP error, and the last line fails it when
the run itself failed.
Airflow example
from airflow.providers.http.operators.http import SimpleHttpOperator
trigger = SimpleHttpOperator(
task_id="trigger_ciaren",
method="POST",
http_conn_id="ciaren_server", # configured in Airflow connections
endpoint=f"/api/flows/{FLOW_ID}/trigger",
headers={"X-Ciaren-Secret": "{{ var.value.ciaren_webhook_secret }}"},
response_check=lambda r: r.json()["status"] == "success",
)Security notes
- Ciaren compares the secret in constant time (
hmac.compare_digest). - Use HTTPS in production, so the secret never travels in plain text.
- To rotate the secret, change
CIAREN_WEBHOOK_SECRETand restart the server. Every caller must switch to the new value at the same time.
Failure notifications
The outbound webhook tells you about failures without watching the UI. Set
CIAREN_NOTIFY_WEBHOOK_URL and Ciaren sends a JSON POST there when:
- a run fails, whatever started it (event
run_failed), or - a schedule disables itself after too many failures (event
schedule_auto_disabled).
Point it at a chat webhook bridge, an ntfy topic, or any internal endpoint.
{
"event": "run_failed",
"timestamp": "2026-06-25T14:00:03+00:00",
"flow_id": "FLOW_ID",
"flow_name": "Daily sales",
"run_id": "run-abc123",
"trigger": "schedule",
"engine": "polars",
"error": "Column 'amount' not found"
}A schedule_auto_disabled event carries schedule_id, flow_id, reason,
consecutive_failures, and last_run_id instead.
- If
CIAREN_NOTIFY_WEBHOOK_SECRETis set, Ciaren sends it asX-Ciaren-Secret, so the receiver can reject spoofed posts. - Delivery is best effort. It runs in the background with a 5 second timeout, does not retry, and never fails the run. Redirects are refused, so the receiver must answer at the configured URL.
- The URL is an environment variable only. It is not editable in the UI or the
REST API, which keeps it from becoming a way to make the server call arbitrary
hosts.
CIAREN_CONNECTOR_BLOCK_PRIVATE_HOSTSapplies to it too.
See also
- Python SDK: a typed Python client for this endpoint
- Scheduling: cron triggers that need no caller
- REST API: Runs: the full runs API
- Configuration Reference