Asset 20 8 2
Does AI recommend your business? Run the free check →

Join 15,000 business owners, marketers and entrepreneurs. The Sunday newsletter you'll be annoyed only arrives once a week.

Article

Meta Ad Library API: What Data You Can Get, How to Get Access and Its Limits

The Meta Ad Library API lets you run custom searches of Meta's Ad Library through code. It covers ads about social issues, elections or politics delivered anywhere in the world in the past 7 years, and ads of any type delivered to the UK or European Union in the past year. To use it you confirm your identity at Facebook.com/ID, create a Meta for Developers account and add an app.

That scope is the part people miss. The API isn't a back door to every ad running on Facebook and Instagram. For ordinary commercial ads shown only outside the UK and EU, Meta points you to the regular Ad Library search instead.

What the Ad Library API covers

Ad typeWhere it ranHow far back
Ads about social issues, elections or politicsAnywhere in the worldThe past 7 years
Ads of any typeDelivered to the UK or the European UnionThe past year
Other commercial adsOutside the UK and EU onlyNot in the API; use the Ad Library website

Meta's own note on the country parameter says it plainly: ads that didn't reach any location in the EU only come back if they're about social issues, elections or politics.

How to get access, in 3 steps

  1. Confirm your identity and location. Go to Facebook.com/ID and complete the confirmation process used for running ads about social issues, elections or politics. Meta says this can take a few days.
  2. Create a Meta for Developers account. Select Get started and agree to Meta's Platform Policy.
  3. Add a new app. Return to the Ad Library API page, select Access the API, then create an app from My Apps and Create App.

You'll need a Facebook account to get authorised. Meta also suggests some familiarity with programming, and recommends the Ad Library Report as a simpler option if you don't code. Experienced developers can use Meta's Ad Library API script repository on GitHub, which includes code examples and a simple command-line interface.

What every result includes

Every available ad in the API comes with the same basics:

  • The Library ID.
  • The content of the ad creative, subject to Meta's Terms of Service.
  • The Page name and Page ID behind the ad.
  • Ad delivery dates.
  • Where the ad appeared, such as Facebook or Instagram.

Extra data by ad type

FieldPolitical and issue adsAds delivered to the UK and EU
Amount spentYes, as a range, in the currency the advertiser paid inNo
ImpressionsYes, as a rangeEstimated total impressions in the UK and EU
Demographics of reachAge, gender and location breakdownUK and EU targeting and reach demographics, estimated
Who paidThe paid-for-by bylineAdvertiser and payer information, EU only
Targeting settingsFor ads delivered to BrazilTarget ages, gender and locations

Spend is reported in bands, not exact figures: under 100, 100 to 499, 500 to 999, then wider bands up to over 1M. Impressions also come in bands, starting at under 1,000. If you need exact spend for a competitor's ads, the API won't give it to you.

Search parameters worth knowing

ParameterWhat it does
ad_reached_countriesRequired. Search ALL or by ISO country code
ad_typeALL, or one special category: political and issue, employment, housing, or financial products and services
ad_active_statusACTIVE by default; INACTIVE or ALL to include ads no longer running
search_termsUp to 100 characters; a space works as AND
search_typeKeywords in any order, or an exact phrase
search_page_idsUp to ten Facebook Page IDs at once
publisher_platformsFacebook, Instagram, Audience Network, Messenger, WhatsApp, Threads and more
media_typeImage, meme, video, none or all
languagesAds in specific languages, using ISO language codes

Two details save debugging time. The default status is ACTIVE, so a search for an advertiser's past campaigns returns nothing until you switch it to ALL or INACTIVE. And the financial products and services type now replaces the old credit ads type; Meta says queries using the old name return the new data.

Using the data responsibly

Meta notes you can't download a batch of archived ads, though you can download the creative for an individual ad for analysis, as long as you follow the data storage terms in its Terms of Service. Ad creation time also isn't the same as when the ad ran, so use the delivery start and stop times for timelines. For what you can and can't fairly take from a rival's ads, see what you can legally learn from competitor marketing.

Work with me

Want AI doing the heavy lifting in your marketing?

I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.

My verdict

If you research political advertising or work with UK and EU campaigns, the Ad Library API gives you far more structured data than the website, and the 3-step access process is worth a few days' wait. If you just want to see what a competitor is running in the US, skip the API: the Ad Library website shows you that without code, and paid tools fill other gaps, as covered in my roundup of AdSpy alternatives.

Frequently asked questions

What does the Meta Ad Library API include?

Ads about social issues, elections or politics delivered anywhere in the world in the past 7 years, and ads of any type delivered to the UK or European Union in the past year.

How do I get access to the Ad Library API?

Confirm your identity and location at Facebook.com/ID, create a Meta for Developers account, then return to the Ad Library API page, select Access the API and create an app.

Can the Ad Library API show how much a competitor spends?

Only for ads about social issues, elections or politics, and only as a range such as 100 to 499. Other ads don't include spend.

Does the Ad Library API include US commercial ads?

Only if they're about social issues, elections or politics, or were also delivered to the UK or EU. Meta says ads that didn't reach any location in the EU only come back if they're political or issue ads.

Do I need to code to use the Ad Library API?

Meta says it helps to be a little familiar with programming. For a simpler option it suggests the Ad Library Report, and for current ads it points to the Ad Library itself.

Published and maintained by the Lilach Bullock team, covering marketing, AI and business growth.
Your buyers are asking AI who to use. Does it say you?

See for free whether ChatGPT, Claude, Perplexity, Gemini and Google name you, and get the plan to become the answer.

Check my AI visibility →
Sundays only

Get the Sunday newsletter.

One email a week. AI experiments, marketing tactics, and the workflows Lilach is building right now in her own business.

Subscribe free

Let’s get your marketing running on AI.

Book a free 30-minute call

We figure out what you need, where AI fits in, and what working together would look like.

Book the call →

Or take the 30-second calculator

You’ll see the hours and the money quietly leaking out of your week, and the three workflows worth building first.

Take the calculator →

Or grab the free AI resource library

Prompt packs, templates, checklists, and swipe files. The exact tools I build for paying clients. Yours, free.

Get the library →
Keep reading

More from the blog.