Skip to content

Get campaign tree

Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic "Ungrouped" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.

GET /v1/ads/tree

Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic "Ungrouped" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.

Parameters

  • None (query, any)

  • limit (query, integer) — Campaigns per page

  • source (query, string) — all (default) returns both Zernio-created ads and those discovered from the platform's ad manager — matches the web UI's default view. Pass zernio to restrict to isExternal=false only. Status is NOT filtered by default — use the status param fo...

  • platform (query, string)

  • status (query, any) — Filter by derived campaign status (post-aggregation)

  • adAccountId (query, string) — Platform ad account ID

  • accountId (query, string) — Social account ID

  • profileId (query, string) — Profile ID

  • fromDate (query, string) — Start of metrics date range (YYYY-MM-DD). Defaults to 90 days ago.

  • toDate (query, string) — End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

Responses

200 — Nested campaign tree with pagination

  • campaigns (array)
  • pagination ($ref)

401

403 — Ads access required. Legacy plans need the Ads add-on; included by default on usage-based plans.