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

Scrape Facebook Ads Library to track competitors' ad creatives, copy changes, and ad activity.

- **URL**: https://apify.com/parseforge/facebook-ads-library-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Social media, Developer tools, E-commerce
- **Stats:** 46 total users, 3 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $16.00 / 1,000 results

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### Facebook Ads Library Scraper

**Scrape Facebook Ads Library for any advertiser, keyword, or page, up to a million ads per run.** Each ad comes with its creative, copy, impressions, spend, and demographic reach. No API key or login required. Export to CSV, JSON, Excel, or XML.

The Facebook Ads Library is the definitive public record of ads running across Meta platforms, but manually searching and copying data from it is slow and doesn't scale. This Facebook Ads Library scraper reads the public ad archive directly, filtering by advertiser, keyword, country, active status, media type, and date range, and returns every matching ad in one consistent, flat schema.

| Who uses it | What they scrape Facebook Ads Library for |
|---|---|
| Market researchers | Benchmark competitor ad creative and messaging strategies across different countries. |
| Political transparency groups | Archive and analyze political and issue-based ad campaigns, including spend and reach. |
| E-commerce brand managers | Monitor competitor product launches and promotional tactics on Facebook and Instagram. |
| Ad agencies | Build a searchable database of high-performing ad examples for creative inspiration. |

### What it does

This Actor collects ads from the Facebook Ads Library by advertiser page ID, keyword search, or direct URL, and returns each one as a flat row with its creative details, copy, and performance ranges.

- 🔍 **Advertiser or keyword search:** Find ads by entering a Facebook Page ID or a free-text keyword phrase.
- 🌍 **Country and platform filters:** Target ads by the country they reached and the Meta platform they appeared on, including Facebook, Instagram, Messenger, and WhatsApp.
- 📅 **Date range control:** Limit results to ads that started within a preset period like the last 7 days, or set a custom start and end date.
- 🎬 **Media type selection:** Filter for image ads, video ads, memes, or ads with no media at all.
- 🏷️ **Run tagging:** Add a custom tag to every row in a run so you can track which dataset came from which campaign.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with Facebook Ads Library data

**📈 Monitor competitor ad strategy.**

A market researcher enters a competitor's Facebook Page ID and the US country code to collect every active ad, then analyzes the creative themes and copy angles the brand is testing this quarter.

**🗳️ Archive political ad campaigns.**

A transparency watchdog searches for political and issue ads by keyword, filters for the last 90 days, and exports a CSV of ad spend ranges and impression counts for a public report.

**🛍️ Track product launches across markets.**

An e-commerce manager scrapes ads for a keyword like 'wireless earbuds' across the US, GB, and DE to see which features competitors are highlighting in each region.

**🎨 Build a creative swipe file.**

An agency creative director runs a search for video ads from a set of admired brands, filters for active ads only, and downloads the results to build an inspiration library for the next pitch.

### Why choose this scraper

|  | What you get |
|---|---|
| **No official API needed** | Access the public Facebook Ads Library without app registration, OAuth, or rate limits. |
| **Full ad transparency data** | Get spend and impression ranges, demographic reach, and the platforms each ad ran on. |
| **Multi-country targeting** | Search for ads that reached specific countries using 2-letter ISO codes. |
| **Flexible output control** | Set a maximum number of ads to collect, from a 10-ad preview up to 1,000,000 per run. |

### How it compares

This Actor focuses on the public Facebook Ads Library archive, while other Facebook scrapers target organic page content or page metadata.

| Feature | ParseForge | Facebook Ad Library Scraper | Facebook Posts Scraper | Facebook Pages Scraper |
|---|---|---|---|---|
| Scrapes the Facebook Ads Library | Yes | Yes | Not listed | Not listed |
| Filters by ad active status | Yes | Not listed | Not listed | Not listed |
| Filters by ad type (political, housing, etc.) | Yes | Not listed | Not listed | Not listed |
| Returns ad spend and impression ranges | Yes | Not listed | Not listed | Not listed |
| Returns demographic reach data | Yes | Not listed | Not listed | Not listed |
| Filters by country reached | Yes | Not listed | Not listed | Not listed |

### Configure the run

