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

# CLI tasks commands

> Use these commands to trigger tasks from your terminal.

## tasks trigger

Triggers a task and prints the run ID and its dashboard URL. It runs in the `dev` environment unless you pass `--env`, so start the [dev command](/docs/cli-dev-commands) first.

<CodeGroup>
  ```bash npm theme={"theme":"css-variables"}
  npx trigger.dev@latest tasks trigger hello-world --payload '{"name":"Ada"}'
  ```

  ```bash pnpm theme={"theme":"css-variables"}
  pnpm dlx trigger.dev@latest tasks trigger hello-world --payload '{"name":"Ada"}'
  ```

  ```bash yarn theme={"theme":"css-variables"}
  yarn dlx trigger.dev@latest tasks trigger hello-world --payload '{"name":"Ada"}'
  ```
</CodeGroup>

Add `--wait` to wait for the run to finish. It prints the run's output, or its error and exits with code 1 if the run failed, which makes it useful in scripts and for coding agents testing a task:

```bash theme={"theme":"css-variables"}
npx trigger.dev@latest tasks trigger hello-world --payload '{"name":"Ada"}' --wait
```

The command fails without creating a run if the current version has no task with that ID. In `dev`, it warns you when the dev command isn't running, because the run waits in the queue until it starts.

<ParamField body="Payload" type="--payload">
  The payload as JSON, e.g. `--payload '{"name":"Ada"}'`. Without it, the task gets no payload.
</ParamField>

<ParamField body="Payload file" type="--payload-file">
  Read the payload from a JSON file instead.
</ParamField>

<ParamField body="Wait" type="--wait">
  Wait for the run to finish, then print its output or error.
</ParamField>

<ParamField body="Timeout" type="--timeout">
  With `--wait`, stop waiting after this many seconds and exit with code 1.
</ParamField>

<ParamField body="Tag" type="--tag">
  A tag to add to the run. Repeat it to add more than one, e.g. `--tag cli --tag test`.
</ParamField>

<ParamField body="Idempotency key" type="--idempotency-key">
  If a run with this key already exists, return it instead of creating a new one. See [idempotency](/docs/idempotency).
</ParamField>

<ParamField body="Delay" type="--delay">
  Wait before running, e.g. `30s`, `5m` or an ISO 8601 date.
</ParamField>

<ParamField body="TTL" type="--ttl">
  Expire the run if it hasn't started within this time, e.g. `10m`.
</ParamField>

<ParamField body="Queue" type="--queue">
  The queue to run in, instead of the queue set on the task.
</ParamField>

<ParamField body="Machine" type="--machine">
  The machine to run on, e.g. `small-2x`. See [machines](/docs/machines). Has no effect in `dev`.
</ParamField>

## Options

<ParamField body="Environment" type="--env | -e">
  The environment to use: `dev`, `prod`, `staging` or `preview`. Defaults to `dev`.
</ParamField>

<ParamField body="Config file" type="--config | -c">
  The name of the config file found at the project path. Defaults to `trigger.config.ts`
</ParamField>

<ParamField body="Project ref" type="--project-ref | -p">
  The project ref. Required if there is no config file.
</ParamField>

<ParamField body="Branch" type="--branch | -b">
  The branch to use. Required with `--env preview`. In `dev`, it defaults to the same [dev branch](/docs/deployment/dev-branches) as the dev command.
</ParamField>

### Common options

These options are available on most commands.

<ParamField body="Login profile" type="--profile">
  The login profile to use. Defaults to the current profile, which is set by your last `login` or `switch` (initially "default").
</ParamField>

<ParamField body="API URL" type="--api-url | -a">
  Override the default API URL. If not specified, it uses `https://api.trigger.dev`. This can also be set via the `TRIGGER_API_URL` environment variable.
</ParamField>

<ParamField body="Log level" type="--log-level | -l">
  The CLI log level to use. Options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This does not affect the log level of your trigger.dev tasks. Defaults to `log`.
</ParamField>

<ParamField body="Skip telemetry" type="--skip-telemetry">
  Opt-out of sending telemetry data. This can also be done via the `TRIGGER_TELEMETRY_DISABLED` environment variable. Just set it to anything other than an empty string.
</ParamField>

<ParamField body="Help" type="--help | -h">
  Shows the help information for the command.
</ParamField>

<ParamField body="Version" type="--version | -v">
  Displays the version number of the CLI.
</ParamField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.