# CLI reference

Install the CLI, preview and export locally, preflight CSV, and create saved campaigns deliberately.

Source: https://linkdevi.com/docs/cli
Updated: 2026-11-27

## Install and inspect commands

```bash
npm install @kgma/linkdevi-tools@0.1.0
npx --no-install linkdevi --help
npx --no-install linkdevi --version
```

Node.js 22+ is required. With a local installation, use npx --no-install to run the installed binary. No account is needed for init, preview or CSV dry-run.

- [npm package](https://www.npmjs.com/package/@kgma/linkdevi-tools)
- [Source and tests](https://github.com/kgma-glitch/linkdevi-tools)

## Offline commands

```bash
npx --no-install linkdevi campaign init --out campaign.json
npx --no-install linkdevi campaign preview campaign.json
npx --no-install linkdevi campaign preview campaign.json --format csv
npx --no-install linkdevi links import links.csv --dry-run
```

init creates a UUID-bearing input file and refuses to overwrite it. Preview prepares long UTM destinations only. CSV import currently performs preflight validation only; it does not create links. Input files are bounded to 256 KiB and CSV plans to 100 data rows. Invalid or duplicate rows produce a nonzero exit status.

```csv
url,name,utmCampaign,channels
https://example.com/launch,Product launch,product-launch,facebook|line|print
```

## Authenticated commands

Provide LINKDEVI_API_KEY through your protected environment. LINKDEVI_BASE_URL defaults to https://linkdevi.com. Keep keys out of command-line arguments and source control.

```bash
npx --no-install linkdevi capabilities
npx --no-install linkdevi campaign create campaign.json --confirm
npx --no-install linkdevi campaign list --page 1
npx --no-install linkdevi campaign stats SAVED_CAMPAIGN_ID
```

Create consumes stored-link slots. CLI errors are deliberately sanitized and no automatic retry is performed. An ambiguous creation result can have committed; preserve the same file and UUID for a reviewed retry.
