> Source: https://wexa.ai/docs/automation/set-triggers

# set-triggers

[Can be held for approval](/docs/sdks-and-apis/how-every-tool-call-works#lifecycle-and-governance)

Replace the triggers on one agent, connector, table or column. This is a full replace: an empty list clears them. Needs the `fabric:orchestrate.write` grant.

**Clear a table's triggers**

**Wexa MCP server**

```bash
curl -sS -X POST https://fabric.wexa.ai/mcp/$FABRIC_PROJECT_ID \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "Mcp-Session-Id: $MCP_SESSION_ID" \
  -H "content-type: application/json" -H "accept: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"set-triggers","arguments":{"target_id":"6ab1944e7566f41b5c28e2eb","target_type":"table","triggers":[]}}}'
```

```json
{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000191\",\"result\":{\"target_id\":\"6ab1944e7566f41b5c28e2eb\",\"target_type\":\"table\",\"triggers\":[]}}"
    }
  ],
  "isError": false
}
```

**REST API**

```bash
curl -sS https://fabric.wexa.ai/v1/set-triggers \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "content-type: application/json" \
  -d '{"target_id":"6ab1944e7566f41b5c28e2eb","target_type":"table","triggers":[]}'
```

```json
{
  "lifecycle_id": "qlc_000191",
  "result": {
    "target_id": "6ab1944e7566f41b5c28e2eb",
    "target_type": "table",
    "triggers": []
  }
}
```

**TypeScript SDK**

```ts
import { Fabric } from '@wexa-fabric/sdk'

const fabric = new Fabric()
const result = await fabric.setTriggers({
  target_id: '6ab1944e7566f41b5c28e2eb',
  target_type: 'table',
  triggers: []
})
```

```ts
// result is the payload itself, with no `.result` to read
{
  target_id: '6ab1944e7566f41b5c28e2eb',
  target_type: 'table',
  triggers: []
}
```

**Python SDK**

```python
from wexa import Fabric

fabric = Fabric()
out = fabric.set_triggers(
    target_id="6ab1944e7566f41b5c28e2eb",
    target_type="table",
    triggers=[],
)
```

```python
# out is the result, already unwrapped
{
    "target_id": "6ab1944e7566f41b5c28e2eb",
    "target_type": "table",
    "triggers": []
}
```

## Parameters

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `target_id` | string | Required | agent: `<container>.<agent>`. connector: the connector id. table: the table id. column: `<table_id>.<column_id>`. Non-empty; a target of that kind in this project; a connector that is not found is reported as 502. A column id not in `<table_id>.<column_id>` form is refused. |
| `target_type` | string | Required | One of: `agent`, `connector`, `table`, `column`. Any other value is refused. |
| `triggers` | array | Required | The target's complete trigger list. A full replace: whatever is sent becomes the target's triggers, and `[]` clears them. Required. Each trigger needs `name`, `goal` and `agentflow_id`; the object is described under More details. A trigger that is not an object, lacks `name` or `goal`, or lacks a well-formed `agentflow_id`, is refused; so is a connector trigger without `event`. |

**Show full response**

A real response, captured from a live call to `set-triggers`:

**Result of set-triggers**

**REST API**

```json
{
  "lifecycle_id": "qlc_000191",
  "result": {
    "target_id": "6ab1944e7566f41b5c28e2eb",
    "target_type": "table",
    "triggers": []
  }
}
```

**TypeScript SDK**

```ts
// the object you get back IS the result — there is no `.result` to read
{
  target_id: '6ab1944e7566f41b5c28e2eb',
  target_type: 'table',
  triggers: []
}

// The TS SDK names these camelCase — lifecycleId, traceId — where Python uses
// lifecycle_id and trace_id. Both are non-enumerable: readable, but omitted by
// Object.keys() and JSON.stringify(). `result.lifecycleId` here is undefined.
result.lifecycleId // 'qlc_000191'
```

**Python SDK**

```python
# a dict subclass; `result` is already unwrapped
{
 "target_id": "6ab1944e7566f41b5c28e2eb",
 "target_type": "table",
 "triggers": []
}

out.lifecycle_id  # 'qlc_000191' — an attribute, not a key
```

**More details**

This is a full replace, the same as the console's trigger editor: the list sent becomes the target's triggers, and every other property of the target is read back and written unchanged. **A trigger object.** `name`, `goal` and `agentflow_id` (24-character hex, from `list-agents` or `get-process-flow`; the part of a compound agent id before the dot is used) are required. Optional: `start_from_agent_id` (the agent inside the process flow to start from), `trigger_id` (or `_id`, to keep an existing trigger's id), `search_filters` (a list of `{column, operator, value, type}` like the filters on a schedule's `table`) and `condition`. A connector trigger also requires `event`, a named event on the connector (list them with `connector-read` on the connector's trigger actions). On a table or column target, `condition` is `{condition_for, condition_query}`: `condition_for` is `insert` (the default on a table), `update` or `delete`, and a column trigger must use `update` (it is the default there); an empty `condition_query` is built from `search_filters`. Any other `condition_for` is refused.

The trigger's internal kind is set from the target and is not a parameter.

A connector's triggers go through the connector's own update path, which re-registers the event subscription, so a trigger wired here is live. A table trigger fires on a row insert, update or delete, chosen with `condition.condition_for` and narrowed by `search_filters`. A column trigger is only evaluated when that column changes, so its `condition_for` is always `update`.

For what a trigger names and how a triggered run behaves, see [`list-triggers`](/docs/automation/list-triggers).

When the project's write gate is on, a call made with an API key or an SDK session waits for a person to approve it: the call returns `202` and an `ApprovalRequired` error carrying the approval id and a resume token, and the SDKs can wait for the decision and resume. The gate is off by default; a project admin can turn it on, or back off, in the project's settings, and it then holds admin API keys too. Actions taken by a person in the console are not held.

Marked consequential: it is audited in full, and a policy rule may hold it for a person to approve. See [Policy and approvals](/docs/governance/policy-and-approvals).

Every tool call works the same way: [How every tool call works](/docs/sdks-and-apis/how-every-tool-call-works).
