Skip to main content
GET
Get campaign tree

Request contract

  • Method and path: GET /apis/v1/ads/tree
  • Availability: enabled
  • Request URL template: https://api.aisa.one/apis/v1/ads/tree
  • connectionId: query; required
  • page: query; optional
  • limit: query; optional
  • source: query; optional
  • platform: query; optional
  • status: query; optional
  • adAccountId: query; optional
  • pageId: query; optional
  • campaignId: query; optional
  • updatedSince: query; optional
  • search: query; optional
  • fromDate: query; optional
  • toDate: query; optional
  • hasDelivery: query; optional
  • minSpend: query; optional
  • sort: query; optional
  • timeIncrement: query; optional
  • dailyLevel: query; optional
  • compare: query; optional
  • results: query; optional
  • Runtime facts: fe60122939c67dc98a3a6ac6b97bd5c326b526105150c8959304dd2160d4dd09
Complete OpenAPI definition Effective request and pricing declaration (including authentication and referenced schemas):

Cost and request rules

A request reference price is not currently available; use a request quote where supported. Account-specific pricing and final settlement may differ. Published reference values are not an account-specific quote or a settled charge. For endpoints supporting X-AISA-Cost-Mode: quote, obtain a free quote for your exact request before execution; reconcile the settled cost with response metadata and Usage Logs. USD amounts use 1,000,000 integer micro-USD per dollar.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

connectionId
string
required

The ads connection (adc_...) the request runs on: one of yours, from GET /apis/v1/ads/connections. On a request with a JSON body it may be sent as a top-level body member instead.

Pattern: ^adc_[0-9A-Za-z]+$
page
integer
default:1

Page number (1-based)

Required range: x >= 1
limit
integer
default:20

Campaigns per page

Required range: 1 <= x <= 100
source
enum<string>
default:all

Matches the web UI's default view. Status is NOT filtered by default; use the status param for that.

Available options:
aisa,
all
platform
enum<string>
Available options:
facebook,
instagram,
tiktok,
linkedin,
pinterest,
google,
twitter,
openai,
reddit,
microsoft,
meta,
x
status
enum<string>

Filter by derived campaign status (post-aggregation)

Available options:
active,
paused,
pending_review,
rejected,
completed,
cancelled,
error
adAccountId
string

Comma-separate for multiple (?adAccountId=act_1,act_2,act_3); a single value keeps its old shape. Max 50 accounts per request.

pageId
string

Meta only: Facebook Page ID. Prunes the tree to ads whose creative is backed by this Page: campaigns and ad sets with no ad on the Page drop out, and rolled-up metrics cover only the Page's ads.

campaignId
string

Restrict the tree to one or more campaigns by platform campaign id (the id the platform assigns, e.g. Meta's numeric campaign id). Comma-separate up to 100 ids (?campaignId=123,456). Must be yours: it is checked through the connection before the request is sent, and an id that is not yours answers not_found.

updatedSince
string<date-time>

Returns only campaigns with a change stored since this time (ISO 8601 with offset, e.g. 2026-09-30T10:00:00Z). Each matching campaign comes back whole (every ad set and ad).

Case-insensitive substring match on campaign, ad set and ad names (_, % and spaces match literally), or an exact platform campaign, ad set or ad id. A campaign whose name matches returns with all its ad sets and ads.

Maximum string length: 500
fromDate
string<date>

Start of the METRICS date range (YYYY-MM-DD). On its own it affects only the spend/impression numbers overlaid on each node, not which campaigns are returned. Pass hasDelivery or minSpend to also filter the campaign set to this window.

toDate
string<date>

End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

hasDelivery
boolean

Return only campaigns that delivered between fromDate and toDate: spend above zero, or impressions served at zero spend.

minSpend
number

Return only campaigns whose spend between fromDate and toDate reaches this amount.

Required range: x >= 0
sort
enum<string>
default:newest

Campaign-level sort order. newest (default) / oldest order by the campaign's newest-ad createdAt. spend_desc / spend_asc order by aggregated spend in the requested date range; campaigns with no spend land at the end.

Available options:
newest,
oldest,
spend_desc,
spend_asc
timeIncrement
enum<integer>

Set to 1 to also return a daily breakdown (mirrors Meta Insights' time_increment=1). Only 1 (daily) is supported. See dailyLevel to control which levels carry it.

Available options:
1
dailyLevel
enum<string>
default:campaign

Which tree levels get the daily[] series when timeIncrement=1. Ignored when timeIncrement is unset. campaign (default): on campaign nodes only. The common per-campaign-trend case, and the smallest payload. adset: on ad sets too.

Available options:
campaign,
adset,
ad
compare
enum<string>

Set to previous to also read the period of the same length that ends the day before fromDate.

Available options:
previous
results
boolean

Set to true to add your own results (see Campaign results): every campaign gains results, the values you sent for the range plus each formula they allow, and the response gains resultMetrics to label them.

Response

Nested campaign tree with pagination

backfillPending
boolean

Meta only. Present and true while historical data is being backfilled.

campaigns
object[]
pagination
object
previousRange
object

Only with compare=previous. The range previousMetrics covers.

syncedAt
string<date-time> | null

When the most recently synced ad on this page was last read from the platform. Null before the first sync.