Flexible live insights query
Live, flexible insights query against Meta's Graph API. Unlike GET /v1/ads/{adId}/analytics
(fixed metric set, cached), this forwards caller-chosen fields, breakdowns and filtering
to any Meta insights node and returns Meta's rows verbatim.
objectId selects the node: an ad account, campaign, ad set or ad platform id.
level sets row granularity independently of the node.
Semantic validation is Meta's: an unknown field or invalid breakdown combination returns a 400 carrying Meta's message. For long ranges or agency-scale accounts prefer the async variant (POST /v1/ads/insights/reports).
API key authentication - use your Zernio API key as a Bearer token
In: header
Query Parameters
Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
Meta insights node: act_, campaign id, ad set id or ad id.
Row granularity
"ad" | "adset" | "campaign" | "account"Comma-separated Graph insights fields (e.g. spend,impressions,frequency,website_purchase_roas). Omitted = Meta's default set.
Comma-separated Graph breakdowns (e.g. age,gender or publisher_platform).
Comma-separated Graph action breakdowns. Segments the actions[] arrays in each row.
Comma-separated Meta attribution windows. Action values are returned keyed per window.
When actions are counted: impression, conversion or mixed.
Use the ad sets' own attribution settings for action counting.
JSON array of Meta filter objects: [{"field", "operator", "value"}]. Applied server-side by Meta.
Meta date_preset (e.g. last_7d, last_30d, this_month). Mutually exclusive with fromDate/toDate.
Start of range (YYYY-MM-DD); requires toDate.
dateEnd of range (YYYY-MM-DD); requires fromDate.
dateDays per row (1-90), monthly, or all_days.
Rows per page
251 <= value <= 500Cursor from paging.after of the previous page.
Response Body
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.adinsights.queryAdInsights({ query: { accountId: 'account_abc123', objectId: 'object_abc123', },});console.log(data);{
"objectId": "string",
"data": [
{}
],
"paging": {
"after": "string"
}
}{
"error": "Unauthorized"
}Get campaign analytics GET
Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns. Breakdowns are fetched live from Meta at the campaign level (one call per dimension, no per-ad fan-out), so an agency dashboard gets campaign-level age/gender/etc. without summing thousands of per-ad reads. `campaignId` is the platform campaign id; pass `platform` when a campaign id could be ambiguous across platforms. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
List associated campaigns GET
LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.