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

# Reporting API

Source: https://docs.linkrunner.io/api-reference/reporting-campaigns

Programmatic access to campaign analytics: clicks, installs, signups, spend, revenue, ROAS, ad sets, ad creatives, and keywords.

The Reporting API returns the same campaign analytics shown on the Linkrunner dashboard. For website traffic, use the [Web Campaigns Reporting API](https://docs.linkrunner.io/api-reference/reporting-web-campaigns).

## Base URL

```
https://api.linkrunner.io/api/v1
```

## Authentication

Pass your project's server key in the `linkrunner-key` header. This is the same key used by other `/api/v1` endpoints. Find it under [Settings → Data APIs](https://dashboard.linkrunner.io/settings?s=data-apis):

```
linkrunner-key: YOUR_API_KEY
```

## Postman collection

[Download the Postman collection](https://gist.githubusercontent.com/RathodDarshil/20d04e80c2d97f8280e1b3beffb58465/raw/reporting-campaigns.postman_collection.json). Import it into Postman, set the `linkrunner_key` collection variable to your key, and run any request.

## Rate limit and freshness

- **1 request per minute per API key** (`429` with `Retry-After: 60` when exceeded).
- 30 req/sec per source IP (shared across all `/api/v1` endpoints).
- Underlying analytics refresh on roughly the same cadence, so cache responses for at least 60 seconds.

## Endpoint

```
GET https://api.linkrunner.io/api/v1/reporting/campaigns
```

> **Warning:**
>
> Do not call the docs page URL (`/api-reference/reporting-campaigns`) as the API endpoint. The API path is `/api/v1/reporting/campaigns`.

### Example request

**cURL**

```bash
curl 'https://api.linkrunner.io/api/v1/reporting/campaigns?from=2026-04-01&to=2026-04-30&network=meta&limit=20' \
  -H 'linkrunner-key: YOUR_API_KEY'
```

**Google Apps Script**

```js
const response = UrlFetchApp.fetch(
    "https://api.linkrunner.io/api/v1/reporting/campaigns?from=2026-04-01&to=2026-04-30&limit=20",
    {
        method: "get",
        headers: {
            "linkrunner-key": "YOUR_API_KEY",
        },
    }
);

const data = JSON.parse(response.getContentText());
```

### Response

```json
{
    "msg": "Campaigns fetched successfully",
    "status": 200,
    "data": {
        "campaigns": [ /* see TypeScript types below */ ],
        "pagination": { "total": 142, "pages": 8, "page": 1, "limit": 20 },
        "display_currency": "USD",
        "view": "user_acquisition"
    }
}
```

`pagination.total` is the number of campaigns matching your filters, and `pages` is `total / limit` rounded up.

> **Warning:**
>
> Numeric fields are returned as **formatted strings** (`"3,201"`, `"$12,540.50"`). Strip the formatting before doing math: `Number(value.replace(/[^0-9.-]/g, ""))`.

### Query parameters

| Parameter | Type | Default | Notes |
| --- | --- | --- | --- |
| `from`, `to` | string | (none) | `YYYY-MM-DD`, inclusive, in your project's timezone. `start_date` / `end_date` are accepted aliases. Sets the metrics window; never filters the campaign list (see note below). |
| `active` | string | (all) | `true` or `false`. |
| `network` | string | (all) | `meta`, `google`, `apple_search_ads`, `tiktok`, `snapchat`, `sandbox_ads`, etc. Separate several with commas (`meta,google`, up to 50) to get the campaigns of any of them, each counted once. |
| `meta_account_id` | number | (none) | Restrict to a single Meta network account. |
| `platform` | string | (both) | `ios` or `android`. |
| `search` | string | (none) | Matches name, display ID, domain, deeplink, or full tracking URL. |
| `view` | string | `user_acquisition` | `user_acquisition` (new users: `installs`, `cost_per_install`) or `retargeting` (returning users, matching the dashboard's Retargeting view: `reinstalls`, `reengagements`, `cost_per_reinstall`). |
| `sort_field` | string | `installs` | `clicks`, `installs`, `signups`, `revenue`, `spend`, `created_at`, `uninstalls`, `conversion`, `suspicious_installs`, `roas`. |
| `sort_order` | string | `descending` | `ascending` or `descending`. |
| `page` | number | `1` | 1-indexed. |
| `limit` | number | `10` | **Max 100.** Larger values return `422`. |
| `granularity` | string | (none) | `day` adds a `daily` array to each campaign, one row per day of `from` to `to`. Needs both `from` and `to`, at most 31 days. See [Day-level breakdown](https://docs.linkrunner.io/api-reference/reporting-campaigns#day-level-breakdown). |
| `include_organic` | string | `false` | `true` adds an Organic row (`id` `0`) as the first row of page 1. See [Organic row](https://docs.linkrunner.io/api-reference/reporting-campaigns#organic-row). |

> **Note:**
>
> `from` and `to` choose the window over which metrics (clicks, installs, revenue, spend) are computed. They do not filter which campaigns are returned: a campaign created after `to` still appears, with zeros for the window. This matches the dashboard campaign table, where the date picker changes the numbers, not the list. To fetch only campaigns created in a range, see [Troubleshooting](https://docs.linkrunner.io/api-reference/reporting-campaigns#troubleshooting).

See [Event columns](https://docs.linkrunner.io/api-reference/reporting-campaigns#event-columns) below for `events`, `payment_events`, `unique_user_events`, `cost_per_event`, and `active_users`, and [Event columns with parameter filters](https://docs.linkrunner.io/api-reference/reporting-campaigns#event-columns-with-parameter-filters) for `event_columns`.

### Day-level breakdown

Add `granularity=day` to get each campaign's numbers per day in the same call. `from` and `to` are required and can cover at most 31 days. For a longer period, make one call per month.

```bash
curl 'https://api.linkrunner.io/api/v1/reporting/campaigns?granularity=day&from=2026-11-01&to=2026-11-30&limit=100' \
  -H 'linkrunner-key: YOUR_API_KEY'
```

Each campaign keeps its totals for the whole range and gets a `daily` array, oldest day first. `data.granularity` is `"day"`.

```json
{
    "id": 4182,
    "name": "Summer sale",
    "installs": "1,234",
    "sign-ups": "410",
    "spend": "52,300",
    "daily": [
        { "date": "2026-11-01", "installs": "40", "sign-ups": "13", "spend": "1,710" },
        { "date": "2026-11-02", "installs": "38", "sign-ups": "12", "spend": "1,690" }
    ]
}
```

- A day row has the same metric fields as the campaign, as formatted strings: counts, `revenue`, `spend`, `roas`, `cost_per_install`, `cost_per_signup`, `conversion`, and the [event columns](https://docs.linkrunner.io/api-reference/reporting-campaigns#event-columns) you asked for. Fields that need a longer window, such as retention and `active_users`, are only on the campaign.
- Days are in your project's timezone, like `from` and `to`.
- All other parameters work as usual. Filters and `page` / `limit` choose the campaigns, and the days cover exactly those campaigns.
- Counts, revenue and spend add up across days to the campaign total. Distinct-user counts (`sign-ups`, columns in `unique_user_events`) can add up to slightly more than the total, because a user counted on two days is counted once for the range. Ratios such as `roas` and `conversion` are per day; don't add them.
- A day-level request is still one request for the rate limit.

### Organic row

Organic installs are not credited to any campaign, so they are not in the list by default. Add `include_organic=true` to get them as one extra row with `id` `0` and `name` `"Organic"`:

```json
{ "id": 0, "name": "Organic", "installs": "11", "sign-ups": "8", "revenue": "2,048", "clicks": "-", "spend": "-", "roas": "-", "link": null, "adSets": [] }
```

- The row is first on page 1 only. It ignores `sort_field` and is not counted in `pagination.total`, so page 1 has up to `limit` campaigns plus Organic.
- It uses the same `from`, `to`, `platform` and [event columns](https://docs.linkrunner.io/api-reference/reporting-campaigns#event-columns) as the campaigns.
- Paid-only fields (`clicks`, `impressions`, `spend`, `roas`, `cost_per_*`, `reinstalls`, `suspicious_installs`, and the attribution counts) are `"-"`. Campaign-link fields (`link`, `domain`, `ad_network_code`, `created_at`, `active`) are `null`.
- With [`granularity=day`](https://docs.linkrunner.io/api-reference/reporting-campaigns#day-level-breakdown), the row also gets a `daily` array.
- Organic cannot be combined with a filter that narrows the campaigns. `network`, `search`, `active`, `meta_account_id` and `view=retargeting` return `422`.

### Event columns

Event columns are opt-in. Name the events you want and the response carries those and no others, which keeps the payload small and the query fast.

| Parameter | Effect | Example |
| --- | --- | --- |
| `events` | Return `custom_events` for these event names. | `events=Purchase,AddToCart` |
| `payment_events` | Return `payment_events` for these revenue types. | `payment_events=PURCHASE` |
| `cost_per_event` | Add `cost_per_custom_events` / `cost_per_payment_events` for these names (spend divided by that event's count). | `cost_per_event=Purchase,PURCHASE` |
| `unique_user_events` | Make these events' `count` distinct users instead of total occurrences. The field name stays `count`. | `unique_user_events=Purchase` |
| `active_users` | Override the active-users window, in days. Defaults to 7. | `active_users=14` |
| `event_columns` | Return event counts filtered by [event parameters](https://docs.linkrunner.io/features/event-parameters). A JSON array. See [below](https://docs.linkrunner.io/api-reference/reporting-campaigns#event-columns-with-parameter-filters). | `event_columns=[{...}]` |

The first five take a comma-separated list. Unknown event names are dropped silently, since they match no rows.

Naming an event in **any** of `events`, `payment_events`, `cost_per_event` or `unique_user_events` puts its count in the response, because a cost-per value is spend divided by that count and a distinct-user count replaces it. The extra columns are what you add on top:

- `events=Purchase` returns `custom_events.Purchase` and nothing else.
- `cost_per_event=Purchase` returns `cost_per_custom_events.Purchase` **and** `custom_events.Purchase`.
- `unique_user_events=Purchase` returns `custom_events.Purchase` whose `count` is distinct users rather than occurrences.

Send none of them and the response contains no event columns at all: `custom_events`, `payment_events`, `cost_per_custom_events` and `cost_per_payment_events` all come back as `{}`. Every other metric (clicks, installs, signups, spend, revenue, ROAS, retention) is unaffected.

Find your project's event names under [Dashboard → Events](https://dashboard.linkrunner.io/dashboard/events).

> **Note:**
>
> **This changed on 2026-09-11.** The endpoint used to infer events from the saved dashboard column settings of one of your project admins, so the same request returned different events per project and changed when that person edited their dashboard. Those settings are no longer read.
>
> If you relied on events appearing without asking for them, add an `events=` list naming them. If a count dropped, that event was previously counted per distinct user: add it to `unique_user_events` as well.

#### Example: two events, with cost-per and distinct users

```bash
curl -G 'https://api.linkrunner.io/api/v1/reporting/campaigns' \
  -H 'linkrunner-key: YOUR_API_KEY' \
  --data-urlencode 'from=2026-04-01' \
  --data-urlencode 'to=2026-04-30' \
  --data-urlencode 'events=Purchase,AddToCart' \
  --data-urlencode 'cost_per_event=Purchase' \
  --data-urlencode 'unique_user_events=Purchase'
```

Each campaign, ad set and ad creative in the response then carries:

```json
{
    "custom_events": {
        "Purchase": { "count": "412", "amount": "0.00" },
        "AddToCart": { "count": "1,905", "amount": "0.00" }
    },
    "cost_per_custom_events": { "Purchase": "258.20" },
    "payment_events": {},
    "cost_per_payment_events": {}
}
```

`Purchase` reports distinct users because it was named in `unique_user_events`; `AddToCart` reports total occurrences. Both use the `count` field, so the parameter you sent is the only thing that tells them apart. `payment_events` is empty because no revenue types were requested.

### Event columns with parameter filters

`event_columns` counts only the events whose [event parameters](https://docs.linkrunner.io/features/event-parameters) match, for example purchases where `plan` is gold. It matches the filtered columns you can add in the dashboard's App Campaigns table. Send it as a URL-encoded JSON array of up to 10 columns:

| Field | Required | Description |
| --- | --- | --- |
| `name` | Yes | The key the result comes back under. Up to 256 characters. Must be unique and must not repeat a name in `events` or `payment_events`. |
| `event_name` | Yes | The event to count. For a payment column, the payment type, such as `FIRST_PAYMENT`. |
| `event_type` | No | `custom` (default) or `payment`. |
| `filters` | Yes | Up to 10 filters, each `{ "key": "...", "op": "...", "values": [...] }`. |
| `combinator` | No | `and` (default) needs every filter to match. `or` needs any one of them. |

Each filter compares one top-level parameter key. Keys are case sensitive and up to 128 characters. Values are strings of up to 256 characters, at most 50 per filter. Across all columns in one request, send at most 60 filters and 1,000 filter values in total.

| `op` | `values` | Matches events where the parameter |
| --- | --- | --- |
| `is`, `is_not` | 1 or more | equals any listed value / equals none of them, case sensitive. `is_not` also matches events without the key |
| `contains`, `not_contains` | 1 | contains the text / does not contain it, ignoring case. Lists and objects match on their JSON text. The value cannot be empty |
| `eq`, `neq`, `gt`, `gte`, `lt`, `lte` | 1 | compares as a number. A stored value that is not a number never matches, except with `neq`. The filter value must be a number |
| `between`, `not_between` | 2 | is inside / outside the range, both ends included. Both values must be numbers, lower bound first |
| `is_true`, `is_false` | 0 | is `true` / `false`, or the text `"true"` / `"false"` in any case |
| `is_set`, `is_not_set` | 0 | is present / is missing |

Values are compared as text, so `"5"` and `5` match the same events.

```bash
curl -G 'https://api.linkrunner.io/api/v1/reporting/campaigns' \
  -H 'linkrunner-key: YOUR_API_KEY' \
  --data-urlencode 'from=2026-04-01' \
  --data-urlencode 'to=2026-04-30' \
  --data-urlencode 'events=purchase' \
  --data-urlencode 'event_columns=[
    {"name": "purchase (plan is gold)", "event_name": "purchase",
     "filters": [{"key": "plan", "op": "is", "values": ["gold"]}]},
    {"name": "big team first payments", "event_name": "FIRST_PAYMENT", "event_type": "payment",
     "filters": [{"key": "seats", "op": "gt", "values": ["10"]}, {"key": "plan", "op": "is", "values": ["gold", "diamond"]}],
     "combinator": "and"}
  ]'
```

Each result comes back under its `name`, in `custom_events` for custom columns and `payment_events` for payment columns, in the same shape as the plain columns:

```json
{
    "custom_events": {
        "purchase": { "count": "1,240", "amount": "0.00" },
        "purchase (plan is gold)": { "count": "312", "amount": "0.00" }
    },
    "payment_events": {
        "big team first payments": { "count": "48", "total": "71,520.00" }
    }
}
```

- Add a column's `name` to `unique_user_events` to count distinct users instead of events.
- `cost_per_event` does not apply to `event_columns`. A column named there gets no cost-per value.
- An invalid `event_columns` value returns `400` with the reason in `msg`.

### Errors

| Status | When |
| --- | --- |
| `400` | `event_columns` is invalid: not a JSON array, more than 10 columns, a missing or repeated `name`, an unknown `op`, a filter missing the values its `op` needs, a non-number value for a number `op`, a filter over its limits, or more than 60 filters or 1,000 values across all columns. |
| `401` | Missing or invalid `linkrunner-key`. |
| `402` | Billing account suspended. Body includes `payment_link`. |
| `422` | `limit` is non-numeric, less than 1, or greater than 100. Or `granularity` is not `day`, or a `granularity=day` request is missing `from` or `to`, has `to` before `from`, or covers more than 31 days. Or `include_organic` is not `true` or `false`, or is `true` with a filter listed under [Organic row](https://docs.linkrunner.io/api-reference/reporting-campaigns#organic-row). |
| `429` | Rate limit exceeded. |
| `500` | Unexpected server error. Retry after a short backoff. |
| `503` | A `granularity=day` request took too long (about 50 seconds). Use a shorter range, a smaller `limit` or fewer event columns. Also returned when the Organic row cannot be read. |

## Troubleshooting

**Campaigns created outside my from/to range are in the response**

This is expected. `from` and `to` set the metrics window; they never remove campaigns from the list. To keep only campaigns created in a range, request `sort_field=created_at&sort_order=descending`, then drop rows client-side once `created_at` falls before `from`.

**422 when I ask for 90 days by day**

`granularity=day` covers at most 31 days per request. Split the period into months and make one call each, one minute apart: 90 days is 3 calls.

**429 Too Many Requests on the second call**

The limit is 1 request per minute per API key. Honor the `Retry-After: 60` header and cache responses for at least 60 seconds. The underlying analytics refresh on roughly the same cadence, so polling faster returns the same data.

**Numbers don't match the dashboard**

Compare the same date range and the same `view` (`user_acquisition` vs `retargeting`). The API interprets `from` and `to` in your project's timezone, exactly like the dashboard date picker. If you are doing math on the values, remember they are formatted strings (see the warning under [Response](https://docs.linkrunner.io/api-reference/reporting-campaigns#response)).

## TypeScript types

```ts
export interface ReportingCampaignsResponse {
    msg: string;
    status: number;
    data: {
        campaigns: Campaign[];
        pagination: { total: number; pages: number; page: number; limit: number };
        display_currency?: string;
        view?: "user_acquisition" | "retargeting";
        granularity?: "day"; // present when you sent granularity=day
    };
}

// Custom & payment events: map of event name → count/amount
interface EventFields {
    custom_events?: { [name: string]: { count: string; amount?: string } | string };
    payment_events?: { [type: string]: { count: string; total: string } };
    cost_per_custom_events?: { [name: string]: string };
    cost_per_payment_events?: { [type: string]: string };
}

export interface Campaign extends EventFields {
    id: number;
    // id 0 is the Organic row (include_organic=true): active, created_at, display_id and link are null
    active: boolean | null;
    created_at: string | null;
    display_id: string | null;
    link: string | null;
    name: string;

    // Counts (formatted strings)
    clicks: string;
    installs: string;
    reinstalls?: string;
    reengagements?: string;
    "sign-ups": string;
    uninstalls?: string;
    suspicious_installs?: string;
    click_through_attribution?: string;
    view_through_attribution?: string;
    conversion: string;

    // Money (formatted strings, in display_currency)
    revenue: string;
    revenue_event_count?: string;
    spend: string;
    roas?: string;
    cost_per_install?: string;
    cost_per_reinstall?: string;
    cost_per_signup?: string;

    // Network flags
    meta: boolean;
    meta_web_to_app: boolean;
    google: boolean;
    google_web_to_app: boolean;
    tiktok?: boolean;
    snapchat?: boolean;
    linkedin?: boolean;
    ad_network_code?: string;

    // Platforms
    ios: boolean;
    android: boolean;

    // Misc
    activity_in_last_x_days: number;
    has_date_filter: boolean;
    domain?: { id: number; name: string } | null;
    custom_store_listing: string | null;
    active_users?: number | string;

    // Retention buckets (rates as percentages). `retention` carries cumulative retention.
    retention: { d1: number | string; d7: number | string; d14: number | string; d30: number | string };
    rolling_retention?: { d1: number | string; d7: number | string };
    classic_retention?: { d1?: number | string; d7?: number | string; d14?: number | string; d30?: number | string };
    daywise_revenue?: { d0?: number | string; d3?: number | string; d7?: number | string; d30?: number | string };

    // Connected ad-account (Meta / Google / Apple Search Ads)
    network_account?: {
        id: number;
        name: string;
        email: string;
        status: string;
        capi_configured: boolean;
        account_name?: string;
        external_customer_id?: string;
    } | null;

    // Hierarchy: campaign → adSets → adCreatives + keywords
    adSets?: AdSet[];

    // Present when you sent granularity=day, oldest day first
    daily?: DailyRow[];
}

// One day of a campaign. Same field names and formatting as Campaign.
export interface DailyRow extends EventFields {
    date: string; // YYYY-MM-DD, project timezone
    clicks?: string;
    impressions?: string;
    installs?: string;
    reinstalls?: string;
    reengagements?: string;
    "sign-ups"?: string;
    uninstalls?: string;
    suspicious_installs?: string;
    click_through_attribution?: string;
    view_through_attribution?: string;
    conversion?: string;
    revenue?: string;
    revenue_event_count?: string;
    spend?: string;
    roas?: string;
    cost_per_install?: string;
    cost_per_reinstall?: string;
    cost_per_signup?: string;
}

export interface AdSet extends Omit<AdCreative, "type" | "deeplink"> {
    suspicious_installs?: string;
    daywise_revenue?: Campaign["daywise_revenue"];
    ios: boolean;
    android: boolean;
    adCreatives?: AdCreative[];
    keywords?: Keyword[];
}

export interface AdCreative extends EventFields {
    id: string;
    name: string;
    type: string;
    deeplink: number;
    clicks: string;
    installs: string;
    "sign-ups": string;
    spend: string;
    revenue: string;
    revenue_event_count?: string;
    conversion: string;
    roas?: string;
    cost_per_install?: string;
    cost_per_signup?: string;
    retention: Campaign["retention"];
    rolling_retention?: Campaign["rolling_retention"];
}

// Apple Search Ads keyword-level rows. Same shape as AdCreative metrics.
export interface Keyword extends Omit<AdCreative, "type" | "deeplink" | "retention"> {
    suspicious_installs?: string;
    retention?: Campaign["retention"];
}
```

**Need help?** Contact <support@linkrunner.io>
