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

# Omni CLI

> Terminal client for every OmniCommerce REST operation, generated from OpenAPI.

The Omni CLI (`omni`) is generated from the same OpenAPI specification as the [TypeScript SDK](/sdk/typescript), so every public REST operation is a subcommand — no per-endpoint hand-writing, and no drift between the two.

Use it to explore the API, script an operation, or run from CI without writing code.

## Install

```bash theme={null}
npm install -g @omni-commerce/cli
```

Requires Node 18+. From this repository:

```bash theme={null}
yarn omni-cli products list --q lamp --api-key "$OMNI_API_KEY"
```

The in-repo `yarn omni evaluate|sync|monitor` helper remains for local developer-platform scripts. The published CLI is the full OpenAPI command tree.

## Authenticate

Store a key (same `omni_sk_...` the SDK uses):

```bash theme={null}
omni auth login --api-key omni_sk_...
omni auth status
```

Credentials are written to `~/.omni/config.json` with mode `0600`. Or export the same variable the SDK reads:

```bash theme={null}
export OMNI_API_KEY="omni_sk_..."
```

Precedence: `--api-key` > `OMNI_API_KEY` > `~/.omni/config.json`.

Confirm it works:

```bash theme={null}
omni products list --q lamp
```

## Explore

The command tree mirrors the API, so `--help` is the reference:

```bash theme={null}
omni --help
omni products --help
omni products list --help
```

Two flags are agent- and script-friendly:

```bash theme={null}
omni products list --schema     # machine-readable flags for this command
omni products get --product-id prod_123 --dry-run
```

`--dry-run` prints the method, path, and request object without sending anything.

## Call an operation

```bash theme={null}
omni products list --q lamp
omni products get --product-id prod_123
omni aop execute --aop-id aop_123 --json '{"user_inputs":{"company":"Acme"}}'
omni jobs wait --job-id prod_123
```

Request bodies come from `--json`, a JSON object, or stdin:

```bash theme={null}
echo '{"product":{"sku":"SKU-1","title":"Lamp"}}' | omni products create --json -
```

Path and query parameters are flags (`--product-id`, `--q`). Nested JSON bodies stay on `--json`.

## Output formats

`--format` accepts `json` (default when piped) and `table` (default on a TTY).

```bash theme={null}
omni products list --q lamp --format json | jq '.products | length'
omni products list --q lamp --format table
```

## Environment variables

| Variable        | Description                                                 |
| --------------- | ----------------------------------------------------------- |
| `OMNI_API_KEY`  | Organization API key — the same variable the SDK uses       |
| `OMNI_BASE_URL` | Override the API origin (default `https://omnicommerce.sg`) |

## Full reference

Every generated command is listed in [CLI reference](/cli/reference).
