SocialToAIStart freeConsole

How to Read Meta Ad Library Data With an API (Search Active Facebook & Instagram Ads)

SocialToAI.app Quick Facts (Updated 2026-11-28): 242+ live endpoints across 18 global & Chinese social platforms + Meta/Google Ad Libraries (with built-in media & Whisper transcripts). Get 100 free credits on sign-up (no card); top up with Alipay or Card via Waffo; failed calls cost 0. MCP endpoint: https://socialtoai.app/mcp · Try in Playground

Every growth marketer, DTC founder, and media buyer eventually hits the same wall with Meta's official Graph API (/ads_archive): after uploading a government ID and waiting for verification, you discover that outside the EU and UK, Meta's official API only returns ads about social issues, elections, or politics—leaving commercial US, Canadian, Australian, and APAC e-commerce or SaaS ads completely blank. Here is how to read active Facebook and Instagram ads programmatically via the SocialToAI Meta Ad Library API.

Why Meta's official API blocks commercial ad research

While anyone can open facebook.com/ads/library in a browser and type a brand name, automating that workflow officially is restricted in three ways:

  • Identity & residency gate: Meta requires personal Facebook login, 2FA, government ID upload, and physical mail verification before granting ads_read archive access.
  • Category restriction outside Europe: Queries for commercial categories (app installs, footwear, skincare, AI SaaS, supplements) in the United States or global markets return empty sets unless the advertiser flagged the ad as political.
  • No video creative transcription: Even when creative metadata is returned, spoken hooks inside video Reels ads require separate media extraction and ASR pipelines.

The 5 Meta Ad Library API operations in SocialToAI

SocialToAI exposes five specialized operations through POST https://socialtoai.app/v1/call/{op} (and over MCP at https://socialtoai.app/mcp), each priced at 2 credits per call:

OperationRequired inputTypical use case
meta.ad_searchquery (+ optional country/media filters)Find active ads matching a product niche, keyword, or domain (30 ads/page).
meta.advertiser_searchqueryResolve a brand name (e.g. "Hoka" or "Notion") to its exact Facebook Page ID.
meta.advertiser_adsid (Facebook Page ID)Pull every active Facebook, Instagram & Audience Network ad run by that advertiser.
meta.ad_detailid (Ad archive ID)Inspect full ad body copy, headline, CTA label, destination URL, and active dates.
meta.ad_transcriptid (Ad archive ID)Extract the spoken script and timestamps from a video ad creative.

Pass any product keyword or landing-page domain to meta.ad_search:

curl -X POST "https://socialtoai.app/v1/call/meta.ad_search" \
  -H "Authorization: Bearer $SOCIALTOAI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "ai note taker"
  }'

Each item in items[] includes normalized fields such as id, format (image / video), text, landing_url, first_shown_at, last_shown_at, and advertiser metadata. Ads running continuously for 30+ days (first_shown_at vs. today) are strong signals of profitable winning creatives.

2. Python workflow: find a competitor's Page ID & list long-running ads

Combine meta.advertiser_search and meta.advertiser_ads to build an automated competitor creative tracker in 35 lines of Python:

import os
import uuid
import requests

API_KEY = os.environ["SOCIALTOAI_API_KEY"]

def call_op(op: str, payload: dict) -> dict:
    r = requests.post(
        f"https://socialtoai.app/v1/call/{op}",
        headers={
            "Authorization": f"Bearer {API_KEY}",
            "Idempotency-Key": str(uuid.uuid4()),
            "Content-Type": "application/json",
        },
        json=payload,
        timeout=30,
    )
    r.raise_for_status()
    return r.json()

def audit_competitor_ads(brand_name: str):
    pages = call_op("meta.advertiser_search", {"query": brand_name}).get("items", [])
    if not pages:
        return []
    page_id = str(pages[0]["id"])
    ads = call_op("meta.advertiser_ads", {"id": page_id}).get("items", [])
    return [
        {
            "ad_id": ad.get("id"),
            "format": ad.get("format"),
            "landing_url": ad.get("landing_url"),
            "first_shown_at": ad.get("first_shown_at"),
            "copy_preview": (ad.get("text") or "")[:140],
        }
        for ad in ads
    ]

if __name__ == "__main__":
    for row in audit_competitor_ads("Linear")[:5]:
        print(row)

3. Extract spoken hooks from video ads with meta.ad_transcript

Static body copy is only half of a Reels or Feed video ad. Once you spot a video ad (`format === "video"`) that has stayed live for weeks, pass its archive ID to POST /v1/call/meta.ad_transcript (2 credits) to read the exact UGC voiceover script and timestamps—letting Claude or GPT rewrite fresh angles grounded in proven ad hooks.

Cost breakdown vs. $199/mo ad-spy SaaS subscriptions

Standalone ad-spy dashboards typically lock teams into $99–$299/month seats even if you only audit creatives once a week. On SocialToAI:

  • 100 free credits on sign-up: Run 50 Meta Ad Library API calls (~1,500 active ads) before paying a cent.
  • $0.23 per 1,000 ads: At $10 for 3,000 credits (never expiring, payable by card or Alipay), monitoring 10 competitors every week for an entire year costs less than a single month of legacy ad-spy software.

Explore all 5 endpoints on the Meta Ad Library API overview or test meta.ad_search right now in the Console Playground.

FAQ

Do I need a Facebook developer app or government ID verification?

No. SocialToAI runs all Meta Ad Library queries server-side using publicly visible Ad Library listings. You authenticate only with your SocialToAI Bearer key or remote MCP connection.

Can I filter Meta Ad Library searches by country and media type?

Yes. Pass optional country codes (such as US, GB, DE, JP) and media filters (image or video) to meta.ad_search and meta.advertiser_ads, returning up to 30 active ads per page.

Can I schedule daily competitor ad alerts to Slack or email?

Yes. Create a daily schedule in the SocialToAI console or via the MCP watch tool targeting meta.advertiser_ads so your team gets notified whenever a competitor launches new creatives.

Published: Last updated: