# Facebook Ads Library Scraper: Meta Ads, No Login (`earlytern/facebook-ads-library-scraper`) Actor

Scrape the Facebook Ad Library (Meta Ads Library) by keyword, page or Ad Library link: ad text, headline, link, images, videos, platforms, start date and page details. Political ads add spend and impressions. No login or cookies.

- **URL**: https://apify.com/earlytern/facebook-ads-library-scraper.md
- **Developed by:** [earlytern](https://apify.com/earlytern) (community)
- **Categories:** Social media, Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.45 / 1,000 ads

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Facebook Ads Library Scraper

Facebook Ads Library Scraper collects ads from the public Facebook Ad Library (Meta Ad Library): ad text, headline,
link, button, images, videos, carousel cards, platforms (Facebook, Instagram, Messenger, Audience Network, Threads,
WhatsApp), start and end dates and the page that runs each ad, with its likes and categories. Political and issue
ads also come with the amount spent, impressions, reach and who paid for them. It reads the Ad Library the way any
visitor sees it, so you need no Facebook account, no cookies and no API token.

### What does Facebook Ads Library Scraper do?

- Searches the Ad Library by **search terms**, such as a brand, a product or words from ad copy, with the same filters
  as the Ad Library page: country, active or inactive ads, media type (images, videos, memes) and exact phrase.
- Gets every ad of an advertiser from a **Facebook page address** (`https://www.facebook.com/nike`), a **page ID**, or
  an **Ad Library link** you set up in the browser and copy (the link keeps its own filters, including the housing,
  employment and financial products ad categories).
- Returns one row per ad, in the order the Ad Library shows them, up to 5,000 ads per search.
- Fills the main text, headline and link of carousel and dynamic ads from their first card, and keeps every card.
- Saves each ad once per run, even when several searches find it.

### Why use Facebook Ads Library Scraper?

- **Competitive research:** see every ad a competitor runs now, since when, on which platforms and with what offer.
- **Creative ideas:** collect winning hooks, headlines and videos in your niche. Ads that run for months and in many
  versions are usually the ones that work.
- **E-commerce and dropshipping:** spot products that stores are pushing right now.
- **Lead generation:** find businesses that spend on ads, with their page, website and page likes.
- **Political ad tracking:** spend, impressions and the payer of election and issue ads.

### How to use Facebook Ads Library Scraper

1. Type one or more search terms, one per line, for example `running shoes`, or add Facebook pages or Ad Library
   links.
2. Pick a country (or all countries), the ad status and a media type if you want.
3. Set **Maximum ads per search**.
4. Click **Start** and download the results as JSON, CSV, Excel or HTML, or get them through the API.

### Input

```json
{
  "searchTerms": ["running shoes"],
  "country": "US",
  "activeStatus": "active",
  "mediaType": "all",
  "maxAdsPerSearch": 100
}
```

All ads of some advertisers, active and inactive, in every country (the Ad Library link keeps its own filters:
active video ads in the United Kingdom):

```json
{
  "pages": [
    "https://www.facebook.com/nike",
    "106485550030",
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=GB&media_type=video&q=coffee&search_type=keyword_unordered"
  ],
  "activeStatus": "all",
  "maxAdsPerSearch": 500
}
```

### Output

One row per ad. Example (long links shortened):

```json
{
  "type": "ad",
  "input": "running shoes",
  "searchUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&is_targeted_country=false&media_type=all&q=running+shoes&search_type=keyword_unordered",
  "position": 1,
  "adArchiveId": "1234567890123456",
  "adLibraryUrl": "https://www.facebook.com/ads/library/?id=1234567890123456",
  "pageId": "106485550030",
  "pageName": "Example Footwear",
  "pageUrl": "https://www.facebook.com/examplefootwear/",
  "pageProfilePictureUrl": "https://scontent.xx.fbcdn.net/...",
  "pageLikeCount": 182400,
  "pageCategories": ["Shoe store"],
  "isActive": true,
  "startDate": "2026-07-06",
  "endDate": "2026-11-20",
  "publisherPlatforms": ["FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK"],
  "displayFormat": "DCO",
  "bodyText": "Meet the shoes built for heel pain relief. Free shipping and 90-day returns.",
  "title": "Comfort for every mile",
  "caption": "example.com",
  "linkUrl": "https://www.example.com/pages/running",
  "linkDescription": "Over 3M pairs sold",
  "ctaText": "Shop now",
  "ctaType": "SHOP_NOW",
  "imageUrls": [],
  "videos": [],
  "cards": [
    {
      "title": "Comfort for every mile",
      "body": "Meet the shoes built for heel pain relief. Free shipping and 90-day returns.",
      "caption": "example.com",
      "linkUrl": "https://www.example.com/pages/running",
      "linkDescription": "Over 3M pairs sold",
      "ctaText": "Shop Now",
      "imageUrl": null,
      "videoHdUrl": "https://video.xx.fbcdn.net/...mp4",
      "videoSdUrl": "https://video.xx.fbcdn.net/...mp4",
      "videoPreviewImageUrl": "https://scontent.xx.fbcdn.net/..."
    }
  ],
  "versionsCount": 1,
  "containsAiContent": false,
  "categories": [],
  "paidForBy": null,
  "spend": null,
  "currency": null,
  "impressions": null,
  "reachEstimate": null,
  "targetedOrReachedCountries": [],
  "message": null,
  "scrapedAt": "2026-11-20T16:44:14.056Z"
}
```

For political and issue ads (choose **Issues, elections or politics** as the ad category) `paidForBy`, `spend`
(for example `$100K-$200K`), `currency`, `impressions` and `reachEstimate` are filled in.

Rows with `type` other than `ad` are free and explain a search without ads, with a `message` that says what to do:
`no_results` (the Ad Library shows no ads, or every ad was already saved by an earlier search), `blocked` (the Ad Library did not answer after several tries), `invalid`
(the line is not a page or Ad Library link, or the page has no ads) and `skipped` (not read because of the maximum
cost per run or the timeout). The **Ads** view in the Output tab shows the main columns as a table.

### How much does Facebook Ads Library Scraper cost?

You pay per saved ad. There is no start fee, and explanation rows are free.

| Apify plan | Per 1,000 ads |
|---|---|
| Free | $0.60 |
| Bronze | $0.55 |
| Silver | $0.50 |
| Gold and higher | $0.45 |

Example: 5 competitors with 200 ads each are 1,000 ads, which cost $0.60 on the Free plan. Set a **maximum cost per
run** in the run options to cap what a run can spend: when it is reached, the run stops cleanly and searches it could
not pay for come back as free `skipped` rows.

### Tips

- Keep the proxy on **residential** (the default). Other proxies only get the first results of each search.
- Image and video links from Facebook expire after a few days. Download the files you want to keep.
- `versionsCount` above 1 and an early `startDate` usually mean the advertiser keeps paying for the ad, which is a
  sign that it works.
- To follow a competitor, run the Actor on a schedule with their page and **Active ads**, and compare the
  `adArchiveId` values with the last run.
- A page address that comes back as `invalid` has no Ad Library ID (the page has never run ads, or it is a personal
  profile). Search for the brand name as a search term instead.

### Is it legal to scrape the Facebook Ad Library?

The Actor reads only what the Ad Library shows publicly to visitors who are not logged in. It does not log in, use
cookies or accounts. Ads are mostly business information, but ads and political ad disclaimers can name people. If
you store or process personal data, you need a lawful basis under the data protection laws that apply to you (for
example the GDPR in the EU or the UK GDPR) and must respect the rights of the people in the data. Meta's terms
restrict automated collection; depending on your situation you may be bound by those terms, so check them before you
use the results. Ads and creatives are protected by copyright: use them for research, not as your own ads. You are
responsible for how you use the data; when in doubt, ask a lawyer.

### Related Actors

- [Google Ads Transparency Scraper](https://apify.com/earlytern/google-ads-transparency-scraper): the same
  advertiser's ads on Google Search, YouTube and Display.
- [Facebook Pages Scraper](https://apify.com/earlytern/facebook-pages-scraper): page details, followers, contacts and
  whether a page runs ads.
- [Company Enrichment by Domain](https://apify.com/earlytern/company-enrichment-by-domain): company details, social
  links and emails from a website address.

### Questions and feedback

Open an issue on the **Issues** tab; we answer within 2 working days.

# Actor input Schema

## `searchTerms` (type: `array`):

Words to search for in the Ad Library, one search per line, for example a brand, a product or a phrase from the ad text.

## `pages` (type: `array`):

Advertisers to get every ad from: a Facebook page address (https://www.facebook.com/nike), a page ID, or the address of an Ad Library search. An Ad Library address keeps its own country and filters.

## `country` (type: `string`):

Where the ads were shown.

## `activeStatus` (type: `string`):

Ads running now, ads that stopped, or both.

## `mediaType` (type: `string`):

Kind of picture or video in the ad.

## `adType` (type: `string`):

Political and issue ads also come with the amount spent, impressions, reach and who paid for them.

## `exactPhrase` (type: `boolean`):

Find ads with the search terms in this exact order.

## `maxAdsPerSearch` (type: `integer`):

Each search term or page stops after this many ads.

## `proxyConfiguration` (type: `object`):

Apify Proxy settings. Keep residential proxies: other proxies only get the first results of each search.

## Actor input object example

```json
{
  "searchTerms": [
    "running shoes"
  ],
  "country": "US",
  "activeStatus": "active",
  "mediaType": "all",
  "adType": "all",
  "exactPhrase": false,
  "maxAdsPerSearch": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "running shoes"
    ],
    "country": "US",
    "maxAdsPerSearch": 20,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("earlytern/facebook-ads-library-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["running shoes"],
    "country": "US",
    "maxAdsPerSearch": 20,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("earlytern/facebook-ads-library-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "running shoes"
  ],
  "country": "US",
  "maxAdsPerSearch": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call earlytern/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,earlytern/facebook-ads-library-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qgVYCeRKKF3Scyzbz/builds/Zul5kNbYtgAZ6Pb9b/openapi.json
