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

# Tracked links API

> Create short links for your posts and ads, and read the visits, sales and revenue each one brought in.

Tracked links are short links to pages of your store
(`https://<your-store>/go/<slug>`). Each click is counted, then the buyer is
sent to the destination with UTM parameters and a `pf_link` parameter. The
store keeps `pf_link` for 30 days and a purchase in that window is credited
to the **last** link the buyer clicked. How it works for creators:
[Tracked links](/operations/tracked-links).

Base URL `https://api.pocketsflow.com`, API key in the `Authorization`
header, like every other endpoint.

<Note>
  Needs the **Starter** plan or above. Below it, `POST` and editing `PATCH`
  calls answer `403` with `code: "FEATURE_LOCKED"`; reads still list your
  links (they keep redirecting) but `stats`, `totals`, `channels` and `daily`
  are `null` and `statsLocked` is `true`. Archiving (`PATCH` with only
  `archived`) always works.
</Note>

## Create a link

```bash theme={"system"}
curl -X POST https://api.pocketsflow.com/tracked-links \
  -H "Authorization: Bearer pk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "destination": "/notion-creator-kit",
    "slug": "ig-bio",
    "label": "Instagram bio",
    "channel": "instagram"
  }'
```

```json theme={"system"}
{
  "link": {
    "_id": "6711a3d59e3f1a0012cd7788",
    "slug": "ig-bio",
    "label": "Instagram bio",
    "channel": "instagram",
    "destination": "https://redmug.pocketsflow.com/notion-creator-kit",
    "utm": { "source": "instagram", "medium": "social", "campaign": "ig-bio" },
    "archived": false,
    "shortUrl": "https://redmug.pocketsflow.com/go/ig-bio",
    "createdAt": "2026-10-16T09:12:44.000Z",
    "updatedAt": "2026-10-16T09:12:44.000Z"
  }
}
```

| Field | Required | Notes |
| - | - | - |
| `destination` | yes | A page of your store: your subdomain, a domain you connected, or `https://app.pocketsflow.com/checkout?productId=…` for one of your products. A bare path (`/ebook`) is on your subdomain. Anything else is refused with `400`. |
| `slug` | no | Letters, numbers and hyphens, up to 48, lowercased. Unique per store; `409` with a free `suggestion` when taken. Omit to derive one. Never changes after creation. |
| `label` | no | Up to 80 characters. |
| `channel` | no | `instagram`, `tiktok`, `youtube`, `x`, `facebook`, `email`, `ads` or `other` (default). |
| `utm` | no | `{ source, medium, campaign }`. Blanks are filled from the channel and the slug. |

Check a slug first with `GET /tracked-links/slug-available?slug=ig-bio`:
`{ "slug": "ig-bio", "valid": true, "available": false, "suggestion": "ig-bio-k3x" }`.

## Read the stats

`GET /tracked-links` returns every link with its stats over the range, plus
`totals`, a `channels` breakdown and a `daily` series.
`GET /tracked-links/{id}` returns one link with its `daily` series and the
top 20 `countries` of its visitors.

| Query | Notes |
| - | - |
| `startDate`, `endDate` | ISO dates. Default: since the first link was created (list) or since the link was created (one link), until now. Capped at 366 days. |
| `timezoneOffsetMinutes` | Your `Date#getTimezoneOffset()` so daily rows follow your local days. |
| `archived=1` | List only: include archived links. |

```json theme={"system"}
{
  "stats": {
    "clicks": 412,
    "visitors": 361,
    "sales": 18,
    "revenue": 846,
    "conversionRate": 4.99
  }
}
```

* `clicks` leave out bots, link previews, prefetches and repeat clicks by
  the same visitor within 30 minutes.
* `sales` and `revenue` (account currency) leave out refunded and test-mode
  orders; free claims count as sales.

## Edit or archive

`PATCH /tracked-links/{id}` with any of `label`, `destination`, `channel`,
`utm` (needs the plan) or `archived` (always allowed). Sending a different
`slug` answers `400`: posted links never break.

## MCP

The same operations are MCP tools: `list_tracked_links`,
`create_tracked_link`, `get_tracked_link_stats` and `update_tracked_link`.
See [MCP server](/api-reference/mcp-server).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.