# Neon CLI command: triggers

The `triggers` command manages function triggers on a branch. A trigger invokes a [Neon Function](/guides/neon-functions-index) on a cron schedule (`schedule`), or when an object is created in an [Object Storage](/guides/object-storage-index) bucket (`storage_object_created`). Use it to run recurring work like a nightly report or cleanup job, or to process uploads as they land, without a separate scheduler. You deploy the function with [`neon functions deploy`](/guides/apis-sdks-cli-functions), then point a trigger at it by slug.

Triggers are branch-scoped. Pass `--project-id` and `--branch` to target a branch, or let the CLI resolve them from your [context file](/guides/apis-sdks-cli-link). Triggers can also be inherited: a trigger created on a parent branch is visible on its child branches, where the `Inherited` column shows `true`. An inherited trigger stays disabled on the child until you enable it there with [`neon triggers enable`](#neon-triggers-enable).

Subcommands: [create](#neon-triggers-create), [delete](#neon-triggers-delete), [disable](#neon-triggers-disable), [enable](#neon-triggers-enable), [get](#neon-triggers-get), [list](#neon-triggers-list), [update](#neon-triggers-update)

## neon triggers list

Lists the triggers on the branch.

```bash
neon triggers list [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | -------- |
| `--branch`     | Branch ID or name | string | —       | No       |
| `--project-id` | Project ID        | string | —       | No       |

```bash
neon triggers list --project-id solitary-heart-93902637 --branch main
```

The `Type` column shows each trigger's type, currently `schedule` or `storage_object_created`. `Schedule` holds the cron for schedule triggers; `Storage` holds the bucket (and prefix, if set) for storage triggers.

```title="Output"
Trigger Id                                    Name            Type                    Function Slug  Function Path  Schedule   Storage        Enabled  Inherited  Next Run At
trigger-12345678-90ab-cdef-1234-567890abcdef  nightly-report  schedule                child404       /              0 6 * * *                 true     false      2026-09-11T06:00:00.000000Z
trigger-abcdef12-3456-7890-abcd-ef1234567890  on-upload       storage_object_created  ingest         /object                       assets logos/  true     false
```

## neon triggers get

Shows a single trigger by ID.

```bash
neon triggers get <id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | -------- |
| `--branch`     | Branch ID or name | string | —       | No       |
| `--project-id` | Project ID        | string | —       | No       |

```bash
neon triggers get trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main --output json
```

:::accordion{title="Show output"}
```json
{
  "type": "schedule",
  "trigger_id": "trigger-12345678-90ab-cdef-1234-567890abcdef",
  "function_slug": "child404",
  "name": "nightly-report",
  "function_path": "/",
  "schedule": {
    "cron": "0 6 * * *"
  },
  "enabled": true,
  "version": 1390408,
  "next_run_at": "2026-09-11T06:00:00.000000Z",
  "inherited": false
}
```
:::

A `storage_object_created` trigger has `storage_object_created` (bucket and optional prefix) in place of `schedule`, and no `next_run_at`:

:::accordion{title="Show output"}
```json
{
  "type": "storage_object_created",
  "trigger_id": "trigger-abcdef12-3456-7890-abcd-ef1234567890",
  "function_slug": "ingest",
  "name": "on-upload",
  "function_path": "/object",
  "storage_object_created": {
    "bucket_name": "assets",
    "prefix": "logos/"
  },
  "enabled": true,
  "version": 1390512,
  "inherited": false
}
```
:::

## neon triggers create

Creates a trigger that invokes a function on a cron schedule or when an object is created. `--function-slug` and `--name` are required, and the name must be unique on the branch. Choose the type with one of:

- `--cron` for a `schedule` trigger, a five-field UTC cron expression.
- `--bucket` for a `storage_object_created` trigger, with an optional `--prefix` to match only object keys under that prefix.

`--cron` and `--bucket` are mutually exclusive (`Pass --cron or --bucket, not both.`), and `--prefix` requires `--bucket`.

Object-created triggers (`--bucket` and `--prefix`) require Neon CLI 4.21.0 or later. On an older CLI, `--bucket` isn't recognized and `create` reports a missing `--cron` argument instead.

```bash
neon triggers create [options]
```

| Option            | Description                                               | Type    | Default | Required |
| ----------------- | --------------------------------------------------------- | ------- | ------- | -------- |
| `--bucket`        | Object-storage bucket to watch (storage\_object\_created) | string  | —       | No       |
| `--cron`          | Five-field UTC cron expression, e.g. '\*/15 \* \* \* \*'  | string  | —       | No       |
| `--enabled`       | Whether the trigger runs (default true)                   | boolean | —       | No       |
| `--function-path` | Path the invocation is sent to (default '/')              | string  | —       | No       |
| `--function-slug` | Slug of the function to invoke                            | string  | —       | Yes      |
| `--name`          | Trigger name (unique per branch)                          | string  | —       | Yes      |
| `--prefix`        | Object-key prefix to match (requires --bucket on create)  | string  | —       | No       |
| `--branch`        | Branch ID or name                                         | string  | —       | No       |
| `--project-id`    | Project ID                                                | string  | —       | No       |

By default the invocation is sent to `/` and the trigger is enabled. Use `--function-path` to send it to another route, and `--enabled false` to create it in a disabled state.

A schedule trigger:

```bash
neon triggers create --function-slug child404 --name nightly-report --cron '0 6 * * *' --project-id solitary-heart-93902637 --branch main
```

```title="Output"
Trigger Id     trigger-12345678-90ab-cdef-1234-567890abcdef
Name           nightly-report
Type           schedule
Function Slug  child404
Function Path  /
Schedule       0 6 * * *
Enabled        true
Inherited      false
Next Run At    2026-09-11T06:00:00.000000Z
```

A storage trigger that fires when an object is created under `logos/` in the `assets` bucket:

```bash
neon triggers create --function-slug ingest --name on-upload --bucket assets --prefix 'logos/' --function-path /object --project-id solitary-heart-93902637 --branch main
```

## neon triggers update

Updates a trigger. Pass at least one of `--function-slug`, `--name`, `--function-path`, or `--enabled`, plus the field matching the trigger's type: `--cron` for a schedule trigger, or `--bucket`/`--prefix` for a `storage_object_created` trigger. With no fields to change, the command returns an error. The type is fixed at creation, so passing `--cron` to a storage trigger, or `--bucket`/`--prefix` to a schedule trigger, is rejected (`Trigger <id> is type <type>; ...`). Changing a schedule recomputes `Next Run At`.

```bash
neon triggers update <id> [options]
```

| Option            | Description                                               | Type    | Default | Required |
| ----------------- | --------------------------------------------------------- | ------- | ------- | -------- |
| `--bucket`        | Object-storage bucket to watch (storage\_object\_created) | string  | —       | No       |
| `--cron`          | Five-field UTC cron expression                            | string  | —       | No       |
| `--enabled`       | Whether the trigger runs                                  | boolean | —       | No       |
| `--function-path` | Path the invocation is sent to                            | string  | —       | No       |
| `--function-slug` | Slug of the function to invoke                            | string  | —       | No       |
| `--name`          | Trigger name (unique per branch)                          | string  | —       | No       |
| `--prefix`        | Object-key prefix to match                                | string  | —       | No       |
| `--branch`        | Branch ID or name                                         | string  | —       | No       |
| `--project-id`    | Project ID                                                | string  | —       | No       |

Reschedule a schedule trigger:

```bash
neon triggers update trigger-12345678-90ab-cdef-1234-567890abcdef --cron '*/30 * * * *' --project-id solitary-heart-93902637 --branch main
```

Change the prefix a storage trigger matches:

```bash
neon triggers update trigger-abcdef12-3456-7890-abcd-ef1234567890 --prefix 'incoming/' --project-id solitary-heart-93902637 --branch main
```

## neon triggers enable

Enables a trigger so it runs on its schedule. Enabling recomputes `Next Run At`.

```bash
neon triggers enable <id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | -------- |
| `--branch`     | Branch ID or name | string | —       | No       |
| `--project-id` | Project ID        | string | —       | No       |

```bash
neon triggers enable trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main
```

## neon triggers disable

Disables a trigger without deleting it. A disabled trigger keeps its definition but does not run, and its `Next Run At` is cleared. Re-enable it with [`neon triggers enable`](#neon-triggers-enable).

```bash
neon triggers disable <id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | -------- |
| `--branch`     | Branch ID or name | string | —       | No       |
| `--project-id` | Project ID        | string | —       | No       |

```bash
neon triggers disable trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main
```

## neon triggers delete

Deletes a trigger.

```bash
neon triggers delete <id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | -------- |
| `--branch`     | Branch ID or name | string | —       | No       |
| `--project-id` | Project ID        | string | —       | No       |

```bash
neon triggers delete trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main
```

```title="Output"
INFO: Trigger trigger-12345678-90ab-cdef-1234-567890abcdef deleted
```

## Related pages

- [Neon CLI command: functions](./apis-sdks-cli-functions.md)
- [Neon CLI command: buckets](./apis-sdks-cli-buckets.md)
- [Neon CLI command: data-api](./apis-sdks-cli-data-api.md)
- [Neon CLI command: neon-auth](./apis-sdks-cli-neon-auth.md)
- [Neon CLI command: credentials](./apis-sdks-cli-credentials.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
