{
 "openapi": "3.1.0",
 "info": {
  "title": "Triggers (Agentic AI)",
  "version": "20261030b",
  "description": "What starts a run. A trigger created from a template is never armed — a new tenant should not have agents running before anybody has read what they do."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "triggers": {
    "type": "object",
    "required": [
     "code",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "code": {
      "type": "string",
      "description": "Code"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "name_local": {
      "type": "string",
      "description": "Name local"
     },
     "workflow_id": {
      "type": "string",
      "format": "uuid",
      "description": "Workflow"
     },
     "agent_id": {
      "type": "string",
      "format": "uuid",
      "description": "Agent"
     },
     "trigger_kind": {
      "type": "string",
      "description": "Kind"
     },
     "schedule_id": {
      "type": "string",
      "format": "uuid",
      "description": "Schedule id",
      "readOnly": true
     },
     "cron_expr": {
      "type": "string",
      "description": "Schedule"
     },
     "timezone": {
      "type": "string",
      "description": "Time zone"
     },
     "event_name": {
      "type": "string",
      "description": "Event"
     },
     "target_module": {
      "type": "string",
      "description": "Module"
     },
     "target_resource": {
      "type": "string",
      "description": "Resource"
     },
     "record_event": {
      "type": "string",
      "description": "When a record is",
      "enum": [
       "created",
       "updated",
       "deleted",
       "status_changed"
      ]
     },
     "filter_expr": {
      "type": "string",
      "description": "Only when"
     },
     "cube_key": {
      "type": "string",
      "description": "Cube"
     },
     "measure_key": {
      "type": "string",
      "description": "Measure"
     },
     "comparator": {
      "type": "string",
      "description": "Crosses",
      "enum": [
       "gt",
       "gte",
       "lt",
       "lte",
       "eq",
       "neq",
       "changes_by"
      ]
     },
     "threshold_value": {
      "type": "string",
      "format": "decimal",
      "description": "Threshold"
     },
     "webhook_path": {
      "type": "string",
      "description": "Webhook path"
     },
     "webhook_secret_cipher": {
      "type": "string",
      "description": "Webhook secret cipher",
      "readOnly": true
     },
     "webhook_secret_last4": {
      "type": "string",
      "description": "Webhook secret last4",
      "readOnly": true
     },
     "min_interval_seconds": {
      "type": "integer",
      "description": "Never more often than (seconds)"
     },
     "max_per_day": {
      "type": "integer",
      "description": "Most per day"
     },
     "fired_count": {
      "type": "string",
      "format": "decimal",
      "description": "Fired count",
      "readOnly": true
     },
     "last_fired_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last fired at",
      "readOnly": true
     },
     "next_due_at": {
      "type": "string",
      "format": "date-time",
      "description": "Next due at",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "enum": [
       "inactive",
       "active",
       "paused",
       "error"
      ]
     },
     "last_error": {
      "type": "string",
      "description": "Last error",
      "readOnly": true
     },
     "is_active": {
      "type": "boolean",
      "description": "Is active"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "last_value": {
      "type": "string",
      "format": "decimal",
      "description": "Last value",
      "readOnly": true
     },
     "last_state": {
      "type": "boolean",
      "description": "Last state",
      "readOnly": true
     },
     "last_checked_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last checked at",
      "readOnly": true
     },
     "claimed_by": {
      "type": "string",
      "description": "Claimed by",
      "readOnly": true
     },
     "claimed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Claimed at",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/agentic/triggers": {
   "get": {
    "summary": "list triggers",
    "operationId": "list_triggers_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create triggers",
    "operationId": "create_triggers_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/agentic/triggers/{id}": {
   "get": {
    "summary": "get triggers",
    "operationId": "get_triggers_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change triggers",
    "operationId": "change_triggers_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete triggers",
    "operationId": "delete_triggers_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/agentic/triggers/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_triggers_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}