API Reference
Meta Ads API
Meta's Marketing API requires creating a Meta App, submitting permissions for App Review, and ongoing compliance. Direct integration risks account bans from the 'external AI agent' detection pattern. Zernio is an approved Meta Marketing Partner - we wrap Facebook and Instagram ads behind one REST API.
Quick Start
- 1.Get API KeySign up for free and get your API key in seconds.
- 2.Connect AccountUse our OAuth flow to connect Meta Ads accounts.
- 3.Start PostingMake API calls to post content to Meta Ads.
const response = await fetch('https://zernio.com/api/v1/ads/create', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
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' },
placements: ['facebook_feeds', 'instagram_feeds', 'instagram_reels'],
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' },
{ id: '6003020834693', name: 'Software engineering' }
]
}
})
});Meta Ads Endpoints
Create a Facebook or Instagram campaign with ad set and creative
Promote an existing Facebook or Instagram post as an ad
Create a Custom Audience (customer list, website, lookalike)
Add users to a Custom Audience (SHA-256 hashed automatically)
Get ad details, spend, and current status
Update status, budget, schedule, or targeting
Spend, impressions, clicks, CTR, CPC, CPM, ROAS with breakdowns
List campaigns across connected Meta ad accounts
Media Requirements
| Type | Format | Max Size | Notes |
|---|---|---|---|
| Feed Image | JPEG, PNG | 30 MB | Recommended 1080x1080 (1:1) or 1200x628 (1.91:1) |
| Reels Video | MP4, MOV | 4 GB | Vertical 9:16, max 90 sec |
| Story Image/Video | JPEG, PNG, MP4 | 30 MB image / 4 GB video | 9:16 vertical |
| Carousel | JPEG, PNG, MP4 | 30 MB / card | 2-10 cards |
| Headline | Text | 40 chars | Primary headline |
Zernio automatically transcodes and optimizes media for Meta Ads's requirements.
API Limits
Meta Marketing API uses a per-app and per-ad-account rate limit budget. Zernio pools across customers and handles 17/32/80 throttle errors with automatic backoff.
Zernio handles all rate limiting automatically. We queue and retry requests as needed.
Features
- ✓Facebook Feed, Stories, Reels, Marketplace placements
- ✓Instagram Feed, Stories, Reels, Explore placements
- ✓Campaign → Ad Set → Ad hierarchy
- ✓Boost existing organic posts (FB + IG)
- ✓Custom Audiences (customer list, website, lookalike)
- ✓Detailed targeting (interests, behaviors, demographics)
- ✓Real-time spend, CPM, CPC, ROAS with breakdowns
Response Example
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", "GB"]
}
}'Start building with Meta Ads API
Free tier available · No credit card required · 99.97% uptime

