Register a trigger
Register a threshold condition on a data source, fire it to run an attached simulation, pause or resume it, and delete it — with optional webhook and auto-execution dispatch.
A trigger watches one metric on a data source and, when that metric crosses a threshold you set, runs an attached simulation template. The result is logged to decision memory and — if you attached webhook URLs — pushed to your endpoints. Triggers turn "re-run this analysis whenever the number moves" into a single registered object you fire on demand.
This guide covers the full lifecycle: register a trigger, fire it, pause and resume it, and delete it. All routes live under /v1/triggers and require Authorization: Bearer $ALGENTA_API_KEY.
Before you start
You need:
A registered data source id (
source_id) and the metric you want to watch. See Connect a data source.A
simulation_template— any payload accepted by/v1/simulate. The engine runs it verbatim each time the trigger fires.
Create the trigger
The condition names the source, the metric hint, an aggregation, a threshold, and a direction (above, below, or change). Attach a webhook_url for a result summary, and set auto_execute with an execution_webhook_url to dispatch the full decision plan for action.
POST /v1/triggers
curl -sS -X POST "https://api.algenta.ai/v1/triggers" \
-H "Authorization: Bearer $ALGENTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "revenue-drop",
"condition": {
"source_id": "'"$SOURCE_ID"'",
"metric_hint": "revenue",
"threshold": 100000,
"direction": "below",
"aggregation": "sum"
},
"simulation_template": {
"mode": "auto",
"scenario": {
"variables": { "revenue": { "low": 80000, "high": 200000 } },
"objective": "maximize_net_value"
},
"runs": 10000,
"seed": 42
},
"webhook_url": "https://example.com/algenta/webhook",
"description": "Re-simulate the quarter when revenue falls below target."
}'Condition fields
source_id
string
The registered source to watch.
metric_hint
string
The metric to aggregate and compare.
threshold
number
The value the metric is compared against.
direction
above | below | change
above/below compare to the threshold; change fires on every evaluation.
aggregation
sum | avg | max | min | count
How the metric is aggregated. Defaults to sum.
List triggers
GET /v1/triggers returns your org's triggers, newest fields included. Filter by status (active, paused, or all) and page with page and limit.
The 200 TriggerListResponse carries triggers, plus count, total, page, limit, and pages for pagination.
Fire a trigger
Firing evaluates the condition against the source's current value. If the condition is met (or you pass force: true), the engine runs the simulation template, records the outcome on the trigger, and dispatches any attached webhooks.
POST /v1/triggers/{trigger_id}/fire
The 200 FireTriggerResponse reports condition_met, fired, the simulation_run_id, and the simulation's recommended_action, expected_value, and confidence. When the trigger has auto_execute set, execution_status is dispatched (the decision plan was sent to the execution webhook) or skipped_uncalibrated (execution policy blocked it).
Pause, resume, and delete
Pause a trigger to stop it firing without deleting it, then resume it later. Deleting removes it permanently.
PATCH /v1/triggers/{trigger_id}/pause sets the status. Pass paused=false to resume.
DELETE /v1/triggers/{trigger_id} returns 204 No Content.
Next steps
Last updated
Was this helpful?