# Google Ads Ad Groups (`google-ads.ad_groups`)

Lists the ad groups of a Google Ads account with campaign, status, type, CPC bid and impressions, clicks, cost and conversions for a date range.

Docs: https://primaryapi.com/docs/api-reference/google-ads/ad_groups

- Endpoint: `POST https://api.primaryapi.com/v1/run/google-ads.ad_groups`
- Category: Search & SEO · Platform: `google-ads` · Kind: list · Status: live
- Price: 1 credit per call. Every call costs the same, including calls that were retried automatically.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=google-ads.ad_groups`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `customerId` | string | yes |  | pattern: ^(\d{3})-?(\d{3})-?(\d{4})$ | Google Ads customer (account) id, 10 digits with or without hyphens, e.g. "123-456-7890". List yours with google-ads.accounts. |
| `dateRange` | enum | no | "LAST_30_DAYS" | one of: TODAY, YESTERDAY, LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS, LAST_BUSINESS_WEEK, THIS_MONTH, LAST_MONTH, THIS_WEEK_SUN_TODAY, THIS_WEEK_MON_TODAY, LAST_WEEK_SUN_SAT, LAST_WEEK_MON_SUN | Period of the metrics, in the account’s time zone (default LAST_30_DAYS). Ignored when startDate/endDate are set. |
| `startDate` | string | no |  | pattern: ^\d{4}-\d{2}-\d{2}$ | Custom period start (YYYY-MM-DD), with endDate. |
| `endDate` | string | no |  | pattern: ^\d{4}-\d{2}-\d{2}$ | Custom period end (YYYY-MM-DD), inclusive, with startDate. |
| `limit` | integer | no | 50 | 1–1000 | Maximum number of results to return (1-1000, default 50). |
| `statuses` | enum[] | no | ["ENABLED","PAUSED"] | min 1 items; max 3 items | Ad group statuses to include (default ENABLED and PAUSED). |
| `campaignId` | string | no |  | pattern: ^\d{1,20}$ | Only the ad groups of this campaign (its numeric id, from google-ads.campaigns). |
| `cursor` | string | no |  |  | Opaque pagination cursor: pass the previous response's nextCursor. |
| `loginCustomerId` | string | no |  | pattern: ^(\d{3})-?(\d{3})-?(\d{4})$ | Only when the connected Google account reaches `customerId` THROUGH a manager (MCC) account: that manager account’s id (10 digits). Sent as the login-customer-id header. Omit for accounts the Google account can open directly. |
| `connection` | string | no |  | max 200 chars | Which connected account to use when the workspace has several for this provider: the customId you gave it (exact), its connection id ("con_…"), its handle (login, email or @handle) or its name. Optional; prefer the customId or id, which never match two accounts. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `customerId` | string |  |
| `currencyCode` | string \| null |  |
| `period` | string | The GAQL date condition used, e.g. "DURING LAST_30_DAYS" |
| `nextCursor` | string \| null |  |
| `adGroups` | object[] |  |
| `adGroups[].id` | string |  |
| `adGroups[].resourceName` | string |  |
| `adGroups[].name` | string \| null |  |
| `adGroups[].status` | string \| null | ENABLED, PAUSED or REMOVED (what you set) |
| `adGroups[].primaryStatus` | string \| null | ELIGIBLE, PAUSED, REMOVED, PENDING, NOT_ELIGIBLE or LIMITED (why it serves or not) |
| `adGroups[].type` | string \| null | SEARCH_STANDARD, DISPLAY_STANDARD, SHOPPING_PRODUCT_ADS, VIDEO_RESPONSIVE, … |
| `adGroups[].campaign` | object |  |
| `adGroups[].campaign.id` | string \| null |  |
| `adGroups[].campaign.name` | string \| null |  |
| `adGroups[].cpcBid` | number \| null | Max CPC bid (manual CPC), in the account currency |
| `adGroups[].cpcBidMicros` | integer \| null |  |
| `adGroups[].effectiveCpcBid` | number \| null | The CPC bid in effect; null unless the bidding strategy uses CPC bids |
| `adGroups[].effectiveCpcBidMicros` | integer \| null |  |
| `adGroups[].metrics` | object |  |
| `adGroups[].metrics.impressions` | integer \| null |  |
| `adGroups[].metrics.clicks` | integer \| null |  |
| `adGroups[].metrics.cost` | number \| null | In the account currency |
| `adGroups[].metrics.costMicros` | integer \| null |  |
| `adGroups[].metrics.conversions` | number \| null |  |
| `adGroups[].metrics.conversionsValue` | number \| null |  |
| `adGroups[].metrics.ctr` | number \| null |  |
| `adGroups[].metrics.averageCpc` | number \| null | cost ÷ clicks, in the account currency |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

Pagination: pass the previous response’s `nextCursor` as `cursor` to get the next page; `nextCursor: null` means there are no more results.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/google-ads.ad_groups" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerId":"1234567890"}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "customerId": "1234567890",
      "currencyCode": "USD",
      "period": "DURING LAST_30_DAYS",
      "adGroups": [
        {
          "id": "2221",
          "resourceName": "customers/1234567890/adGroups/2221",
          "name": "Brand terms",
          "status": "ENABLED",
          "primaryStatus": "ELIGIBLE",
          "type": "SEARCH_STANDARD",
          "campaign": {
            "id": "111",
            "name": "Brand - Search"
          },
          "cpcBid": 1.5,
          "cpcBidMicros": 1500000,
          "effectiveCpcBid": 1.5,
          "effectiveCpcBidMicros": 1500000,
          "metrics": {
            "impressions": 5310,
            "clicks": 402,
            "cost": 201,
            "costMicros": 201000000,
            "conversions": 21,
            "conversionsValue": 2310,
            "ctr": 0.0757062,
            "averageCpc": 0.5
          }
        }
      ],
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 1 credit per call
- Price ceiling: the usual price, even when a call is retried. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=google-ads.ad_groups`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

## Notes

Runs as your connected Google account and needs the Google Ads capability (ads). Amounts are in the account currency (currencyCode). Sorted by cost, highest first. Narrow to one campaign with campaignId. Manager accounts have no ad groups of their own: query a client account, passing the manager id as loginCustomerId.

