> For the complete documentation index, see [llms.txt](https://docs.adpage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adpage.io/data-and-insights/marketing-integrations/adpage-feed-your-own-api.md).

# AdPage Feed (your own API)

Deliver weekly revenue and returns from your own ERP or source system through three read-only endpoints.

When your real revenue lives somewhere AdPage has no integration for — a custom ERP, a wholesale system, a till in a physical shop — you can serve it yourself. **AdPage Feed v1** is a small contract: three GET endpoints, one key, weekly totals only.

{% hint style="info" %}
This integration is released per customer. If you do not see the tile, ask <support@adpage.io> to enable it.
{% endhint %}

### Why this exists

The Marketing Mix Model runs on one revenue figure per week: the number your advertising budget has to explain. The closer that number is to your actual revenue, the more trustworthy the model's conclusions.

Tracking measures something slightly different from your accounts, and it does not measure shop revenue at all. Your source system does. This connection lets you supply that number without AdPage ever reaching into your ERP.

### What AdPage asks for, and what it does not

| Asked for                                    | Never asked for                |
| -------------------------------------------- | ------------------------------ |
| Revenue per ISO week per sales channel       | Orders, order lines, customers |
| Return value per week per channel (optional) | Any personal data              |
| Read access through one key                  | Write access of any kind       |
| One pull per week                            | Realtime or daily polling      |

A static key on three read-only endpoints is deliberately the smallest possible surface. It passes most security reviews without discussion.

### Three ways to connect

**Route A — you build the feed (recommended).** Implement the three endpoints from the [technical specification](https://docs.adpage.io/data-and-insights/marketing-integrations/adpage-feed-your-own-api/technical-specification.md). For a developer with access to the data this is half a day to a day. No custom work on the AdPage side, so nothing to wait for.

**Route B — you already have an API.** Send your documentation plus one example response and AdPage will tell you whether it fits as is. Different paths, a different header name, other channel names and VAT-inclusive amounts can be set on our side. If your field names or the shape of the response differ from the specification, we tell you what has to change. The conditions that cannot be worked around: data per week, distinguishable per sales channel, and stable — asking for the same week twice must return the same answer.

**Route C — no API available.** The weekly CSV upload stays available. It works, but someone has to do it every week, which is the step that gets skipped when things get busy.

### The contract

```
GET {base}/livez                                      → {"status":"ok"}, no auth
GET {base}/adpage/v1/weekly-revenue?date_from&date_to  → revenue per ISO week per channel
GET {base}/adpage/v1/weekly-returns?date_from&date_to  → returns per ISO week per channel (optional)
```

Four rules carry the contract:

1. Return **whole ISO weeks**, also when the range starts or ends mid-week.
2. The **same week always returns the same figure**, whichever range asked for it.
3. When a figure is revised, **`modified_at` goes up**.
4. **One row per week per channel** — and per location or postcode area, if you send those. No duplicates.

Rule 2 is the one that matters most. A feed that returns slightly different numbers each time it is asked makes the model unstable in ways that are very hard to diagnose later.

Fields, examples, error handling and a test script for your developer are in the [technical specification](https://docs.adpage.io/data-and-insights/marketing-integrations/adpage-feed-your-own-api/technical-specification.md).

### Connect the feed in AdPage

{% stepper %}
{% step %}

#### Open the tile

Go to **Integrations**, select the container, and open the **Your own API (AdPage Feed)** tile.
{% endstep %}

{% step %}

#### Fill in the base URL and the key

Enter the **company name**, the **base URL** (https only, without a path), how your API expects the key — **Authorization: Bearer …** or a **custom header** with its name — and the **key** itself. Under **Advanced settings** you can enter different paths for the revenue and returns endpoints.

A few settings are not in the tile: a VAT rate other than 21% for a feed that only supplies amounts including VAT, channel names other than the defaults, and subtracting returns from the target. Ask support to set those.
{% endstep %}

{% step %}

#### Test, then save

**Test only** calls your API for real and shows what would land: how many weeks, how much webshop and store revenue, how many return rows, and which channels stay out of the target. **Test & connect** does the same and saves only if it works.

A connection that returns no usable weekly revenue for the last four weeks is never saved — it would otherwise sit in the weekly job, silently failing. The key goes to the server and never comes back.
{% endstep %}

{% step %}

#### The history comes in by itself

Right after connecting, AdPage fetches the last two years. If that run hits its time budget, the tile says so: click **Fetch history now** for the rest. What was fetched is complete, and a repeat can never double-count: the blocks overlap on their boundary week and the tables de-duplicate themselves.

After that, AdPage fetches the last two years again every Tuesday morning, so late bookings and corrections come through.
{% endstep %}
{% endstepper %}

### Rotating the key

Issue a primary and a secondary key, so you can rotate without an interruption. Open the tile, choose **Replace key**, paste the new key and save. The new key is tested first; if the test fails, the old key stays. Every other setting stays as it is.

### Troubleshooting

**`/livez` fails.** The base URL is wrong or the endpoint is not reachable from the internet. It takes no auth by design; if it demands a key, that is the fault.

**Authentication fails on the data endpoints.** Check how the key is sent. `Authorization: Bearer …` and a custom header such as `X-API-Key` without a prefix are both common, and mixing them up is the usual cause.

**AdPage reports a redirect.** Enter the final URL. Redirects are not followed.

**The test reaches the API but finds no usable revenue.** There is no data for the last four weeks, `date_from` and `date_to` are not applied, or the channel values are not ones AdPage recognises. The message lists the channels it received.

**Your figures differ from AdPage's own measurement by about the VAT rate.** That is usually correct: the model runs on revenue excluding VAT, while tracking measures it including VAT. The tile says so when the gap matches. If it does not, check that `revenue_excl_vat` really excludes VAT.

**The model behaves oddly after a while.** Check rule 2 — whether the same week still returns the same figure. A feed reading from a live table without a cut-off date drifts.

Still stuck? Contact <support@adpage.io> with the container and the base URL — never the key.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.adpage.io/data-and-insights/marketing-integrations/adpage-feed-your-own-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
