> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heylua.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# lua triggers

> Create, list, inspect, rotate, and delete the triggers that wake the agent from a URL

`lua triggers` manages [triggers](/concepts/triggers): URLs that start an agent turn, run one tool, or start a workflow when something POSTs to them. `create` prints a URL that works immediately; `rotate-token` and `delete` stop the current URL immediately.

*Verified against lua-cli 3.33.0.*

## Synopsis

```bash theme={null}
lua triggers [list|create|logs|activate|deactivate|rotate-token|delete] [--name <name>] [--description <text>] [--instruction <text>] [--trigger <name|id>] [--limit <n>] [--json] [--force]
```

## Description

The command handles two kinds of trigger. A URL trigger is created here with `create` and needs no code; every POST becomes an agent turn that carries the request body and, if you set one, the `--instruction` text. An SDK trigger is defined with [`defineTrigger`](/reference/sdk/luatrigger) and uploaded with `lua push trigger`; it adds `verify`, `filter`, and `transform` slots and can start a workflow instead of an agent turn. `list` shows both, with `Type: URL` or `Type: SDK`.

`create` prints the trigger's URL; `list` shows it again. The token inside the URL is the only credential for a URL trigger, so treat it like an API key. If it leaks, `rotate-token` invalidates it and prints a replacement URL; the old one stops working immediately.

`logs` prints executions newest first, 20 by default, with a status, the payload and response snippets, the tools the agent used, and for workflow starts the run ID with the `lua workflows status` command to follow it. With `--json` it prints the server response unchanged.

`activate` and `deactivate` turn a trigger on or off without changing anything else. Requests to a deactivated trigger are recorded as skipped.

`delete` asks for confirmation unless `--force` is given, in the non-interactive form too. A trigger with deployed SDK versions is deactivated instead of deleted. Execution history is kept until it expires.

`--trigger` matches the name or the ID. Every form needs a project directory and a credential. The flags `--webhook-id`, `--connection-id`, and `--connection`, and the actions `pause`, `resume`, `events`, `on`, `off`, `stop`, `start`, and `list-events`, belong to integration webhooks: the command prints a pointer to [`lua integrations webhooks`](/reference/cli/integrations) and exits `0` without doing anything.

### Execution statuses

| Status in `logs`                                        | Meaning                                                                                   |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `COMPLETED`                                             | The agent turn finished; the response snippet is shown.                                   |
| `ACCEPTED (in flight)`                                  | Received less than two minutes ago; the turn is still running.                            |
| `TIMED OUT (no completion recorded)`                    | Accepted more than two minutes ago with no completion recorded.                           |
| `FAILED`                                                | A slot threw, `transform` returned nothing, or the agent turn failed; the error is shown. |
| `REJECTED (verify failed → 401)`                        | The SDK trigger's `verify` slot returned false.                                           |
| `SKIPPED (filtered out)`                                | The `filter` slot returned false; acknowledged, no agent turn.                            |
| `SKIPPED (trigger inactive)`                            | The trigger was deactivated when the request arrived.                                     |
| `STARTED WORKFLOW (no agent turn)`                      | A workflow run started; `Workflow run: <runId>` follows.                                  |
| `SKIPPED (a run of that workflow is already in flight)` | The target workflow forbids overlapping runs.                                             |

## Arguments

| Argument | Values                                                                       | Description               |
| -------- | ---------------------------------------------------------------------------- | ------------------------- |
| `action` | `list`, `create`, `logs`, `activate`, `deactivate`, `rotate-token`, `delete` | Omit it to open the menu. |

Accepted spellings: `view`, `show`, `ls`, `l` → `list`; `new`, `add` → `create`; `history`, `executions`, `runs`, `log` → `logs`; `enable` → `activate`; `disable` → `deactivate`; `rotate`, `rotate_token`, `rotatetoken` → `rotate-token`; `rm`, `remove`, `del` → `delete`. `on` and `off` are not aliases here.

## Options

| Option                 | Description                                                                                 | Default |
| ---------------------- | ------------------------------------------------------------------------------------------- | ------- |
| `--name <name>`        | Trigger name. Required for `create`.                                                        | —       |
| `--description <text>` | Description stored with the trigger. `create` only.                                         | —       |
| `--instruction <text>` | Text sent to the agent on every fire, ahead of the payload. `create` only.                  | —       |
| `--trigger <name\|id>` | Trigger to act on. Required for `logs`, `activate`, `deactivate`, `rotate-token`, `delete`. | —       |
| `--limit <n>`          | Executions to show for `logs`. Maximum 200.                                                 | `20`    |
| `--json`               | Machine-readable output for `list` and `logs`.                                              | off     |
| `--force`              | Skip the `delete` confirmation.                                                             | off     |
| `--ci`                 | Global flag. Refuse any prompt with exit `1` instead of waiting for input.                  | off     |

## Examples

List triggers as JSON; an agent with none prints an empty array.

```bash theme={null}
lua triggers list --json
```

```text Output theme={null}
[]
```

Create a URL trigger with an instruction; the command prints the URL to paste.

```bash theme={null}
lua triggers create --name daily-time --instruction "Reply with the current date and time" --ci
```

Read the five most recent executions as JSON.

```bash theme={null}
lua triggers logs --trigger daily-time --limit 5 --json
```

Invalidate a leaked URL and print the replacement.

```bash theme={null}
lua triggers rotate-token --trigger daily-time --ci
```

Delete a trigger from CI without the confirmation prompt.

```bash theme={null}
lua triggers delete --trigger daily-time --force --ci
```

## Exit codes

| Code | Meaning     | When                                                                                                                                                          |
| ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `0`  | OK          | The action completed, including a cancelled `delete` and the integration-webhook redirect.                                                                    |
| `1`  | Error       | `--trigger` names a trigger that does not exist, the server refused the action, or a prompt was needed under `--ci` (for example `delete` without `--force`). |
| `2`  | Usage       | Unknown action, `create` without `--name`, or another action without `--trigger`.                                                                             |
| `9`  | Auth        | No valid credential.                                                                                                                                          |
| `10` | Forbidden   | The credential cannot manage this agent.                                                                                                                      |
| `11` | Unavailable | Network error or a server 5xx.                                                                                                                                |

The full table is in [Errors and exit codes](/reference/cli/errors-and-exit-codes).

## See also

* [`defineTrigger`](/reference/sdk/luatrigger) — SDK triggers with `verify`, `filter`, `transform`, and `startWorkflow`
* [Create a trigger](/build/create-a-trigger)
* [`lua webhooks`](/reference/cli/webhooks) — endpoints whose response your code owns
* [`lua workflows`](/reference/cli/workflows) — follow a run a trigger started
* [`lua integrations`](/reference/cli/integrations) — integration webhooks from Linear, HubSpot, and other integrations
