Meta Ads
Create and boost Facebook + Instagram ads via Zernio API - Campaigns, Custom Audiences, Lookalikes, and analytics
Requires the Ads add-on. No Meta App review needed. Zernio is an approved Meta Marketing Partner, so you skip the App Review + ads_management permissions entirely.
What's Supported
| Feature | Status |
|---|---|
| Standalone campaigns (FB + IG) | Yes |
| Boost organic posts | Yes |
| Custom Audiences (customer list, website, lookalike) | Yes |
| Detailed targeting (interests, age, gender, location) | Yes |
| Campaign > Ad Set > Ad hierarchy | Yes |
| Real-time analytics (spend, CPC, CPM, ROAS) | Yes |
| Conversions API (offline events, hashed PII, dedup) | Yes |
| Ad Library API | Roadmap |
| Advantage+ campaigns | Roadmap |
Boost a Post
const ad = await zernio.ads.boostPost({ body: {
postId: 'POST_ID',
accountId: 'ACCOUNT_ID',
adAccountId: 'act_1234567890',
name: 'Spring launch boost',
goal: 'traffic',
budget: { amount: 40, type: 'daily' },
schedule: { startDate: '2026-04-20', endDate: '2026-04-27' },
targeting: {
age_min: 25,
age_max: 45,
countries: ['US', 'CA'],
interests: [{ id: '6003139266461', name: 'DevOps' }]
}
}});ad = client.ads.boost_post(
post_id="POST_ID",
account_id="ACCOUNT_ID",
ad_account_id="act_1234567890",
name="Spring launch boost",
goal="traffic",
budget={"amount": 40, "type": "daily"},
schedule={"startDate": "2026-04-20", "endDate": "2026-04-27"},
targeting={"age_min": 25, "age_max": 45, "countries": ["US", "CA"]},
)curl -X POST "https://zernio.com/api/v1/ads/boost" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"postId": "POST_ID",
"accountId": "ACCOUNT_ID",
"adAccountId": "act_1234567890",
"platform": "metaads",
"name": "Spring launch boost",
"goal": "traffic",
"budget": { "amount": 40, "type": "daily" },
"schedule": { "startDate": "2026-04-20", "endDate": "2026-04-27" },
"targeting": {
"age_min": 25,
"age_max": 45,
"countries": ["US", "CA"]
}
}'Create a Standalone Campaign
const ad = await zernio.ads.createStandaloneAd({ body: {
accountId: 'acc_metaads_123',
adAccountId: 'act_1234567890',
name: 'Spring sale - US Feed',
goal: 'conversions',
budgetAmount: 75,
budgetType: 'daily',
headline: 'Spring Sale - 30% off',
body: 'Limited time. Upgrade today.',
imageUrl: 'https://cdn.example.com/spring.jpg',
callToAction: 'SHOP_NOW',
linkUrl: 'https://example.com/spring',
countries: ['US'],
ageMin: 25,
ageMax: 55,
}});ad = client.ads.create_standalone_ad(
account_id="acc_metaads_123",
ad_account_id="act_1234567890",
name="Spring sale - US Feed",
goal="conversions",
budget_amount=75,
budget_type="daily",
headline="Spring Sale - 30% off",
body="Limited time. Upgrade today.",
image_url="https://cdn.example.com/spring.jpg",
call_to_action="SHOP_NOW",
link_url="https://example.com/spring",
countries=["US"],
age_min=25,
age_max=55,
)curl -X POST "https://zernio.com/api/v1/ads/create" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "metaads",
"accountId": "acc_metaads_123",
"adAccountId": "act_1234567890",
"name": "Spring sale - US Feed",
"goal": "conversions",
"budget": { "amount": 75, "type": "daily" },
"schedule": { "startDate": "2026-04-20", "endDate": "2026-05-20" },
"creative": {
"headline": "Spring Sale - 30% off",
"body": "Limited time. Upgrade today.",
"imageUrl": "https://cdn.example.com/spring.jpg",
"callToAction": "SHOP_NOW",
"landingPageUrl": "https://example.com/spring"
},
"targeting": {
"age_min": 25,
"age_max": 55,
"countries": ["US"],
"interests": [{ "id": "6003139266461", "name": "DevOps" }]
}
}'Custom Audiences
Create a Lookalike Audience:
curl -X POST "https://zernio.com/api/v1/ads/audiences" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "metaads",
"adAccountId": "act_1234567890",
"type": "lookalike",
"name": "LAL 1% of US customers",
"lookalikeSource": {
"originAudienceId": "6123456789",
"country": "US",
"ratio": 0.01
}
}'Add users to a customer list (SHA-256 hashed automatically):
curl -X POST "https://zernio.com/api/v1/ads/audiences/AUDIENCE_ID/users" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"users": [
{ "email": "user@example.com" },
{ "phone": "+14155551234" }
]
}'Targeting
Use /v1/ads/interests?platform=metaads&q=devops to search interest IDs:
| Field | Type | Description |
|---|---|---|
age_min | number | Minimum age (13-65) |
age_max | number | Maximum age (13-65) |
countries | string[] | ISO country codes |
interests | object[] | { id, name } from /interests |
genders | number[] | 0=all, 1=male, 2=female |
Conversions API
Send offline conversion events (deal closed, lead qualified, trial converted) back to Meta via the Graph API events endpoint. Zernio uses the Meta Ads account you already connected — no additional OAuth, no pixel-scoped CAPI token to paste. PII is SHA-256 hashed server-side per Meta's spec before anything leaves your server.
Discover available pixels
curl "https://zernio.com/api/v1/accounts/ACCOUNT_ID/conversion-destinations" \
-H "Authorization: Bearer YOUR_API_KEY"Returns every pixel accessible to the connected ad accounts. Use the returned id as destinationId on the send call.
Send a conversion event
const result = await zernio.ads.sendConversions({ body: {
accountId: 'ACCOUNT_ID',
destinationId: '1729525464415281', // pixel ID
events: [{
eventName: 'Lead',
eventTime: Math.floor(Date.now() / 1000),
eventId: 'order_abc_123', // dedup key — must match pixel event if dual-tracking
value: 42.50,
currency: 'USD',
actionSource: 'crm',
user: {
email: 'customer@example.com',
phone: '+14155551234',
firstName: 'Jane',
lastName: 'Doe',
country: 'US',
},
}],
}});result = client.ads.send_conversions(
account_id="ACCOUNT_ID",
destination_id="1729525464415281",
events=[{
"eventName": "Lead",
"eventTime": int(time.time()),
"eventId": "order_abc_123",
"value": 42.50,
"currency": "USD",
"actionSource": "crm",
"user": {
"email": "customer@example.com",
"phone": "+14155551234",
"firstName": "Jane",
"lastName": "Doe",
"country": "US",
},
}],
)curl -X POST "https://zernio.com/api/v1/ads/conversions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "ACCOUNT_ID",
"destinationId": "1729525464415281",
"events": [{
"eventName": "Lead",
"eventTime": 1744732800,
"eventId": "order_abc_123",
"value": 42.50,
"currency": "USD",
"actionSource": "crm",
"user": {
"email": "customer@example.com",
"phone": "+14155551234",
"firstName": "Jane",
"lastName": "Doe",
"country": "US"
}
}]
}'Standard event names
Purchase, Lead, CompleteRegistration, AddToCart, InitiateCheckout, AddPaymentInfo, Subscribe, StartTrial, ViewContent, Search, Contact, SubmitApplication, Schedule. Custom event names are accepted too.
Test mode
Pass testCode: "TEST12345" at the request root to route events to the Test Events tab in Meta Events Manager without affecting production pixel data.
Deduplication
Pass a stable eventId on every event. Meta dedupes against your pixel within a 48-hour window when eventId matches. Missing or inconsistent eventId between pixel and CAPI double-counts conversions — the #1 cause of inflated reports.
Batching
Up to 1,000 events per request (Zernio chunks larger batches automatically). Meta rejects the entire batch if any event is malformed — the response includes failures[] with per-event error detail and a traceId you can look up in Meta support.
Media Requirements
| Type | Format | Max Size | Notes |
|---|---|---|---|
| Feed Image | JPEG, PNG | 30 MB | 1080x1080 or 1200x628 recommended |
| Reels Video | MP4, MOV | 4 GB | 9:16 vertical, max 90 sec |
| Story | JPEG, PNG, MP4 | 30 MB / 4 GB | 9:16 vertical |
| Carousel | JPEG, PNG, MP4 | 30 MB/card | 2-10 cards |