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

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:

FilterWhat it doesTip
LanguageAds written in one or more languagesUseful in multilingual countries such as Belgium or Switzerland
AdvertiserNarrows a keyword search to some advertisersFaster than scrolling when one brand dominates the results
PlatformFacebook, Instagram, Audience Network, Messenger, ThreadsAn ad counts if it runs on at least one of the chosen platforms
Media typeImages, videos, memes (image with text), no image or video"Videos" is the quickest way to build a video swipe file
Active statusActive ads, inactive ads, or bothInactive commercial ads are only kept for political ads and ads delivered in the EU
Impressions by dateAds that were shown at some point between two datesIt 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.

  1. 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 example view_all_page_id=15087023444 is Nike.
  2. 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 LibraryAPI parameterValues
CountrycountryISO code (US, DE, IT...) or ALL
Ad categoryad_typeall or political (issues, electoral or political)
KeywordqAny text up to 100 characters
Exact phrase in quotesmatchexact for the exact phrase, any (default) for any word
Advertiser viewpage_idThe number from view_all_page_id
LanguagelanguagesComma-separated ISO 639-1 codes, e.g. en,es
Platformplatformsfacebook, instagram, messenger, audience_network, threads
Media typemedia_typeall, image, video, meme, none
Active statusstatusactive (default), inactive, all
Impressions by dateactive_from, active_toYYYY-MM-DD: ads shown at some point in the window
Sort by impressionssortrelevance (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

  1. 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).
  2. Your category's offers: the exact phrase of common offers ("free trial", "first month free") in your country.
  3. Video ads only: your main keyword with the media type set to videos, to see which formats the market uses.
  4. Political ads in your region: the political category with your country, to see spend ranges by advertiser.
  5. 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

← All guides

Try it on your own competitors

Create a free account and get 65 free calls every month, no credit card. One API key works on every endpoint.