Currently Available: Need a skilled Software Developer for your next project?
Categories
SEO, GEO and AEO

Paginate Search Console API for Image and Video Data

When you pull image or video performance data from Google Search Console, the Search Analytics API uses the type field in your request to pick the search type. Unlike many other Google APIs, this endpoint does not return a page token for fetching the next batch of results.

Instead, you pass a startRow offset to tell the API how many rows to skip. You keep the rest of your query settings identical, raise startRow on each call, and stop once a successful response comes back with no rows. When you build this offset loop separately from token-based pagination, you avoid mixing Search Analytics mechanics with generic web-search APIs.

Request image and video data separately

The Search Analytics query endpoint returns data from Google Search’s Images tab when you set type to "image", and it returns video search results when you set type to "video". You need to run a separate query for each type. If you leave type out, the API defaults to web, which covers the combined All tab and does not replace a dedicated image or video request. Google documents all of these fields in the Search Analytics query reference.

For example, this request asks for video rows grouped by page and device:

{
  "startDate": "2026-10-01",
  "endDate": "2026-10-01",
  "type": "video",
  "dimensions": ["page", "device"],
  "rowLimit": 25000,
  "startRow": 0
}

Send this JSON body in a POST request to searchanalytics.query for your Search Console property, along with the authorization that property requires. To fetch the next batch, keep the dates, type, dimensions, filters, and other settings identical, and change only startRow to 25000. When you want image data, start a separate query with type set to "image".

You use rowLimit to cap how many rows a single call can return. The API allows up to 25,000 rows per request and defaults to 1,000 if you omit it. Because startRow is a zero-based offset, 0 starts at the first row and 25000 skips the first 25,000 rows. The endpoint only supports these offset fields and has no pageToken or nextPageToken, so a token-based loop copied from another API will fail here.

Advance the offset and detect exhaustion

Keep every field in your request identical except startRow. If you alter the date range, dimensions, filters, or type on a later call, the API applies your offset to a different result set, and the batches you collect will no longer belong to one consistent query.

Each successful response includes a rows list, where every row’s keys array matches the order of the dimensions you requested. When you ask for ["page", "device"], the first key holds the page URL and the second holds the device. Keep in mind that a page key identifies the page dimension value, and by itself it does not point to an image-file URL or a video asset.

You can stop the loop in two ways. If you want a strict check, keep requesting rows until a successful response comes back with an empty rows list. When the final batch happens to be completely full, you make one more call and stop once that call returns no rows. Alternatively, as Google explains in its guidance on retrieving all performance data, you can stop as soon as a batch contains fewer rows than you asked for, and only request the next offset when a batch is full.

This Python-like example uses the Google API client style. It checks that each row has the expected format and continues until a successful response contains no rows:

LIMIT = 25_000

def fetch_all(client, site_url, base_body, expected_key_count):
    if base_body.get("type") not in {"image", "video"}:
        raise ValueError("type must be 'image' or 'video'")

    rows = []
    start_row = 0

    while True:
        body = {
            **base_body,
            "rowLimit": LIMIT,
            "startRow": start_row,
        }

        # API errors raise here; they are not treated as end-of-results.
        response = client.searchanalytics().query(
            siteUrl=site_url,
            body=body,
        ).execute()

        page_rows = response.get("rows", [])
        if not isinstance(page_rows, list):
            raise ValueError("API response rows must be a list")

        for row in page_rows:
            keys = row.get("keys")
            if not isinstance(keys, list) or len(keys) != expected_key_count:
                raise ValueError("Unexpected row key shape")

            for metric in ("clicks", "impressions", "ctr", "position"):
                if metric not in row:
                    raise ValueError(f"Missing metric: {metric}")

        if not page_rows:
            break

        rows.extend(page_rows)
        start_row += LIMIT

    return rows

When your request uses dimensions: ["page", "device"], pass expected_key_count=2. If the API returns a row with a different number of keys, the function raises an error instead of silently mapping values to the wrong dimensions. It also lets API and authorization failures raise normally so your script never mistakes a failed call for the end of the dataset.

A representative response row looks like this:

{
  "keys": ["https://www.example.com/video-page", "MOBILE"],
  "clicks": 12.0,
  "impressions": 430.0,
  "ctr": 0.027906976744186046,
  "position": 5.4
}

This sample is for illustration only and does not come from a live property. Its two keys line up with the page and device dimensions from the request. If you want help choosing your image and video query settings, see filtering image and video queries.

Interpret the returned rows carefully

When your offset loop finishes, you have collected everything the API will return for that query, though Search Console may still hold records that the query did not expose. Google enforces a ceiling of 50,000 rows per day per search type, and the API can also omit rows when you group or filter by page or query. Your loop can only fetch rows that the endpoint actually returns; Google’s performance data guidance covers these limits and caveats in detail.

How broadly you scope each query also determines how much quota you spend. When you request longer date ranges or group and filter by page or query, the API counts more load against your quota, so avoid repeating identical requests unnecessarily. If the API rejects a call because you hit a quota limit, treat that response as a failure rather than an empty page. You can check the exact thresholds in Google’s Search Console API usage limits.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *