Meta Ad Library API - Facebook & Instagram Ads Scraper avatar

Meta Ad Library API - Facebook & Instagram Ads Scraper

Pricing

from $0.50 / 1,000 results

Go to Apify Store
Meta Ad Library API - Facebook & Instagram Ads Scraper

Meta Ad Library API - Facebook & Instagram Ads Scraper

Scrape public Facebook and Instagram ads from Meta Ad Library: search by keyword or Ad Library URL, browse every ad from a known advertiser Page, or find a Page's ID by brand name. Filter by country, status, category, format, platform, and date, and optionally enrich each ad with full details.

Pricing

from $0.50 / 1,000 results

Rating

5.0

(1)

Developer

The Netaji

The Netaji

Maintained by Community

Actor stats

0

Bookmarked

3

Total users

3

Monthly active users

2 days ago

Last modified

Share

Facebook Ads Library Scraper

The Actor reads public advertising data from the Meta Ad Library and returns it as structured records. It covers three related tasks: searching all advertisers by keyword, collecting every ad belonging to one advertiser Page, and resolving a brand name to the Page ID the other two modes require.

It serves as a Meta Ad Library API for cases the official Ad Library API does not cover. That interface returns ordinary commercial ads only when the audience is in an EU member state or the UK, where the Digital Services Act compels disclosure; a commercial ad targeting the United States alone returns nothing through it, despite being visible on the Ad Library website. It also requires a Meta developer account with identity verification. This Actor reads the same public data the website exposes, across all countries, and requires no Meta credentials.

Selecting a function

The scraperType field determines what a run does. It defaults to search.

ValueLabelPurposeRequired input
searchSearch AdsFind ads across all advertisers matching a queryq, or a Start URL
pageBrowse page adsCollect every ad from one advertiser Pagepage_id
searchPagesFind advertiser pageResolve a brand name to its Page IDq

The three modes form a sequence. A brand name resolved through searchPages yields a pageId, which becomes the page_id for a page run.

Accepted input

FieldTypeDefaultDescription
scraperTypeenumsearchWhich of the three functions the run performs.
startUrlstringA Meta Ad Library URL. Its query parameters populate any field left empty.
qstringSearch query in search mode; brand or company name in searchPages mode. Unused in page mode.
page_idstringNumeric Page ID of the advertiser. Required in page mode.
countrystringUSISO 3166-1 alpha-2 country code.
maxItemsinteger50Maximum records saved. 0 removes the limit.
enrichAdDetailsbooleanfalseFetches the full detail record for every ad returned.
active_statusenumallall, active, inactive.
ad_typeenumALLALL, POLITICAL_AND_ISSUE_ADS, HOUSING_ADS, EMPLOYMENT_ADS, CREDIT_ADS.
media_typeenumallall, image, video, meme.
search_typeenumkeyword_unordered or keyword_exact_phrase.
publisher_platformsarrayRestricts results to selected Meta platforms.
content_languagesstringComma-separated ISO 639-1 codes.
date_min / date_maxstringBounds on the ad's active period, YYYY-MM-DD.
page_idsstringComma-separated Page IDs restricting a search to specific advertisers.
is_targeted_countrybooleanfalseReturns only ads specifically targeting country.
potential_reach_min / _maxintegerBounds on estimated audience size.
sort_modeenumtotal_impressions. Leave empty for default ordering.
sort_directionenumdesc.
{
"scraperType": "search",
"q": "running shoes",
"country": "US",
"maxItems": 50,
"active_status": "active",
"media_type": "video"
}

Filters accepted by each mode

Filters are not shared across all three modes. A filter set in a mode that does not accept it is ignored rather than rejected, so a run that appears to disregard a setting is usually a mode mismatch.

FiltersearchpagesearchPages
countryyesyesyes
active_status, media_type, publisher_platforms, content_languages, date_min, date_max, sort_mode, sort_directionyesyesno
ad_typeyesnoyes
search_type, page_ids, is_targeted_country, potential_reach_min, potential_reach_maxyesnono

Response fields

Ad records, returned by search and page:

FieldContents
ad_archive_idIdentifier of the ad within the Ad Library
page_idNumeric ID of the advertiser's Page
page_nameName of the advertiser's Page
is_activeWhether the ad is currently running
start_dateUnix timestamp at which the ad began running
end_dateUnix timestamp at which it stopped; 0 while still active
publisher_platformMeta platforms the ad ran on
currencyCurrency of the spend and reach figures
spendEstimated spend range, where Meta publishes one
reach_estimateEstimated audience reach, where Meta publishes one
categoriesAd categories reported by Meta
snapshotCreative payload: body text, title, call to action, images, videos, link
detailsFull detail record; present only when enrichAdDetails is enabled

Advertiser Page records, returned by searchPages:

FieldContents
pageIdPage ID, used as page_id in page mode
namePage name
categoryFacebook category of the Page
likesNumber of likes on the Page
verificationVerification status
instagramUsernameLinked Instagram username, where one exists
{
"ad_archive_id": "1234567890123456",
"page_id": "20531316728",
"page_name": "Example Brand",
"is_active": true,
"start_date": 1751328000,
"end_date": 0,
"publisher_platform": ["FACEBOOK", "INSTAGRAM"],
"currency": "USD"
}

Behaviour of the Start URL

A Meta Ad Library URL supplied as startUrl is parsed into input fields, and its values fill only those fields left empty. A field set explicitly always takes precedence over the same parameter in the URL. The URL itself is not forwarded upstream.

Two normalisations are applied because the Ad Library interface exposes options the upstream endpoint does not. Sort metrics other than total_impressions are dropped, and ascending sort is converted to descending. The URL therefore continues to drive the run rather than failing validation.

A URL of the "browse this Page's ads" form — one carrying view_all_page_id, or search_type=page — contains no keyword. Such a URL reroutes the run to page mode automatically and supplies page_id from the URL, irrespective of the selected scraperType.

Behaviour on partial results

Ads are retrieved through a cursor in pages of 20. Collection ends when the upstream returns no cursor, reports no further pages, or returns an empty page.

A request that fails mid-run does not abort the run or discard what preceded it. The failure is logged, records already collected are retained, and the run finishes normally. A dataset smaller than maxItems therefore indicates either that the result set was exhausted or that a page failed, and the run log distinguishes the two.

Enrichment is applied per ad and requires both ad_archive_id and page_id to be present on the record. An enrichment request that fails leaves that record without a details field, does not interrupt the run, and is not charged. Each successful enrichment issues one additional request and one additional billed event, so a 500-ad run with enrichment enabled performs 500 extra requests.

Frequently asked questions

Is the Meta Ad Library API free? Meta's official Ad Library API costs nothing, but access requires a Meta account, government-ID identity verification, and an approved developer app, and its coverage is narrower than the Ad Library website. Ads about social issues, elections, and politics are fully covered. Ordinary commercial ads are returned only where the audience is in the EU or UK, carry a single eu_total_reach figure with no spend or impression data, and are absent entirely for audiences outside Europe. This Actor is paid, needs no Meta account or access token, and is not subject to those restrictions.

What is the Meta Ad Library? A public archive Meta maintains of advertising running across Facebook, Instagram, and its other platforms. Ads about social issues, elections, and politics are retained for seven years and carry spend and reach disclosure. Ordinary commercial ads are visible while running and for roughly a year after delivery ends, after which the record is gone — so historical commercial analysis depends on capturing snapshots as ads run rather than querying the archive later.

Where is the Meta Ad Library found? At facebook.com/ads/library. A search performed there produces a URL that can be pasted into startUrl, which reproduces the same filters without setting them by hand.

Why does a filter appear to have no effect? Most commonly because the selected mode does not accept it; see the filter table above. ad_type, for instance, applies in search and searchPages but not in page. Unaccepted filters are ignored silently rather than raising an error.

Why are spend and reach_estimate empty on most records? Meta publishes those figures only for ads in regulated categories. For ordinary commercial ads they are absent upstream and are returned empty rather than estimated.

What causes a run to return fewer records than maxItems? Either the result set was exhausted, or a page request failed and the run ended early while retaining what it had collected. The run log records which occurred. Narrow filters — a short date range combined with is_targeted_country, for example — commonly exhaust a result set well below the limit.

How is a Page ID obtained? Through searchPages, which takes a brand name in q and returns matching advertiser Pages with their pageId. That value is then supplied as page_id to a page run. A Meta Ad Library URL already containing view_all_page_id supplies it automatically.