# Facebook Ads Library Scraper (`piotrv1001/facebook-ads-library-scraper`) Actor

Scrape the Meta (Facebook) Ad Library by keyword: advertiser, ad text, headline, CTA, landing URL, images, videos, carousel cards, dates, platforms and status. Filter by country, status, ad category, media type and date. Spend and reach for political ads.

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

## Pricing

from $1.00 / 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.

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

Scrape the **Facebook Ad Library (Meta Ad Library) by keyword**. The **Facebook Ads Library Scraper** returns every matching ad with the advertiser page, ad text, headline, call to action, landing page URL, images, videos, carousel cards, start and end dates, platforms (Facebook, Instagram, Messenger, Audience Network, Threads) and active status. Political and issue ads add spend, impressions and reach ranges. Filter by country, ad status, ad category, media type and the dates the ads were shown. Use it for competitor ad research, creative inspiration, market and trend analysis, or political ad monitoring.

### ✨ Features

- 🔍 **Search by Keyword**: Many keywords per run, or paste search links copied from the Ad Library with all their filters.
- 🌍 **Any Country**: A 2-letter country code (US, GB, DE, BR…) or ALL.
- 🟢 **Active or Ended Ads**: Active only, inactive only, or both.
- 🗂️ **Ad Categories**: All ads, issues/elections/politics, housing, employment, financial products and services.
- 🖼️ **Media Filter**: Images, videos, memes, or text-only ads.
- 📅 **Date Filter**: Only ads shown between two dates.
- 🎬 **Full Creatives**: Image URLs, HD and SD video URLs with preview images, and every carousel card.
- 💵 **Spend and Reach**: Spend, impressions and reach ranges where the Ad Library publishes them (political and issue ads).
- 🧹 **No Duplicates**: An ad found by two keywords is saved and charged once.

### 🛠️ How It Works

1. **Enter search keywords** (or paste Ad Library search URLs).
2. **Pick the country and filters, and how many ads you want** – the default is 50.
3. **Run the Scraper** – download the results as JSON, CSV or Excel or pull them through the API.

### ⚙️ Input

| Field               | What it does                                                                                                     |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- |
| **Search keywords** | Keywords to search, one per line. Default `nike`.                                                                |
| **Ad Library URLs** | Optional search links copied from facebook.com/ads/library. Their own filters (country, sort, platforms…) apply. |
| **Country**         | 2-letter country code or `ALL`. Default `US`.                                                                    |
| **Ad status**       | `active`, `inactive` or `all`. Default `active`.                                                                 |
| **Ad category**     | `all`, `political_and_issue_ads`, `housing_ads`, `employment_ads` or `credit_ads` (financial products).          |
| **Media type**      | `all`, `image`, `video`, `meme`, `image_and_meme` or `none` (no image or video).                                 |
| **Shown from / until** | Optional dates (YYYY-MM-DD): only ads shown in this period.                                                   |
| **Max ads**         | Stop after this many ads in total. Default 50.                                                                   |

```json
{
    "searchQueries": ["running shoes", "protein powder"],
    "country": "GB",
    "activeStatus": "active",
    "mediaType": "video",
    "maxItems": 500
}
```

### 💰 Pricing

Pay only for the ads you get. No monthly rental.

| Event           | Price                            | What you get                              |
| --------------- | -------------------------------- | ----------------------------------------- |
| **Ad**          | $0.001 per ad ($1 per 1,000)     | One ad with all the fields below          |
| **Actor start** | $0.00005 per run                 | Charged once when the run starts.         |

Examples: 50 ads = $0.05 · 1,000 ads = $1.00 · 10,000 ads = $10.00.

### 📊 Sample Output Data

