Guide
How to Use Facebook Ad Library Search: Filters, IDs and Tricks
The Facebook Ad Library looks like a simple search box, but most of its power is hidden in a filter panel and in the address bar. This guide goes through every filter, shows how to find the page ID of an advertiser and the ID of a single ad, explains where the web interface stops being useful, and maps each filter to the parameter that does the same thing in an API call.
Published 7 min read
On this page
Getting started: the two search modes
Open facebook.com/ads/library. You do not need to log in. Before you can type anything, the library asks for two choices: the country and the ad category.
- Country: one country, or "All". The country filter keeps the ads that were shown in that country. Choose "All" to see everything, but remember that results are then ranked across the whole world, which can bury local advertisers.
- Ad category: "All ads" or "Issues, electoral or political". The political category only contains ads that the advertiser declared (or Meta classified) as being about social issues, elections or politics; those come with spend and impressions ranges and stay in the library for seven years. In some countries there are extra categories for housing, employment and credit ads.
Then the search box offers two modes, and the difference matters. Typing a word and pressing Enter runs a keyword search: ads whose text contains the word, from any advertiser. Picking a name from the suggestions under the box opens an advertiser view: every ad of that one page. If you want "what Nike is running", pick the page; if you want "who advertises running shoes", search the keyword.
The filters, one by one
Once you have results, the "Filters" button opens the rest. Here is what each one does, and what to watch out for:
| Filter | What it does | Tip |
|---|---|---|
| Language | Ads written in one or more languages | Useful in multilingual countries such as Belgium or Switzerland |
| Advertiser | Narrows a keyword search to some advertisers | Faster than scrolling when one brand dominates the results |
| Platform | Facebook, Instagram, Audience Network, Messenger, Threads | An ad counts if it runs on at least one of the chosen platforms |
| Media type | Images, videos, memes (image with text), no image or video | "Videos" is the quickest way to build a video swipe file |
| Active status | Active ads, inactive ads, or both | Inactive commercial ads are only kept for political ads and ads delivered in the EU |
| Impressions by date | Ads that were shown at some point between two dates | It is not the start date: an ad started a year ago and still running matches a window of last week |
Exact phrases
By default a keyword search matches ads that contain any of your words, so "free shipping" also returns ads that only say "free". Put the phrase in quotes ("free shipping") to keep only the ads that contain the exact phrase. This is the single most useful trick for offer research: search "buy one get one", "30-day money back" or a competitor's slogan in quotes and you see who uses it.
Sorting
Results are ordered by relevance. For some searches the library also offers a sort by total impressions, which brings the most-seen ads to the top. There is no sort by start date or by how long an ad has been running: for that you need the data outside the browser (see how to find winning ads).
Finding page IDs and ad IDs
Two numbers identify everything in the library, and both are in the address bar. They are what you need to automate anything later, and what you should write down when you save an ad.
- The page ID of an advertiser. Open the advertiser view (pick the page from the suggestions, or click the page name on one of its ads). The URL then contains
view_all_page_id=followed by a long number: that is the page ID. For exampleview_all_page_id=15087023444is Nike. - The ID of one ad. On an ad, click "See ad details" (or "See summary details" for an ad with several versions). The panel shows the "Library ID", and the ad's own link is
facebook.com/ads/library/?id=followed by the same number. That link always opens that ad, as long as the library still has it.
If you only know a brand name, the advertiser search API returns the advertisers that ran ads on a keyword, each with its page ID and category, in one call.
Where the web interface stops working
The library is built for looking at ads, not for research at scale. You will hit these limits quickly:
- No export. There is no download, no CSV, no copy of the results. Everything you want to keep has to be copied by hand.
- Infinite scroll. Results load about 30 at a time as you scroll. After a few hundred ads the page becomes slow, and a reload starts again from the top.
- Estimated counts. "~2,400 results" is an estimate that changes between loads; it is fine for a sense of scale, not for a report.
- No history. The library shows the present. If you want to know what changed since last week, you need your own snapshots.
- One ad at a time for the details. The EU reach, the age and gender breakdown and the payer are behind "See ad details", one ad at a time. The EU transparency data guide explains what is in there.
- Expiring media. Images and videos are served from links that stop working after a few days, so even saved links go stale (how to download ad creatives).
For quick looks without the scroll, our free Ad Library search shows the ads of a keyword with their start dates and creatives, no account needed. For anything repeated or larger, the same filters work in an API call.
The same filters in an API call
Every filter of the web interface is a parameter of the ads search API. A call returns up to 30 ads as JSON and costs one credit; you get 65 free calls a month when you create an account.
| In the Ad Library | API parameter | Values |
|---|---|---|
| Country | country | ISO code (US, DE, IT...) or ALL |
| Ad category | ad_type | all or political (issues, electoral or political) |
| Keyword | q | Any text up to 100 characters |
| Exact phrase in quotes | match | exact for the exact phrase, any (default) for any word |
| Advertiser view | page_id | The number from view_all_page_id |
| Language | languages | Comma-separated ISO 639-1 codes, e.g. en,es |
| Platform | platforms | facebook, instagram, messenger, audience_network, threads |
| Media type | media_type | all, image, video, meme, none |
| Active status | status | active (default), inactive, all |
| Impressions by date | active_from, active_to | YYYY-MM-DD: ads shown at some point in the window |
| Sort by impressions | sort | relevance (default) or impressions |
So "Spanish video ads on Instagram in the US containing the exact phrase free shipping, shown in November" becomes:
curl -s "https://api.scrapeadlibrary.com/v1/ads/search?q=free%20shipping&match=exact&country=US&languages=es&platforms=instagram&media_type=video&active_from=2026-11-01&active_to=2026-11-28" \
-H "X-API-Key: $SCRAPEADLIBRARY_API_KEY"The advertiser view and the ad detail have their own endpoints: GET /v1/pages/{page_id}/ads takes the same filters for one page (page ads API), GET /v1/ads/{ad_id} returns what "See ad details" shows, EU breakdown included, and GET /v1/pages/search?q= returns up to 10 advertisers for a keyword. Every parameter is in the API reference.
Five searches worth saving
- Your competitors, every week: the advertiser view of each one, active ads only. Compare with last week to see what is new (tracking competitor ads).
- Your category's offers: the exact phrase of common offers ("free trial", "first month free") in your country.
- Video ads only: your main keyword with the media type set to videos, to see which formats the market uses.
- Political ads in your region: the political category with your country, to see spend ranges by advertiser.
- Your own brand name as a keyword: resellers, affiliates and impostors who mention your brand in their ads.
Frequently asked questions
- Do I need a Facebook account to search the Ad Library?
- No. The Ad Library is public and works logged out, in any browser. The API reads the same public library, so it needs no Facebook account either, only an API key.
- How do I find a Facebook page ID?
- Open the advertiser view of the page in the Ad Library: the number after view_all_page_id= in the address bar is the page ID. The advertiser search API also returns it from a brand name.
- Why can I not see old ads of a brand?
- The library keeps inactive commercial ads only when they were delivered in the EU (for a year) or are political or issue ads (for seven years). Other ads disappear when they stop running.
- How do I search an exact phrase?
- Put it in double quotes in the search box. In the API, pass the phrase as q and add match=exact.
- Can I export Ad Library search results?
- Not from the web interface. The API returns the same results as JSON, up to 30 ads per call with a cursor for the next page, which you can save as CSV or load into a spreadsheet.
Related guides
- How to Scrape the Facebook Ad Library (2026 Guide)Three ways to get Facebook Ad Library data out as JSON: by hand, with your own scraper, or with an API. Working cURL, Python and JavaScript examples.
- How to Spy on Competitor Facebook Ads (Legally, with Data)Find every competitor running Facebook and Instagram ads, list their creatives, hooks, offers and landing pages, and turn the Ad Library into a daily feed.
- Facebook Ad Library EU Reach Data: How to Read the DSA Transparency FieldsEU reach, targeting and the age, gender and country breakdown of ads delivered in the EU: what the DSA data means, its limits and how to get it as JSON.