# The lodol command

> On Lodol Local, sign in once with an API key, then list, run, turn off, export and import workflows from a terminal with the lodol command.

Web page: https://docs.lodol.com/docs/api/command-line

Lodol Local, the edition you install and run on your own computer or server, comes with the `lodol` command. Besides starting and updating the installation, it can work with your workflows from a terminal: list them, run one and see what it hands back, turn one off, and move one between workspaces as a file. Lodol Gov's self-hosted edition doesn't have these commands.

The commands work through this installation's [developer API](https://docs.lodol.com/docs/api.md) with an API key, so they can do only what the member who created the key may do, and the workspace's audit log records what they do as that member's.

| Command | What it does |
| --- | --- |
| `lodol login [--expires <days>\|never]` | Sign in, once, with an API key |
| `lodol workflows [--json]` | List the workflows, with whether each that starts itself is on or off |
| `lodol run <workflow> [name=value …] [--json]` | Run one and wait for what it hands back; one that starts itself is turned on instead |
| `lodol off <workflow>` | Turn off one that starts itself |
| `lodol export <workflow> [file\|-] [--force]` | Save one to a JSON file |
| `lodol import <file\|-> [--name <name>]` | Add a workflow from a file |

## Sign in

```bash
lodol login
```

`lodol login` opens Lodol's **API Keys** page with a key already filled in for the command: named **lodol command**, with **List workflows, folders, documents and websites**, **Create and edit workflows, folders, documents and websites**, **Run workflows** and **Read runs** ticked. Press **Create**, copy the key it shows you, and paste it into the terminal. You sign in once: the command keeps the key in `api-key.json` in Lodol's folder (`~/.lodol` unless you installed it elsewhere), which only your account can read.

It tells you which workspace you're signed in to, as whom, and when the key stops working. Keys last 90 days unless you choose otherwise, on the page or with `--expires`:

```bash
lodol login --expires 365    # 30, 60, 90, 180 or 365 days, or never
```

In the week before the key expires, every command reminds you. Once it has expired, or been revoked, run `lodol login` again for a new one.

## Name a workflow

The commands that take a `<workflow>` accept its name, in any capitalization, or its ID. Put a name with spaces in quotes. If no workflow has that name, the command suggests the ones whose names contain what you typed; if two have it, it lists both with their IDs, so you can name one by its ID.

## List workflows

```bash
lodol workflows
```

```txt
Hourly stock check     on   6ae1295539658490afe878d4
Monthly Client Report       665f1a2b3c4d5e6f7a8b9c0d
```

Each workflow's name, then `on` or `off` for one that starts from its own trigger or schedule, then its ID. `--json` prints the [workflow objects](https://docs.lodol.com/docs/api/workflows.md#the-workflow-object) instead.

## Run a workflow

```bash
lodol run "Monthly Client Report" client=Acme month=2026-05
```

```txt
Running Monthly Client Report  http://localhost:3900/runs/665f1a2b3c4d5e6f7a8b9c0d?executionId=683b2c3d4e5f6a7b8c9d0e1f
Done:
  total: 1250
  summary: A good month for Acme
```

Give each input as `name=value`. Each value is converted to its input's type, as [Run a workflow](https://docs.lodol.com/docs/api/runs.md#how-inputs-are-checked) describes; a missing or unknown input stops the command before anything runs, showing the inputs the workflow takes. The command waits for the run to finish and prints its outputs, or why it failed. If a step waits for an approval, it says so and keeps waiting.

It exits with `0` when the run succeeds and `1` when it fails or is stopped, so you can use it in scripts. `--json` prints the finished [run object](https://docs.lodol.com/docs/api/runs.md#the-run-object) instead. Pressing Ctrl-C stops the command waiting, but not the run, which carries on in Lodol.

A workflow that starts from its own trigger or schedule takes no inputs. Running it turns it on, as [Run a workflow](https://docs.lodol.com/docs/api/runs.md#workflows-that-start-themselves) does, and the command returns straight away.

## Turn a workflow off

```bash
lodol off "Hourly stock check"
```

Turns off a workflow that starts from its own trigger or schedule, so it won't run again until it's turned on. A run it already started finishes. `lodol run` turns it back on.

## Export and import a workflow

```bash
lodol export "Monthly Client Report"                 # writes monthly-client-report.json
lodol export "Monthly Client Report" report.json     # or a file you name
lodol export "Monthly Client Report" -               # or prints it
```

`lodol export` saves a workflow's name, description and steps to a JSON file. It won't replace a file that's already there unless you add `--force`.

```bash
lodol import report.json
lodol import report.json --name "Monthly Client Report (EU)"
```

`lodol import` adds the workflow in the file to the workspace you're signed in to, and prints where to open it. `-` reads the file from standard input.

An exported file names no connection. A step that used one of your workspace's connections uses the importer's own connection to that app instead, so a file can move between workspaces and installations. After importing, the command lists the apps the workflow uses that still need connecting: connect them on the **Apps** page before running it.

<Cards>
  <Card title="Workflows" description="The API behind these commands." href="/docs/api/workflows" />
  <Card title="Authentication" description="API keys, scopes and what each key is allowed to do." href="/docs/api/authentication" />
</Cards>
