# Your first campaign

Install, check access, preview a campaign, create it deliberately, and read its results.

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

## Choose how to start

You can prepare a campaign without an account. Use the web tool or CLI for an offline preview. Creating saved short links requires a LinkDevi account, workspace permissions and available link slots.

- [Try Campaign Launch Kit](https://linkdevi.com/tools/campaign-launch-kit)
- [Connect an AI client instead](https://linkdevi.com/docs/mcp)

## 1. Install the CLI

Use Node.js 22 or newer. Pin the package version so upgrades are deliberate.

```bash
npm install @kgma/linkdevi-tools@0.1.0
npx --no-install linkdevi --help
npx --no-install linkdevi campaign init --out campaign.json
```

Edit campaign.json with your destination, campaign name, UTM campaign and channels. The init command generates a UUID and refuses to overwrite an existing file. Keep that UUID and the exact intent after a timeout.

```json
{
  "requestId": "a43c37c0-350a-44ef-9d40-a5900c246891",
  "name": "Product launch",
  "url": "https://example.com/launch",
  "utmCampaign": "product-launch",
  "domain": "linkdevi.com",
  "channels": [
    "facebook",
    "line",
    "print"
  ]
}
```

## 2. Check your account and access

Sign in and open Connect AI. Owners and admins can create an expiring credential with explicit scopes. Use links:read for preview, listing, counters and QR; add links:write only when the integration should create campaigns. Store the key in a protected environment as LINKDEVI_API_KEY. Never put the real key in a prompt, repository, public page or browser JavaScript.

- [Open Connect AI](https://linkdevi.com/ai)
- [Authentication and permissions](https://linkdevi.com/docs/authentication)

```bash
npx --no-install linkdevi capabilities
```

Inspect returned scopes, limits.links, limits.keyRate and usage.storedLinks. A capability check is a snapshot, not a reservation or a grant of additional permissions.

## 3. Preview before creating

```bash
npx --no-install linkdevi campaign preview campaign.json
npx --no-install linkdevi campaign preview campaign.json --format csv
```

These CLI previews run locally without a key or network request. Review every tagged destination and the number of channels. Preview creates no links and reserves no quota. An API or MCP preview is authenticated and still counts as an API request.

## 4. Create after reviewing

```bash
npx --no-install linkdevi campaign create campaign.json --confirm
```

This command creates a saved campaign and one short link per channel. Three channels use three stored-link slots. Review the response's campaign.id and campaign.channels[].link.shortUrl. The --confirm flag makes the creation explicit; it is not a preview.

If a response is lost, creation may already have committed. Preserve the input file, requestId and payload. A retry with the same identity and exact payload reuses the result; changing the intent with that UUID returns a conflict. A new campaign needs a new UUID.

## 5. Read the saved campaign

```bash
npx --no-install linkdevi campaign list --page 1
npx --no-install linkdevi campaign stats SAVED_CAMPAIGN_ID
```

Replace SAVED_CAMPAIGN_ID with the ID returned by creation. These counters are lifetime recorded redirects, including bots and link previews. They are not unique people, dated activity, conversions or revenue. A missing channel is unavailable, not zero.

- [Open saved campaigns](https://linkdevi.com/campaigns)
- [Understand the metrics](https://linkdevi.com/docs/limits-and-metrics)
