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. 1.
    Get API Key
    Sign up for free and get your API key in seconds.
  2. 2.
    Connect Account
    Use our OAuth flow to connect Meta Ads accounts.
  3. 3.
    Start Posting
    Make API calls to post content to Meta Ads.
Create a Facebook Campaign
JavaScript
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

POST/v1/ads/create

Create a Facebook or Instagram campaign with ad set and creative

POST/v1/ads/boost

Promote an existing Facebook or Instagram post as an ad

POST/v1/ads/audiences

Create a Custom Audience (customer list, website, lookalike)

POST/v1/ads/audiences/{id}/users

Add users to a Custom Audience (SHA-256 hashed automatically)

GET/v1/ads/{id}

Get ad details, spend, and current status

PUT/v1/ads/{id}

Update status, budget, schedule, or targeting

GET/v1/ads/{id}/analytics

Spend, impressions, clicks, CTR, CPC, CPM, ROAS with breakdowns

GET/v1/ads/campaigns

List campaigns across connected Meta ad accounts

Media Requirements

TypeFormatMax SizeNotes
Feed ImageJPEG, PNG30 MBRecommended 1080x1080 (1:1) or 1200x628 (1.91:1)
Reels VideoMP4, MOV4 GBVertical 9:16, max 90 sec
Story Image/VideoJPEG, PNG, MP430 MB image / 4 GB video9:16 vertical
CarouselJPEG, PNG, MP430 MB / card2-10 cards
HeadlineText40 charsPrimary 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

Boost an Existing Post
cURL
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

SOC 2 CompliantGDPR Compliant