Alfalfa

The Facebook Ad Library API: what it covers, who gets in, and what to use for the rest

Meta publishes an official Ad Library API, and most people who find it expect a programmatic version of the website: every ad of every advertiser. It is not that. This page lays out what the API returns, what the access process looks like, the errors that fill the forums, and the practical alternative when you need commercial ads or creatives.

Updated September 2026. Meta changes the API's scope from time to time; check the official documentation for the current list of covered categories.

What the API is for

The Ad Library API was built for transparency researchers and journalists. It covers ads about social issues, elections or politics in the countries where Meta enforces that category, and, since the EU's Digital Services Act, ads delivered in the European Union. For those ads it returns the text fields, the page, dates, platforms, and, for political ads, spend and impression ranges with demographic and regional splits.

What it does not do

How access works

StepWhat it involves
Confirm your identityA government ID and a location check on your personal Facebook account. Business accounts do not qualify by themselves.
Create a developer appThe standard Meta for Developers flow; the API needs no app review, but the token is your own and expires.
Query /ads_archiveParameters for countries, ad type, search terms or page IDs, and the fields you want. Paginate with cursors.

It takes a few days when the ID check goes smoothly. When it does not, there is no support channel to speak of.

The alternative: read the public library

Everything the API withholds is on the public Ad Library page: commercial ads, the creatives, the button, the landing link, the running dates, the platforms, and the EU reach breakdown. The Facebook Ads Library Scraper reads those pages and returns one JSON record per ad with the same field names the official Apify scraper uses, so it behaves like the API you were looking for:

Calling it from code

curl -X POST "https://api.apify.com/v2/acts/alfalfa~facebook-ads-library-scraper/runs?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"pageIds":["15087023444"],"country":"US","activeStatus":"active","maxAds":200,"scrapeAdDetails":true}'

Poll the run or register a webhook, then read the dataset as JSON or CSV. For small jobs the synchronous endpoint run-sync-get-dataset-items returns the records in the same call; for thousands of ads use the asynchronous one, the synchronous endpoints time out after a few minutes.

When the official API is still the right choice

Academic research on political advertising, where you need Meta's own spend and impression estimates with their demographic splits and a citation to the official source. For that category the API's data is richer than the page, and it is the version reviewers expect.

Questions people ask

Is reading the library pages allowed?

The library is public by design and shows the same ads signed in or not. Reading public pages as a signed-out visitor is what a US court protected in Meta v. Bright Data. The creatives remain the advertisers' copyright.

Can I get a specific ad by its ID?

Yes. Paste the library URL with ?id=; the record comes back with the same fields.

What does it cost?

$0.50 per 1,000 ads, platform usage and proxies included, no start fee. Discounts on paid Apify plans apply automatically.

Open the Facebook Ads Library Scraper Read: exporting the Ad Library