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

# Automation rules

> Create, list, and delete automation rules from the terminal.

Automation rules run actions when a booking event fires. See the [API reference](/api-reference/automation-rules/list) for the full resource shape.

## List automation rules

```bash theme={"system"}
neetocal automation-rules list
neetocal automation-rules list --page 1 --page-size 20
```

| Flag          | Type  | Required | Default | Description              |
| ------------- | ----- | -------- | ------- | ------------------------ |
| `--page`      | `int` |          | `0`     | Page number              |
| `--page-size` | `int` |          | `0`     | Items per page (max 100) |

```json Sample output (--json) theme={"system"}
{
  "data": [
    {
      "id": "efb296a3-8205-419f-8ac4-1abfc46bc3c7",
      "name": "Notify on confirm",
      "meeting_ids": ["mtg_abc"]
    }
  ],
  "pagination": { "total_records": 1, "total_pages": 1, "current_page_number": 1, "page_size": 30 }
}
```

Mirrors [List automation rules](/api-reference/automation-rules/list) in the API.

## Create an automation rule

```bash theme={"system"}
neetocal automation-rules create \
  --event booking_confirmed \
  --name "Notify on confirm" \
  --json-file actions.json
```

| Flag          | Type     | Required | Default | Description                                     |
| ------------- | -------- | -------- | ------- | ----------------------------------------------- |
| `--event`     | `string` | Yes      |         | Trigger event                                   |
| `--json-file` | `string` |          |         | Path to JSON file with meeting\_ids and actions |
| `--name`      | `string` |          |         | Rule name                                       |

The `--json-file` holds the meetings the rule applies to and the actions to run:

```json actions.json theme={"system"}
{
  "meeting_ids": ["mtg_abc", "mtg_def"],
  "actions": [
    { "type": "send_email", "template_id": "tmpl_123" },
    { "type": "add_to_calendar" }
  ]
}
```

```json Sample output (--json) theme={"system"}
{
  "data": {
    "workflow": {
      "id": "efb296a3-8205-419f-8ac4-1abfc46bc3c7",
      "name": "Notify on confirm",
      "meeting_ids": ["mtg_abc", "mtg_def"]
    }
  }
}
```

Mirrors [Create automation rule](/api-reference/automation-rules/create) in the API.

## Delete an automation rule

```bash theme={"system"}
neetocal automation-rules delete <id>
```

Removes the rule with the given `id`. In `--quiet` mode this prints `success`.

```text Sample output theme={"system"}
Automation rule deleted successfully.
```

Mirrors [Delete automation rule](/api-reference/automation-rules/delete) in the API.
