# Running a campaign

The operator path, end to end. Every step here is an HTTP call against
`/admin` on `track.acrune.com`, authenticated with an operator key — but in
practice nobody types these, because [the MCP server](https://acrune.com/dashboard/docs/operating/mcp.md)
speaks all of them.

## 1. Open an account

```bash
curl -X POST https://track.acrune.com/admin/accounts \
  -H "Authorization: Bearer $ACRUNE_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "TripRank", "slug": "triprank" }'
```

The slug is used in every later call and cannot be changed.

## 2. Open a campaign

```bash
curl -X POST https://track.acrune.com/admin/accounts/triprank/campaigns \
  -H "Authorization: Bearer $ACRUNE_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "name": "January launch",
       "destinationUrl": "https://triprank.app/download",
       "clickParam": "subid"
     }'
```

One campaign is one destination. A client running three offers wants three
campaigns, not one with three creative briefs.

## 3. Issue the roster

This is the endpoint the whole service exists to serve: hand a list of creators
one code each.

```bash
curl -X POST https://track.acrune.com/admin/accounts/triprank/links \
  -H "Authorization: Bearer $ACRUNE_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "campaignId": "<campaign id>",
       "creators": [
         { "handle": "apexlaps", "platform": "tiktok" },
         { "handle": "mia.clips", "platform": "instagram" }
       ]
     }'
```

Creators are created on demand from the handle, because a handle is the only
thing an operator has at that moment.

**Re-running the same roster is normal and safe.** Somebody joins mid-campaign
and the whole list gets posted again; an existing unassigned link is returned
rather than a second one being minted, so nobody's clicks get split across two
codes. The response marks each row `reused` or not.

A link that already has a post attached is a different unit, and a second post
legitimately wants its own code — so passing `postUrl` always mints a new link.

## 4. Chase the posts

```bash
curl https://track.acrune.com/admin/accounts/triprank/links/missing-posts \
  -H "Authorization: Bearer $ACRUNE_ADMIN_KEY"
```

Every link with no post URL recorded. These still count clicks but cannot be
ranked or reported, so this list is the outstanding work of a campaign.

Attach them in bulk when the URLs come in:

```bash
curl -X PATCH https://track.acrune.com/admin/links \
  -H "Authorization: Bearer $ACRUNE_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "posts": [ { "linkId": "kp7r2wqm", "postUrl": "https://tiktok.com/@apexlaps/video/7412" } ] }'
```

One call per link would guarantee this gets done in a spreadsheet instead, and
then not at all.

## 5. Read the ranking

```bash
curl "https://track.acrune.com/stats/triprank/posts?since=2026-08-01" \
  -H "Authorization: Bearer $ACRUNE_ADMIN_KEY"
```

Clicks per post per creator across the account, ranked, optionally windowed.

Report it as a ranking. It is not a click-through rate, because there is no
impression behind it, and quoting it as one invites an argument that cannot be
won.

## Operator keys

```bash
curl -X POST https://track.acrune.com/admin/admin-keys \
  -H "Authorization: Bearer $ACRUNE_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "sam", "scopes": ["read", "write"] }'
```

Requires a `money`-scoped key, because this creates an actor. One key per
person — see [Accounts and keys](https://acrune.com/dashboard/docs/platform/accounts-and-keys.md).

Read back what anyone did with `GET /admin/audit`, filtered with `?actor=`.
