lads_list_campaign_groups
LinkedIn Ads read low risk
Part of the LinkedIn Campaign Manager Agent.
What it does
Searches/lists campaign groups in an account via the q=search finder. Uses CURSOR pagination (pageSize/pageToken; nextPageToken in metadata) — NOT start/count. Filter by status[], id[], name, and test. Returns elements with the same shape as lads_get_campaign_group plus metadata.nextPageToken while more remain (the last page has none, and LinkedIn may answer it with a start/count paging block, which is not a cursor), and warnings (an empty first page carries a note that the account has none matching the filters). Use to inventory groups, find groups by status (e.g., ACTIVE,DRAFT), or locate the default vs non-default groups. Accuracy notes: every filter is optional (with none, LinkedIn lists every group); max pageSize 1000, default 100; budgets are decimal strings (not micros); test groups are included (include_test=true returns ONLY test groups).
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | yes | Numeric ad account ID (digits only). |
status | array<string> | no | Filter by status, upper-cased and checked before sending: ACTIVE|ARCHIVED|CANCELED|DRAFT|PAUSED|PENDING_DELETION|REMOVED (LinkedIn's values; any other is refused, naming them). Encoded as search=(status:(values:List(...))). |
ids | array<string> | no | Filter by group URN(s) urn:li:sponsoredCampaignGroup:{id} (search.id.values). |
name | string | no | Filter by name (search.name.values). |
include_test | boolean | no | If true, return ONLY test groups (search.test=true); if false/omitted, return both test and non-test. Default false. |
sort_order | string | no | ASCENDING (default) or DESCENDING, sorted by id. |
page_size | integer | no | Cursor page size; default 100, max 1000 (clamp values >1000 to 1000). |
page_token | string | no | Opaque cursor; pass the prior response's metadata.nextPageToken to fetch the next page (null when exhausted). |
Safeguards
Policy
Strict per-account isolation: enumerate groups only within the bearer's authorized account; never aggregate groups across unaffiliated clients.
Reminder
List only within the authorized account; don't build cross-account inventories.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | A status outside LinkedIn's values, or a sort_order other than ASCENDING|DESCENDING, is refused before the call, naming the values; LinkedIn's own 400 (a malformed filter value) is surfaced. | Use a value the message names, or fix the filter LinkedIn names; every filter is optional. | no |
CUSTOMER_NOT_FOUND | Account not found / not in scope (404). | Verify account_id. | no |
PERMISSION_DENIED | Missing r_ads/rw_ads or no role on the account (403). | Confirm scope/role. | no |
TOKEN_REVOKED | Token expired/revoked (401). | needs_reauth — refresh once and retry; else reconnect. | yes |
RESOURCE_EXHAUSTED | Rate/quota limit (429). | Backoff 5/10/20s cap 60s; honor reset header. | yes |
PLATFORM_UNAVAILABLE | LinkedIn 5xx. | Retry with backoff. | yes |
Edge cases
- Every filter is optional: with none, LinkedIn lists every group in the account (its guide calls search criteria mandatory, but a search with none answered 200 in the 30 Sep e2e).
- Cursor pagination: pass back metadata.nextPageToken; nextPageToken null/absent means last page.
- No matches -> success with empty elements and a note that the account has none (matching these filters).
- Test groups are included; include_test=true returns only test groups (search.test=true).
- page_size over 1000 is clamped to 1000 before sending.
- Result set spans multiple pages — never assume a single call returns all groups.