List campaigns
Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign. Campaign status is derived from child ad statuses (active > pending_review > paused > error > completed > cancelled > rejected).
API key authentication - use your Zernio API key as a Bearer token
In: header
Query Parameters
Page number (1-based)
11 <= value201 <= value <= 100all (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 for that.
"all""zernio" | "all""facebook" | "instagram" | "tiktok" | "linkedin" | "pinterest" | "google" | "twitter"Filter by derived campaign status (post-aggregation)
"active" | "paused" | "pending_review" | "rejected" | "completed" | "cancelled" | "error"Platform ad account ID (e.g. act_123 for Meta)
Social account ID
Profile ID
Start of metrics date range (YYYY-MM-DD, inclusive). Defaults to 90 days ago when both date params are omitted.
dateEnd of metrics date range (YYYY-MM-DD, inclusive). Defaults to today. Max 730-day range.
dateResponse Body
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.adcampaigns.listAdCampaigns();console.log(data);{
"campaigns": [
{
"platformCampaignId": "string",
"platform": "facebook",
"campaignName": "string",
"status": "active",
"reviewStatus": "in_review",
"platformCampaignStatus": "string",
"campaignIssuesInfo": [
{}
],
"adCount": 0,
"budget": {
"amount": 0,
"type": "daily"
},
"campaignBudget": {
"amount": 0,
"type": "daily"
},
"budgetLevel": "campaign",
"isBudgetScheduleEnabled": false,
"currency": "string",
"metrics": {
"spend": 0,
"impressions": 0,
"reach": 0,
"clicks": 0,
"ctr": 0,
"cpc": 0,
"cpm": 0,
"engagement": 0,
"conversions": 0,
"costPerConversion": 0,
"actions": {
"link_click": 160,
"post_engagement": 300,
"offsite_conversion.fb_pixel_purchase": 42
},
"actionValues": {
"offsite_conversion.fb_pixel_purchase": 2456.78,
"offsite_conversion.fb_pixel_add_to_cart": 980.5
},
"purchaseValue": 0,
"roas": 0,
"lastSyncedAt": "2019-08-24T14:15:22Z"
},
"platformAdAccountId": "string",
"platformAdAccountName": "string",
"accountId": "string",
"profileId": "string",
"platformObjective": "string",
"optimizationGoal": "string",
"bidStrategy": "LOWEST_COST_WITHOUT_CAP",
"bidAmount": 0,
"roasAverageFloor": 0,
"promotedObject": {
"custom_event_type": "string",
"pixel_id": "string",
"page_id": "string"
},
"earliestAd": "2019-08-24T14:15:22Z",
"latestAd": "2019-08-24T14:15:22Z"
}
],
"pagination": {
"page": 0,
"limit": 0,
"total": 0,
"pages": 0
}
}{
"error": "Unauthorized"
}Send WhatsApp conversion event POST
Forward a WhatsApp Business Messaging conversion event (`LeadSubmitted`, `Purchase`, `AddToCart`, `InitiateCheckout`, `ViewContent`) to Meta's Conversions API with `action_source = business_messaging` and `messaging_channel = whatsapp`. The endpoint looks up the originating CTWA click ID (`ctwa_clid`) captured on the first inbound message of the conversation and replays it on every event so Meta can attribute the conversion back to the Click-to-WhatsApp ad that drove the chat. Configuration prerequisites on the WhatsApp account metadata: - `metaCapiDatasetId`: the Meta Pixel/Dataset ID linked to the WABA. - `connectedFacebookPageId`: the Facebook Page paired with the WhatsApp Business number. Identify the conversation by either `conversationId` (preferred) or `phoneE164` (digits only, no `+`). At least one is required. If the conversation has no captured `ctwa_clid`, the request returns 422 because there is nothing to attribute. Token and dataset coupling: the WhatsApp account's accessToken must have access to the configured `metaCapiDatasetId`. By default a WABA's system-user token is scoped to the WABA's own Business Manager and cannot post to a pixel owned by a different Business; Meta returns code 100 in that case. Either share the dataset with the WhatsApp app's Business in BM, or use a dataset already in the same Business as the WABA.
Get campaign tree GET
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.