Home / How To / Ecommerce and competitors

How to

A Meta Ad Library API alternative for any country

Meta's official Ad Library API is limited in what it returns and needs identity verification. If you just need ad data in your code, there is a shorter path.

Short answer

Call the Ads Transparency Scraper with Apify's run-sync-get-dataset-items endpoint. You POST the input with "source": "meta", the request waits for the run, and the response is the ads as JSON. It reads the public Ad Library, so you need no Meta developer app and no identity check. Meta's own API returns commercial ads only for the EU and UK; this one works for any country.

A real use case

A competitor-monitoring tool wants a daily list of new Meta ads from its customers' rivals. The backend calls this endpoint with lastDays set to 1, stores the new ads and alerts the customer. No Meta app review is involved.

Step by step

  1. Get an Apify API token from your account (the free plan works).
  2. POST the input JSON to the run-sync endpoint shown above, with the token as a query parameter or bearer header.
  3. Read the response: a JSON array with one object per ad.
  4. For big pulls, run it asynchronously and fetch the dataset when the run finishes.

Input (paste into the JSON tab)

{
  "source": "meta",
  "targets": [
    "315953034940028"
  ],
  "metaActiveStatus": "active",
  "region": "US",
  "maxAdsPerTarget": 100
}

Call it from code

import requests

TOKEN = "your-apify-token"
url = ("https://api.apify.com/v2/acts/scrape-lads~google-ads-transparency-scraper"
       "/run-sync-get-dataset-items")
body = {
    "source": "meta",
    "targets": ["315953034940028"],
    "metaActiveStatus": "active",
    "maxAdsPerTarget": 100,
}

ads = requests.post(url, params={"token": TOKEN}, json=body, timeout=300).json()
for ad in ads:
    print(ad["advertiserName"], ad["daysShown"], ad["landingUrl"])

What you get back

{
  "type": "ad",
  "source": "meta",
  "advertiserName": "Example Shoes",
  "format": "image",
  "isActive": true,
  "firstShown": "2026-04-17T07:00:00.000Z",
  "lastShown": "2026-10-18T07:00:00.000Z",
  "daysShown": 184,
  "platforms": [
    "facebook",
    "instagram"
  ],
  "callToAction": "Learn more",
  "landingUrl": "https://example.com/offer",
  "adUrl": "https://www.facebook.com/ads/library/?id=1335285412043498"
}

Trimmed example. Names and numbers are illustrative; your run returns real data with more fields.

Tips

  • Run-sync waits up to 5 minutes. For large pulls start a normal run and read the dataset afterwards.
  • Use lastDays in a scheduled run to get only new ads. Each run is a separate dataset.
  • For political and issue ads set metaAdType to political. Those rows add spend, impressions and reachEstimate ranges.
  • The same endpoint serves Google ads: set source back to google. The export guide covers the no-code route.

What it costs

$1.40 per 1,000 Meta ads, billed to your Apify account. A call that returns 500 ads costs about $0.70.

Plus a small per-run start fee. Apify's free plan includes monthly credit, enough to test. Check the listing for current pricing.

FAQ

Is there an official Meta Ad Library API?

Yes, but it returns commercial ads only for the EU and UK and requires identity verification. This actor reads the public library instead and works for any country.

Is there a Facebook Ad Library API for all countries?

Not an official one for commercial ads. This actor gives you Facebook and Instagram ads for any country through the Apify API.

Do I need a Meta developer account?

No. You only need an Apify API token.

Can I get ad spend through the API?

Only for political and issue ads, where Meta publishes spend as a range. Commercial ads have no public spend.

Related

Try it on your own data

Paste the input above, run it, and see your results in a couple of minutes.

Open Ads Transparency Scraper