---
title: "Register a trigger"
method: POST
path: "/v1/triggers"
tags: ["Triggers"]
---

# Register a trigger

`POST /v1/triggers`

## Request

- Base URL: `https://api.algenta.ai`
- URL: `https://api.algenta.ai/v1/triggers`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

## Request body

- RegisterTriggerRequest
  - `name` string, required
  - `condition` TriggerCondition, required
    - `source_id` string, required
    - `metric_hint` string, required
    - `threshold` number, required
    - `direction` 'above' | 'below' | 'change', required
    - `aggregation` 'sum' | 'avg' | 'max' | 'min' | 'count'
  - `simulation_template` object, required: SimulateRequest-compatible payload to run when trigger fires.
  - `webhook_url` string, nullable: HTTPS endpoint to POST notification results to.
  - `execution_webhook_url` string, nullable: When set and auto_execute=true, the full DecisionPlan is POSTed here as an actionable execution payload (same format as POST /v1/decisions/{id}/execute).
  - `auto_execute` boolean: If true, automatically dispatch the decision to execution_webhook_url after every successful trigger fire.
  - `description` string, nullable

## Response `201`

Successful Response

- TriggerSummary
  - `trigger_id` string, required
  - `org_id` string, required
  - `name` string, required
  - `status` 'active' | 'paused', required
  - `condition` TriggerCondition, required
    - `source_id` string, required
    - `metric_hint` string, required
    - `threshold` number, required
    - `direction` 'above' | 'below' | 'change', required
    - `aggregation` 'sum' | 'avg' | 'max' | 'min' | 'count'
  - `description` string, nullable, required
  - `webhook_url` string, nullable, required
  - `execution_webhook_url` string, nullable
  - `auto_execute` boolean
  - `created_at` string, date-time, required
  - `last_checked_at` string, date-time, nullable, required
  - `last_fired_at` string, date-time, nullable, required
  - `last_result_summary` string, nullable, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/codna/apis/algenta-api.md) · [All operations](https://skmtc.dev/codna/apis/algenta-api/llms.txt) · [OpenAPI document](https://skmtc.dev/codna/apis/algenta-api/revisions/35d30f84a5df?raw)
