The Facebook Ad Library API is Meta's official programmatic endpoint for the same data the public Ad Library UI returns. It exists at facebook.com/ads/library/api/, requires a Meta developer account with completed business verification, and returns JSON for any ad in the library that matches your query. The API is free, but its commercial-ad coverage is narrower than its political-ad coverage - only the EU and Brazil get full commercial-ad data through the API as of mid-2026. Outside those regions, the API ships political and social-issue ads only, and scraping the UI is the de facto workaround. This guide walks the access flow, the data shape, the rate limits, and the failure modes.
Cost
Free, with business verification gate
Commercial coverage
EU + Brazil only
Rate limit
200 calls/hour/token (default)
Walkthrough
How to use it, step by step
- 1
Create a Meta developer account at developers.facebook.com
The API requires a Meta for Developers account, distinct from a personal Facebook account and from a Meta Business Manager. Go to developers.facebook.com and register. The account is free; verification of identity happens at the app-creation step rather than the account-creation step.
Use a work email tied to a verifiable business domain. Free email domains (Gmail, Yahoo, Hotmail) work for account creation but slow down business verification at the next step. - 2
Create an App and complete Business Verification
Inside developers.facebook.com, create a new App. Select 'Business' as the use case and add the Ad Library API product to your App. Meta will require you to complete business verification - submitting business documents (registration, tax ID, proof of address) for review. This step typically takes 3-7 business days. Without verified business status, the API endpoint returns 401 on every call regardless of token validity.
Business verification is the single longest gate in the access flow. Start it on day one of your API project, not after you've built the integration. The first attempt is rejected about 30-40% of the time for trivial reasons (mismatched document scans, expired registration certificates) - budget two cycles. - 3
Generate an Access Token
Once business verification clears, generate an App Access Token for the Ad Library API in the App dashboard. The token authenticates every API call. Tokens are long-lived by default but can be revoked through the dashboard; store them in your secret manager and rotate quarterly. Never embed tokens in client-side code - they grant API access at your business's quota and rate limits.
- 4
Hit the /ads_archive endpoint with your first query
The core endpoint is GET https://graph.facebook.com/v18.0/ads_archive (version varies by API release; check the docs). Required parameters:
access_token,ad_reached_countries(the country to query),search_termsorsearch_page_ids(what to search for). Example:GET /ads_archive?access_token=YOUR_TOKEN&ad_reached_countries=['US']&search_terms='liquid death'&ad_type=ALL. Returns paginated JSON of matching ads.Thead_typeparameter is the most important field.POLITICAL_AND_ISSUE_ADSis available globally;ALL(which includes commercial ads) is only available for EU member states and Brazil. Outside those regions,ALLsilently returns the same data asPOLITICAL_AND_ISSUE_ADS. - 5
Handle pagination via the cursor field
The API paginates results via Graph API standard cursor pagination. Every response includes a
paging.nextURL with an embedded cursor; follow it untilpaging.nextis absent. Page size is configurable vialimit(default 100, max 5000 but practical max is 1000 before rate-limit pressure). Most queries don't exceed 2-3 pages; high-volume queries (large competitive Pages) can span 10+ pages. - 6
Respect the rate limit - 200 calls/hour/token by default
The Ad Library API has a baseline rate limit of 200 calls per hour per access token. Hitting the limit returns a 4 error in the response. Higher quotas require submitting a use-case justification through the App dashboard; the request is rarely denied for legitimate business research but adds a 1-2 week review cycle. For large competitive sweeps, build retry-with-backoff logic and budget your call volume to stay under the limit.
Spread queries across multiple tokens if you operate at scale - the limit is per-token, not per-app. Most agencies running automated competitive monitoring use 4-8 tokens in rotation. - 7
Parse the response - know which fields are populated for which ad types
The response shape varies by ad type. Political and issue ads populate
spend,impressions,demographic_distribution,region_distribution,funding_entity, andbylines- the regulated disclosure fields. Commercial ads (EU/Brazil only) populatead_creative_bodies,ad_creative_link_titles,ad_delivery_start_time,ad_delivery_stop_time,publisher_platforms,languages, andcurrency. The intersection is small: every ad getsid,page_id,page_name,ad_snapshot_url, andad_delivery_start_time. Beyond that, plan for sparse responses.Always includead_snapshot_urlin your field list - it's the link to the rendered ad in the public Ad Library UI, which is the only way to get the actual creative media. The API does not return raw image or video URLs; the snapshot URL is your jumping-off point for media capture.
Cheatsheet
Filters that matter
| Filter | What it does | When to use |
|---|---|---|
| ad_reached_countries | Restricts ads to those that reached at least one user in the specified countries. | Required parameter. Set to a single country for clean partitioning; multi-country queries are noisier. |
| ad_type | Filters between POLITICAL_AND_ISSUE_ADS (global) and ALL (EU + Brazil only). | Set to ALL for commercial research where available; POLITICAL_AND_ISSUE_ADS elsewhere. |
| search_terms | Free-text search on ad copy, headlines, and page names. | Use for category-level keyword sweeps; expect noisy results. |
| search_page_ids | Restricts to ads from a specific Facebook Page ID (or list of IDs). | Use for advertiser-anchored queries - far cleaner than search_terms. |
| ad_active_status | Filters between ACTIVE, INACTIVE, and ALL. | Set to ACTIVE for current-state benchmarking; INACTIVE for historical analysis. |
| ad_delivery_date_min / ad_delivery_date_max | Filters by the ad's start date range. | Use for time-bounded queries - 'ads started in the last 7 days', 'ads from Q1 2026'. |
| publisher_platforms | Filters by delivery surface (FACEBOOK, INSTAGRAM, MESSENGER, AUDIENCE_NETWORK). | Use when researching placement-specific creative. |
What it won't tell you
The gaps
Commercial-ad data is EU + Brazil only
The single biggest structural gap. Outside the EU and Brazil, the `ALL` ad_type parameter returns the same data as `POLITICAL_AND_ISSUE_ADS` - just political and social-issue ads, no commercial coverage. Most marketers want commercial competitor data and operate outside those regions. The API is genuinely the wrong tool for them; UI scraping or paid third-party tools become the only path.
No creative media URLs in responses
The API returns `ad_snapshot_url` (the public UI link) but no direct URLs for the underlying image or video files. To capture actual creative media you have to render the snapshot page and scrape the embedded media - which Meta doesn't sanction. Paid tools like Foreplay maintain this scrape layer; building it yourself is fragile.
Rate limit is restrictive for serious sweeps
200 calls per hour per token caps competitive monitoring at relatively small scale. Sweeping 50 competitors with 10-page result sets requires 500 calls minimum - more than the hourly limit on a single token. Multi-token rotation is the workaround but adds operational complexity.
Business verification gate slows projects by 1-2 weeks
The verification step blocks any API access for the duration of the review (3-7 business days typical, 2+ weeks with first-attempt rejection). Teams new to the Meta developer ecosystem routinely lose 2 weeks on this step before they realize the API is also commercially gated for their region.
Shuttergen
Skip the API gauntlet - audit competitors in one click.
Shuttergen handles the business verification, rate limits, and EU/Brazil coverage gaps so you get the same structured competitor data without building a Meta developer integration yourself.
Why the API exists and who it's actually for
The Facebook Ad Library API was launched alongside the public Ad Library UI in 2018 as part of Meta's regulatory response to the 2016 election disinformation cycle. The original target audience was journalists, academic researchers, and civil-society organizations auditing political and issue advertising at scale - use cases where manual UI review would have been impossibly slow. Commercial-ad coverage was added later, primarily in jurisdictions where regulators mandated commercial advertising transparency (EU under the Digital Services Act, Brazil under similar laws).
This regulatory origin shapes the API's access model. Business verification, the documentation tone, the rate limits, and the EU/Brazil-only commercial scope all flow from 'this is a transparency tool we built because regulators required us to', not 'this is a developer platform we want third parties to build on'. Meta has no commercial incentive to make the API friction-free for competitive marketing; the API exists to satisfy regulators while disclosing the minimum required data.
Practical consequence: if you're a marketer in the US, UK (post-Brexit), Canada, Australia, or anywhere outside the EU/Brazil, the API will not give you commercial-ad data even after you complete business verification. You'll get political ads. For commercial research you'll need the UI (manual or scraped) or a paid third-party tool that maintains the scrape layer at scale.
The EU/Brazil commercial split and what it means for your project
Meta's commercial-ad API coverage is bound by the regulatory regimes that mandate the disclosure. EU member states are covered because the Digital Services Act (DSA) requires Very Large Online Platforms (Meta qualifies) to maintain a queryable repository of all advertising shown to EU users, including commercial ads. Brazil is covered because Brazilian election and advertising transparency law requires similar disclosure. No other jurisdiction has mandated commercial-ad disclosure at the same level, so Meta has not extended the API's commercial coverage outside these regions.
The practical workflow split: if your competitors run ads in the EU or Brazil, you can query their commercial-ad data programmatically via the API by setting ad_reached_countries to those regions. The data you get back includes the full creative metadata (copy, snapshot URL, platforms, dates) and the same gaps as the UI (no spend, no engagement, no targeting). If your competitors run ads only in non-covered regions, the API will return their political ads (typically none for commercial brands) and nothing else.
Workaround for non-EU/Brazil markets: route your research through EU-targeted queries when the competitor is multinational. A US brand that also runs ads in Germany will have those German-targeted ads exposed via the API; you can use the German data as a proxy for what the brand is doing globally. Imperfect (the creative may be localized) but better than nothing.
Skip the API gauntlet - audit competitors in one click. Shuttergen handles the business verification, rate limits, and EU/Brazil coverage gaps so you get the same structured competitor data without building a Meta developer integration yourself.
Rate limits and how to actually stay under them
The 200-calls-per-hour-per-token rate limit is the operational bottleneck most teams hit first. The limit resets on a rolling hour, not at the top of the hour - so burst queries get throttled even if you 'spread' them across calendar hours.
Three patterns that survive the rate limit. Multi-token rotation: maintain 4-8 access tokens (each tied to a separate App, all owned by the same Business Manager) and rotate calls across them. The 200/hour limit is per-token, not per-app. Aggressive caching: most competitive monitoring queries don't need real-time data. Cache responses for 12-24 hours and serve from cache rather than re-hitting the API on every internal request. Incremental queries: instead of refetching a full competitor's ad set every run, query only ad_delivery_date_min={yesterday} to get new launches, and re-fetch the full set weekly. Cuts call volume by 90%+ for steady-state monitoring.
If you have a documented use case (research project, agency client deliverable, internal product), you can request a quota increase through the App dashboard. Meta rarely denies legitimate requests but adds a 1-2 week review cycle. For most agencies and research projects, the rate limit is a real constraint worth planning around rather than ignoring.
When to use the API vs scrape the UI vs pay for a third-party tool
Three viable paths for programmatic library access in 2026, each with a different fit. The official API is the right path when you're operating in EU/Brazil markets (where commercial coverage exists), you need clean structured data, you can absorb the business-verification timeline, and you can engineer around the rate limits. Strong fit for academic research, regulatory-compliance audits, and EU-focused competitive monitoring.
UI scraping is the de facto path when you're operating outside EU/Brazil markets and need commercial-ad data. It's against Meta's terms of service - which has not stopped a multi-hundred-million-dollar third-party tool industry from doing it at scale - but exposes you to IP blocks, DOM-change breakage, and CAPTCHA challenges. Building and maintaining a scraper internally typically requires a dedicated engineering resource. For most teams it's not worth the maintenance overhead vs paying for a third-party tool that has already solved the scraping problem.
Third-party tools (Foreplay, Atria, Motion, AdSpy, Minea) maintain the scrape infrastructure, layer hook-tagging and AI classification on top, and resell access at $50-500/mo per seat. For competitive marketing teams this is almost always the right choice over building yourself - you get the data plus the tagging layer plus the maintenance team, without the engineering burden. Pair with the official API for EU/Brazil markets if you need structured exports for academic or compliance use cases.
Internal: Foreplay deep dive, Atria deep dive, Motion deep dive cover the leading paid tools and how they layer on top of the API.
FAQ
Frequently asked
Is the Facebook Ad Library API free?
Does the Facebook Ad Library API return commercial ads outside the EU and Brazil?
ad_type=ALL silently returns the same data as POLITICAL_AND_ISSUE_ADS. For commercial research in non-covered regions, UI scraping or paid third-party tools are the only paths.How long does business verification take for the Facebook Ad Library API?
What's the rate limit on the Facebook Ad Library API?
Does the Facebook Ad Library API return the actual ad images and videos?
ad_snapshot_url - a link to the rendered ad in the public Ad Library UI. To capture the actual media you have to render the snapshot page and extract the embedded files, which Meta doesn't sanction. Paid third-party tools like Foreplay maintain this layer; building it yourself is fragile.Can I use the Facebook Ad Library API to monitor my competitors?
search_page_ids and get a structured feed of their commercial ads. Outside covered regions you'll get only political ads (typically none for commercial brands). For non-covered regions, paid third-party tools that scrape the UI are the de facto solution.Is the Facebook Ad Library API the same as the Meta Ad Library API?
Related
Keep reading
Resource
Ad library api
Platform-agnostic deep dive on ad library APIs.
Resource
Meta ad library
The UI-side reference for the same data.
Resource
Facebook ads library
Full walkthrough of the UI product.
Research
Foreplay Deep Dive
How paid tools layer on top of the API and scrape the UI.
Research
Anatomy Of Good Meta Ad Library
Audit methodology that uses the API as one input source.
Sources
Skip the API gauntlet - audit competitors in one click.
Shuttergen handles the business verification, rate limits, and EU/Brazil coverage gaps so you get the same structured competitor data without building a Meta developer integration yourself.