> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cli/reference/scheduler.md).

# norbix scheduler

Manage scheduler tasks.

Manage scheduler tasks.

6 commands (`@norbix.ai/cli` 1.16.0):

* [`norbix scheduler delete`](#norbix-scheduler-delete) — Delete a scheduler task
* [`norbix scheduler disable`](#norbix-scheduler-disable) — Disable a scheduler task
* [`norbix scheduler enable`](#norbix-scheduler-enable) — Enable a scheduler task
* [`norbix scheduler get`](#norbix-scheduler-get) — Show one scheduler task
* [`norbix scheduler list`](#norbix-scheduler-list) — List scheduler tasks
* [`norbix scheduler save`](#norbix-scheduler-save) — Create or update a scheduler task

## `norbix scheduler delete`

Delete a scheduler task

```sh
norbix scheduler delete ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Task ID     |

| Flag          | Description                                                            |
| ------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes` | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`   | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix scheduler delete 66b2f0a1c3d4e5f6a7b8c9d0 --yes
norbix scheduler delete 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
```

## `norbix scheduler disable`

Disable a scheduler task

```sh
norbix scheduler disable ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Task ID     |

| Flag          | Description                                                            |
| ------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes` | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`   | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix scheduler disable 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
norbix scheduler disable 66b2f0a1c3d4e5f6a7b8c9d0 --yes
```

## `norbix scheduler enable`

Enable a scheduler task

```sh
norbix scheduler enable ID [flags]
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Task ID     |

| Flag          | Description                                                            |
| ------------- | ---------------------------------------------------------------------- |
| `-y`, `--yes` | Skip the confirmation prompt (required in non-interactive shells)      |
| `--dry-run`   | Resolve context and print the request that would be sent; send nothing |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix scheduler enable 66b2f0a1c3d4e5f6a7b8c9d0 --dry-run
norbix scheduler enable 66b2f0a1c3d4e5f6a7b8c9d0 --yes
```

## `norbix scheduler get`

Show one scheduler task

```sh
norbix scheduler get ID
```

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `ID`     | yes      | Task ID     |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix scheduler get 66b2f0a1c3d4e5f6a7b8c9d0
```

## `norbix scheduler list`

List scheduler tasks

```sh
norbix scheduler list [flags]
```

| Flag                    | Description                                                                                                           |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `--type` `<value>`      | Only tasks of this type — one of: `EmailCampaign`, `PushCampaign`, `SmsCampaign`, `CodeFunctionalCall`, `WebhookCall` |
| `--enabled`             | Only enabled tasks (--no-enabled: only disabled ones); leave out for both                                             |
| `--page-size` `<value>` | Records per page                                                                                                      |
| `--after` `<value>`     | Cursor: fetch the page after this item                                                                                |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix scheduler list
norbix scheduler list --type EmailCampaign --enabled
norbix scheduler list --no-enabled --page-size 50
```

## `norbix scheduler save`

Create or update a scheduler task

```
Without --id a new task is created; with --id that task is replaced by what the flags say (send every field again — the server does not merge).

The only task type today is an email campaign: each time --cron fires, the task sends the --template to the --audience. --cron has 5 fields (minute hour day-of-month month day-of-week) and runs in UTC, e.g. "0 9 * * 1" is every Monday at 09:00 UTC.

--initiator is the user the task runs as (usr_…): yourself, or a service user of this project. It must belong to this project.

--integration is required: name the email provider every run sends through (list them with `norbix email integrations`). The server never falls back to the project default; a task without one would fail each time it fires. --language forces one language; it must be one of the project's languages (Project settings), and the template must have a translation for every project language. --on-behalf-of sends each run on behalf of another project user (their details fill the Initiator.User.* tokens; default: the --initiator).

--audience picks who receives it:
  all-users      every user with an e-mail; narrow with --role / --tag
  users          the users named with --user (copies with --cc / --bcc user IDs)
  account-users  the account users named with --user
  emails         raw addresses, --email (copies with --cc / --bcc addresses)
  collection     the recipients in --field of the --schema collection

Anything the flags do not cover goes in --config as a JSON object and is merged into the campaign. Prints the task ID.
```

```sh
norbix scheduler save [flags]
```

| Flag                                 | Description                                                                                                                                                      |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-y`, `--yes`                        | Skip the confirmation prompt (required in non-interactive shells)                                                                                                |
| `--dry-run`                          | Resolve context and print the request that would be sent; send nothing                                                                                           |
| `--id` `<value>`                     | Task ID — set it to update that task instead of creating one                                                                                                     |
| `--name` `<value>`                   | Task name — required                                                                                                                                             |
| `--description` `<value>`            | What the task is for                                                                                                                                             |
| `--cron` `<value>`                   | When it runs: a 5-field cron (minute hour day-of-month month day-of-week) in UTC — required                                                                      |
| `--initiator` `<value>`              | User ID (usr\_…) the task runs as — yourself or a service user of this project — required                                                                        |
| `--enabled`                          | Start firing on the cron right away (--no-enabled saves it switched off)                                                                                         |
| `--stop-on-error`                    | Switch the task off after a run fails                                                                                                                            |
| `--template` `<value>`               | Email template ID — required                                                                                                                                     |
| `--audience` `<value>`               | Who receives it — required; one of: `all-users`, `users`, `account-users`, `emails`, `collection`                                                                |
| `--user` `<value>`                   | User ID (users / account-users; repeat for several) — repeat for several                                                                                         |
| `--email` `<value>`                  | E-mail address (emails; repeat for several) — repeat for several                                                                                                 |
| `--cc` `<value>`                     | Copy to — a user ID (users / account-users) or address (emails); repeat — repeat for several                                                                     |
| `--bcc` `<value>`                    | Blind copy — a user ID or address, like --cc; repeat — repeat for several                                                                                        |
| `--one-each`                         | Send every recipient a separate e-mail instead of one e-mail to all (users / account-users / emails)                                                             |
| `--role` `<value>`                   | Role name (all-users / collection; repeat for several) — repeat for several                                                                                      |
| `--tag` `<value>`                    | User tag (all-users; repeat for several) — repeat for several                                                                                                    |
| `--schema` `<value>`                 | Collection name (collection)                                                                                                                                     |
| `--field` `<value>`                  | Field that holds the recipient (collection; repeat for several) — repeat for several                                                                             |
| `--field-type` `<value>`             | What --field holds (collection) — one of: `User`, `Email`; default: `User`                                                                                       |
| `--integration` `<value>`            | Email integration ID every run sends through; list them with `norbix email integrations` — required                                                              |
| `--validation-integration` `<value>` | Email-validation integration ID — check every address first                                                                                                      |
| `--language` `<value>`               | Send every message in this language. Must be one of the project's languages (Project settings); default: each recipient's own language, else the project default |
| `--on-behalf-of` `<value>`           | Send on behalf of this project user ID — their details fill the Initiator.User.\* tokens (default: the --initiator)                                              |
| `--notes` `<value>`                  | Internal notes                                                                                                                                                   |
| `--token` `<value>`                  | Token value as key=value (repeat for several) — repeat for several                                                                                               |
| `--database-integration` `<value>`   | Database integration ID (defaults to the project default)                                                                                                        |
| `--config` `<value>`                 | Extra campaign fields as a JSON object, @file or -                                                                                                               |

Also takes the [global flags](/codemash/cli/reference.md#global-flags): `--json`, `--project`, `--env`, `--region`, `--api-key`, `--account`, `--profile`.

Examples:

```sh
norbix scheduler save --name "Weekly digest" --cron "0 9 * * 1" --initiator usr_66b2f0a1 --template 66b2f0a1c3d4e5f6a7b8c9d0 --integration 66c1a2b3c4d5e6f7a8b9c0d1 --audience all-users --yes
norbix scheduler save --name "Beta news" --cron "30 7 1 * *" --initiator usr_66b2f0a1 --template 66b2f0a1c3d4e5f6a7b8c9d0 --integration 66c1a2b3c4d5e6f7a8b9c0d1 --audience all-users --tag beta --no-enabled --yes
norbix scheduler save --id 66b2f0a1c3d4e5f6a7b8c9d0 --name "Weekly digest" --cron "0 10 * * 1" --initiator usr_66b2f0a1 --template 66b2f0a1c3d4e5f6a7b8c9d0 --integration 66c1a2b3c4d5e6f7a8b9c0d1 --audience emails --email ada@example.com --yes
norbix scheduler save --name "Weekly digest" --cron "0 9 * * 1" --initiator usr_66b2f0a1 --template 66b2f0a1c3d4e5f6a7b8c9d0 --integration 66c1a2b3c4d5e6f7a8b9c0d1 --audience all-users --dry-run
```
