Skip to main content
This page is also available in Ukrainian.

Overview

GET /ad-groups now returns a paginated response instead of a flat array. Use offset and limit query parameters to page through results.
Breaking change — the response shape changed. FE code that treats the response as an array must be updated to read .results.

Response format

The endpoint now returns an object with pagination metadata:
{
  "results": [
    {
      "id": 123456,
      "name": "My Ad Group",
      "campaign_id": 789,
      "campaign_name": "Campaign A",
      "status": "ENABLED",
      "type": "SEARCH_STANDARD",
      "metrics": { ... }
    }
  ],
  "total": 142,
  "limit": 50,
  "offset": 0
}
FieldTypeDescription
resultsAdGroupSchema[]Current page of ad groups
totalintTotal count after search filtering
limitintEchoed limit value
offsetintEchoed offset value

Query parameters

ParameterTypeDefaultDescription
limitint50Maximum items per page
offsetint0Number of items to skip
These work alongside existing parameters (search, exclude_removed, etc.).

Usage examples

GET /api/v1/google-ads/{customer_id}/ad-groups
Returns the first 50 ad groups with total reflecting the full count.

Frontend integration

Update your API call to handle the new response shape:
// Before (flat array)
const adGroups = await api.get<AdGroup[]>("/ad-groups", { params });

// After (paginated object)
const { results, total, limit, offset } = await api.get<{
  results: AdGroup[];
  total: number;
  limit: number;
  offset: number;
}>("/ad-groups", { params: { ...params, offset: page * pageSize, limit: pageSize } });

const totalPages = Math.ceil(total / limit);

Notes

  • The CSV endpoint (GET /ad-groups/csv) is not affected — it still returns a flat CSV file.
  • total always reflects the count after search filtering but before pagination slicing.