Los Angeles

How to Scrape the Facebook Ad Library (Meta Ad Library API)

How to Scrape the Facebook Ad Library (Meta Ad Library API)

Scraping the Facebook Ad Library takes one endpoint and one key: send engine=meta_ad_library with a keyword or page ID, then page with next_page_token under the 50,001 cap. Watch 30 ads per page, one credit each. Cost is separate: facebook ads price is your account's question.

Who it is for and what to have ready

For a US marketer who needs competitor ad data as a file. Before step one: a SerpApi key, Python 3 or Node.js, a USD budget for credits since each page is a separate search, and tracking if the rows must tie to leads.

Five steps from first request to a clean file

  1. Open the playground with engine=meta_ad_library and q as your keyword. Result: an ads array with page_name and start_date for the first 30 ads.
  2. Repeat the call in cURL, Python or JavaScript. Result: advertiser, start date and ad link per row.
  3. Loop next_page_token for three pages. Result: three pages of ads plus total_results.
  4. Add page_id (Nike's is 15087023444), country=US, active_status=all. Result: live and stopped ads, each with a status line.
  5. Export to CSV. Result: one line per ad, clean in a spreadsheet.
A marketer at a desk compares a grid of social media ad cards with an open spreadsheet of rows.

The metrics to watch after each step

Read total_results, not the row count: 50,001 means more than 50,000 ads, so the cap truncates a large category. Only the first page carries that total and the advertiser block. Credits follow pages.

Where the Meta ads price list stops

No facebook ads price list comes out of this archive. Spend and impressions appear only on issue, election and political ads; a commercial ad carries no cost figure. It shows what ran, not what it cost.

Common mistakes in US campaigns

Two defaults spoil a US pull. Country is ALL, so global ads dilute the comparison; set US. active_status is active, so stopped campaigns vanish; use all for timing. Media links expire in days, so late downloads carry dead creative.

What Topkee does with competitor ad data

Topkee's performance Meta ads service puts competitor analysis inside its creative refresh: the team reads rival hooks to build differentiated messaging. The Ad Library is the usual public source for that, though Topkee publishes nothing about scraping it. Rows stay creative intelligence, while Topkee's reporting measures signed-deal value against ad spend per period. That split puts creative and cost work in one place: facebook ads services.

When to hand it to an agency

Keep the script in-house while ad research is a weekly habit. Hand it over when rows must become bids in a live account. A team selling facebook ads services scopes creative and cost together.

Next step

Run the loop on one competitor and one keyword first. Then read what facebook ads price you pay, and join the rows to leads with offline conversion tracking. The lead generation service covers the form layer the library never sees.

Sources

  1. Noraina Nordin, "How to Scrape the Facebook Ad Library (Meta Ad Library API)", SerpApi Blog, 2026-11-26. https://serpapi.com/blog/scrape-meta-ad-library/
  2. "Meta Ad Library API", SerpApi documentation, n.d. https://serpapi.com/meta-ad-library-api
Share to:
Date: 2026-11-28
Marcus Chen

Article Author

Marcus Chen

Social Media & Community Manager