ETLMCPData Conveyance Works
Log in Start free
Docs

Recipe: read stored rows with /api/v1/data

Pull your stored daily ad rows into a notebook or BI tool over the REST API, and page by date so the row limit never drops rows unnoticed.

To read the rows etlmcp has stored, send GET /api/v1/data with a date range and, if you want, a network, a source and a list of fields. The answer holds the rows, a count, and a truncated flag. When truncated is true, more rows matched than your limit allowed and the rest were left out, so you must ask again with a narrower date range. The rows are the ones pulled from each network, before any pipeline's transform rules, and their dates are in each ad account's own time zone.

Query stored data lists the parameters and the response schema. This page shows how to use them without losing rows.

A first request

Send an API key in the Authorization header (see API keys):

curl -s -H "Authorization: Bearer $ETLMCP_API_KEY" \
  "https://app.etlmcp.com/api/v1/data?start=2026-11-01&end=2026-11-07&network=mock&fields=date,campaign_name,cost,clicks,currency&limit=5000"

The example reads the demo connector's rows, whose network key is mock. What to know about each parameter:

  • start and end are days written YYYY-MM-DD, and both ends are included. Leave either out and that side of the range is open.
  • network keeps one network's rows. Use the network key that List networks returns.
  • source_id keeps one source: one ad account, GA4 property or store. Take the id from List sources.
  • fields is a comma-separated list of the columns you want. Without it, each row carries every column plus an extra object.
  • limit caps the rows in one answer. It has a default and a ceiling, both given as the parameter's default and maximum in the OpenAPI document. Set it yourself so you know which number truncated is measured against.

You only see the rows of the workspace your credential belongs to.

Choosing fields

The standard columns are source_id, date and network; the ids account_id, campaign_id, adgroup_id and ad_id; the names account_name, campaign_name, adgroup_name and ad_name; and the measures impressions, clicks, cost, conversions, conversion_value, ctr, cpc, cpm, cpa and currency.

Anything a network reports beyond those lives in extra. Ask for one of its keys with extra.<key>, such as extra.reach. A row that lacks that key returns it as null, so an empty column usually means the network does not report it, not that the request failed. Ask for extra alone to get the whole object.

Any other name is refused with a 400 and unknown field: {…}, naming the field. Keep currency in your field list whenever you add up cost across accounts: rows from accounts that bill in different currencies cannot be summed as one number.

Paging by date

There is no cursor or offset. You page by narrowing the date range, which works because the rows come back sorted by date first, then by network, campaign, ad group and ad.

A loop that never drops a row:

  1. Ask for your full range with a limit you choose.
  2. If truncated is false, you have every row. Stop.
  3. If it is true, note the date of the last row you got. Drop every row with that date from what you keep, because that day may be cut off partway.
  4. Ask again with start set to that date and the same end, and go back to step 2.

If one day alone fills the limit, step 3 leaves you with nothing new. Split that day by network or by source_id instead, or raise limit.

import os, requests

URL = "https://app.etlmcp.com/api/v1/data"
HEADERS = {"Authorization": f"Bearer {os.environ['ETLMCP_API_KEY']}"}

def fetch(start, end, limit, **filters):
    rows = []
    while True:
        page = requests.get(URL, headers=HEADERS, timeout=60,
                            params={"start": start, "end": end, "limit": limit, **filters}).json()
        if not page["truncated"]:
            return rows + page["rows"]
        last = page["rows"][-1]["date"]
        kept = [r for r in page["rows"] if r["date"] != last]
        if not kept:
            raise RuntimeError(f"{last} alone exceeds limit; split by network or source_id")
        rows += kept
        start = last

The loop keeps date in each row; if you pass fields, include date in it.

Errors to expect

Errors come back as JSON with an error message.

  • 400: start must not be after end when the range is reversed; a start or end that cannot be read as a date; a limit outside the allowed range; or an unknown field.
  • 404: not found when source_id is not a source in your workspace. A source in another workspace answers the same way as one that does not exist.
  • 429: each credential may make 120 requests a minute, REST and MCP together. A paging loop over a long range can reach this; wait the seconds the Retry-After header gives before the next call.

What the rows are and are not

The data endpoint reads what etlmcp stored from the network, not what your destination holds. If a pipeline renames, drops or computes columns with transform rules, those changes appear in the destination only. Compare like with like: check API totals against the network's own reports, and destination totals against the pipeline that wrote them.

Each day is the ad account's own day. Two accounts set to different time zones each report on their own calendar, so a date range covers slightly different hours per account.

If an AI assistant reads your data through MCP instead, it uses query_data, which returns at most 500 rows per call. Use this endpoint for bulk pulls into notebooks, scripts and BI tools.

Related