```json
{
    "adArchiveId": "1730157431630947",
    "adId": null,
    "pageId": "100801038449520",
    "pageName": "Natural Allies for a Clean Energy Future",
    "pageUrl": "https://www.facebook.com/naturalalliesforcleanenergy/",
    "pageProfilePicture": "https://scontent-lga3-2.xx.fbcdn.net/v/t39.35426-6/747190981_..._n.jpg",
    "pageLikeCount": 690,
    "pageCategories": ["Nonprofit organization"],
    "isActive": true,
    "startDate": "2026-07-20T07:00:00.000Z",
    "endDate": null,
    "publisherPlatforms": ["FACEBOOK", "INSTAGRAM"],
    "displayFormat": "VIDEO",
    "body": "America's clean energy future is already underway—and it takes more than one energy source to get there. ...",
    "title": "Accelerating Our Clean Energy Future",
    "caption": "www.naturalalliesforcleanenergy.org",
    "linkUrl": "https://www.naturalalliesforcleanenergy.org/benefits-of-natural-gas/?utm_source=meta",
    "linkDescription": "See how natural gas complements renewable energy to help power America's energy transition.",
    "ctaText": "Learn more",
    "ctaType": "LEARN_MORE",
    "images": [],
    "videos": [
        {
            "hdUrl": "https://video-lga3-1.xx.fbcdn.net/o1/v/t2/f2/m366/AQPd....mp4",
            "sdUrl": "https://video-lga3-2.xx.fbcdn.net/o1/v/t2/f2/m412/AQNM....mp4",
            "previewImageUrl": "https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/747807771_..._n.jpg"
        }
    ],
    "cards": [],
    "collationId": "2534994893608680",
    "collationCount": 1,
    "categories": ["POLITICAL"],
    "byline": "Natural Allies, Inc.",
    "spend": "$10K - $15K",
    "impressions": ">1M",
    "reachEstimate": ">1M",
    "currency": "USD",
    "targetedOrReachedCountries": [],
    "containsSensitiveContent": false,
    "adLibraryUrl": "https://www.facebook.com/ads/library/?id=1730157431630947",
    "input": "climate",
    "scrapedAt": "2026-10-18T10:32:37.457Z"
}
```

- `endDate` is empty while the ad is still running.
- `collationCount` = how many ads share this creative and text (the Ad Library's "N ads use this creative").
- `cards` holds every carousel or dynamic-ad card (title, text, link, CTA, image, video).
- `input` = the keyword or URL that found the ad.

### ❓ FAQ

**Do I need a Facebook account or an access token?** No.

**Why are spend and impressions empty for most ads?** The Ad Library publishes them only for issue, election and political ads. Pick the `political_and_issue_ads` category to get them.

**Why do I get fewer ads than the count shown in the Ad Library?** Some results stop paging early on the site itself; narrow the search (country, dates, media type) or split it into several keywords to reach more ads.

**Can I get all ads of one advertiser?** Yes, use the [Facebook Page Ads Scraper](https://apify.com/piotrv1001/facebook-page-ads-scraper) with the page URL.

### 🔗 More Facebook Actors

- [Facebook Page Ads Scraper](https://apify.com/piotrv1001/facebook-page-ads-scraper): every ad run by the Facebook pages you list.
- [Facebook Pages Scraper](https://apify.com/piotrv1001/facebook-pages-scraper): page profiles, contact details and posts.

# Actor input Schema

## `searchQueries` (type: `array`):

Keywords to search in the Ad Library, one per line (brand, product, topic…).

## `startUrls` (type: `array`):

Optional: paste search links copied from the Ad Library (facebook.com/ads/library/?…). Their own filters are used.

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

Where the ads ran: a 2-letter country code (US, GB, DE, BR…) or ALL for every country.

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

Active ads only, inactive (ended) ads only, or both.

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

Which ads to search. Special categories show extra data such as spend and reach for political ads.

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

Only ads with this kind of creative.

## `startDate` (type: `string`):

Optional: only ads shown on or after this date (YYYY-MM-DD).

## `endDate` (type: `string`):

Optional: only ads shown on or before this date (YYYY-MM-DD).

## `maxItems` (type: `integer`):

Stop after this many ads in total (all searches together).

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

Keep the default for reliable results.

## Actor input object example

```json
{
  "searchQueries": [
    "nike"
  ],
  "country": "US",
  "activeStatus": "active",
  "adType": "all",
  "mediaType": "all",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# 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 = {
    "searchQueries": [
        "nike"
    ],
    "country": "US",
    "maxItems": 50,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("piotrv1001/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 = {
    "searchQueries": ["nike"],
    "country": "US",
    "maxItems": 50,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("piotrv1001/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 '{
  "searchQueries": [
    "nike"
  ],
  "country": "US",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call piotrv1001/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,piotrv1001/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/FAf6I5q3HjQoFD0mE/builds/r74aeOmSN88AiRItW/openapi.json