Drive the Actor from advertiser page IDs, keyword searches, and direct URLs, alone or together, and filters run as each ad is read so only matches reach your dataset. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "searchQuery": "coca cola",
  "adReachedCountries": [
    "US"
  ],
  "maxItems": 10
}
```

A larger pull:

```json
{
  "searchQuery": "coca cola",
  "adReachedCountries": [
    "US"
  ],
  "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.025 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $2.50 |
| 1,000 results | $25.00 |
| 10,000 results | $250.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [Facebook Ads Library Scraper](https://apify.com/parseforge/facebook-ads-library-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to Facebook Ads Library through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?tools=parseforge/facebook-ads-library-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that your search query or page ID is valid and that your filters, especially the Ad Active Status and Date Range, are not too restrictive. Try setting the status to 'All ads' and the date range to 'All time' to widen the net.

**Why does the scraper stop after only 10 ads?**

Free Apify accounts are limited to a 10-ad preview. Upgrade to a paid plan and set the Maximum ads field to a higher number to collect more results.

**Why are my country filters not working as expected?**

The first country code in your Ad Reached Countries list is used to initialize the browsing session. Make sure the first code is a primary market for your search, and use standard 2-letter ISO codes.

**Why do I get an error when using both a search query and a page ID?**

The search query and advertiser page ID fields are mutually exclusive. Use one or the other, not both in the same run.

### FAQ

| Question | Answer |
|---|---|
| Do I need a Facebook account or API key to use this scraper? | No. This Actor reads the public Facebook Ads Library interface directly. You do not need a Facebook account, an app registration, or any API key. |
| What data does the Facebook Ads Library scraper return? | Each row includes the ad creative (images and videos), body text, page name, ad start and end dates, spend and impression ranges, demographic reach, and the platforms the ad appeared on. |
| Can I scrape ads from a specific Facebook page? | Yes. Enter the advertiser's Facebook Page ID in the Advertiser Page ID field, and the Actor will return every ad from that page that matches your other filters. |
| How do I find a Facebook Page ID? | You can often find a page's ID in the URL of its Facebook page, or by using a free online lookup tool. The ID is a numeric string, such as 14226545351 for Red Bull. |
| Can I filter ads by the country they reached? | Yes. Use the Ad Reached Countries field with 2-letter ISO country codes like US, GB, or DE. The first country in your list is used to initialize the session. |
| Does this scraper collect political and issue ads? | Yes. Set the Ad Type filter to 'Political and issue ads' to return only that category, or choose from housing, employment, and credit ad types as well. |
| Can I search for ads by a keyword phrase? | Yes. Enter a keyword or phrase in the search query field. You can choose to match keywords in any order or as an exact phrase. |
| What is the maximum number of ads I can scrape in one run? | Paid users can collect up to 1,000,000 ads per run. Free users are limited to a 10-ad preview to test the Actor before upgrading. |
| Can I filter ads by media type, like video only? | Yes. The Media Type filter lets you select images, memes, videos, or a combination. You can also choose to return only ads with no media. |
| How do I export the scraped ad data? | Your results are stored in Apify's dataset and can be exported in CSV, JSON, Excel, XML, or other formats directly from the run console. |

### Related actors

- [facebook-posts-scraper](https://apify.com/parseforge/facebook-posts-scraper?fpr=vmoqkp): Use this instead when you need organic page posts, reactions, and comments rather than paid ads from the Ad Library.
- [facebook-pages-scraper](https://apify.com/parseforge/facebook-pages-scraper?fpr=vmoqkp): Use this instead when you need page profile details like likes, followers, emails, and website URLs, not ad creatives.

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Meta Platforms, Inc. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `urls` (type: `array`):

List of Facebook Ad Library search URLs or Page URLs. Parameters from the URL are extracted automatically. You can also use Search Query or Advertiser Page ID instead.

## `searchQuery` (type: `string`):

Keyword or phrase to search for in ad content. Use this OR Advertiser Page ID — not both.

## `advertiserPageId` (type: `string`):

Facebook Page ID of an advertiser (e.g. 14226545351 for Red Bull). Use this OR Search Query — not both.

## `adReachedCountries` (type: `array`):

2-letter ISO country codes (e.g. US, GB, DE). Use ALL to target all countries. First country is used for session init.

## `adActiveStatus` (type: `string`):

Filter by active/inactive status.

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

Type of ads to retrieve.

## `searchType` (type: `string`):

How to match the search query.

## `period` (type: `string`):

Only keep ads whose start date falls within this window. Overridden by Start Date if both are set.

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

Only keep ads that started on or after this date (YYYY-MM-DD). Overrides Date Range if both are set.

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

Only keep ads that started on or before this date (YYYY-MM-DD). Optional.

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

Filter by the creative format of the ad.

## `publisherPlatforms` (type: `array`):

Only return ads shown on these platforms. Leave empty for all platforms.

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

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## `runTag` (type: `string`):

Add this value to a 'runTag' column in every output row. Useful for identifying runs.

## `requestDelayMs` (type: `integer`):

Delay between pagination requests in milliseconds.

## Actor input object example

```json
{
  "searchQuery": "coca cola",
  "adReachedCountries": [
    "US"
  ],
  "adActiveStatus": "active",
  "adType": "ALL",
  "searchType": "KEYWORD_UNORDERED",
  "mediaType": "all",
  "maxItems": 10,
  "requestDelayMs": 500
}
```

# Actor output Schema

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

Dataset with all scraped items

# 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 = {
    "searchQuery": "coca cola",
    "adReachedCountries": [
        "US"
    ],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/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 = {
    "searchQuery": "coca cola",
    "adReachedCountries": ["US"],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/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 '{
  "searchQuery": "coca cola",
  "adReachedCountries": [
    "US"
  ],
  "maxItems": 10
}' |
apify call parseforge/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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