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

Collect ads from Meta Ad Library using search URLs, keywords, or Facebook page URLs. Export structured results with ad creatives, images, videos, advertiser details, platform targeting, transparency data, and performance metrics to support competitive analysis and market research.

- **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:** 39 total users, 6 monthly users, 50.5% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.25 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Banner](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)

## 📢 Facebook Ads Library Scraper

> 🚀 Collect competitor ad intelligence from Meta's Ads Library. Search by keyword, advertiser page, or URL. Get creative text, spend ranges, impressions, demographics, and delivery regions for up to 1M ads per run.

> 🕒 **Last updated:** 2026-04-21


<table><tr>
<td style="border-left:4px solid #0F766E;padding:12px 16px;font-weight:600">Pull structured records from Facebook Ads Library — clean fields ready as CSV, JSON, JSONL, Excel, or XML for downstream pipelines.</td>
</tr></table>

<table>
<tr>
<td colspan="4" style="padding:10px 14px;background:#0F766E;border:none;border-radius:4px 4px 0 0">
<span style="color:#FFFFFF;font-size:14px;font-weight:700;letter-spacing:0.5px">Related Scrapers</span>
</td>
</tr>
<tr>
<td style="padding:10px 14px;border:1px solid #E7E5E4;border-top:none;vertical-align:top;width:25%;background:#CCFBF1">
&nbsp;<a href="https://apify.com/parseforge/facebook-ads-library-scraper" style="color:#0F766E;text-decoration:none;font-weight:700;font-size:13px">Ads Library</a><br>
<span style="color:#0F766E;font-size:11px;font-weight:600">➸ You are here</span>
</td>
<td style="padding:10px 14px;border:1px solid #E7E5E4;border-top:none;vertical-align:top;width:25%">
&nbsp;<a href="https://apify.com/parseforge/facebook-pages-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:13px">Pages</a><br>
<span style="color:#78716C;font-size:11px">Page profiles + about</span>
</td>
<td style="padding:10px 14px;border:1px solid #E7E5E4;border-top:none;vertical-align:top;width:25%">
&nbsp;<a href="https://apify.com/parseforge/facebook-posts-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:13px">Posts</a><br>
<span style="color:#78716C;font-size:11px">Wall posts + reactions</span>
</td>
<td style="padding:10px 14px;border:1px solid #E7E5E4;border-top:none;vertical-align:top;width:25%">
&nbsp;<a href="https://apify.com/parseforge/facebook-reviews-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:13px">Reviews</a><br>
<span style="color:#78716C;font-size:11px">Business page ratings</span>
</td>
</tr>
</table>

##### Copy to your AI assistant

Copy this block into ChatGPT, Claude, Cursor, or any LLM to start using this actor.

````

parseforge/facebook-ads-library-scraper on Apify. Call: ApifyClient("TOKEN").actor("parseforge/facebook-ads-library-scraper").call(run\_input={...}), then client.dataset(run\["defaultDatasetId"]).list\_items().items for results. Key inputs: urls (array), searchQuery (string, default "coca cola"), advertiserPageId (string), adReachedCountries (array, default \["US"]), adActiveStatus (string, default "active"), adType (string, default "ALL"). Full actor spec: fetch build via GET https://api.apify.com/v2/acts/parseforge~facebook-ads-library-scraper (Bearer TOKEN). Get token: https://console.apify.com/account/integrations

````

Facebook Ads Library Scraper connects to Meta's public Ads Library through your free access token and returns structured ad data. Each record includes the creative text, snapshot URL, landing page, spend range, impression range, demographic breakdown, regional delivery data, publisher platforms, and delivery dates. You can search by keyword, specific advertiser page ID, or paste Ads Library URLs directly. Filter by country, active/inactive status, ad type, platform, and date range.

Marketing teams use this to monitor competitor campaigns and benchmark creative strategies. Media buyers track spend patterns across markets. Political researchers audit election ad activity. Agencies pull bulk data for client reports. If you need structured access to Meta's transparency data without hours of manual browsing and copy-pasting, this actor automates the entire workflow.

| Target | Meta Ads Library (Facebook, Instagram, Messenger, Audience Network) |
|--------|-------------------------------|
| Use Cases | Competitor ad monitoring, creative benchmarking, spend tracking, political ad auditing |

---

### 📋 What it does

- 🔍 **Multi-mode search.** Search by keyword, advertiser page ID, or paste Ads Library URLs directly.
- 🌍 **Country and platform filters.** Scope results to specific markets and channels.
- 📅 **Date range filtering.** Track campaigns by delivery period with presets or custom dates.
- 💰 **Spend and impression data.** Estimated budget and reach ranges per ad.
- 👥 **Demographic breakdowns.** Age, gender, and geographic delivery distribution per ad.

Each ad record gives you 20+ fields covering what the ad says, where it runs, how much it costs, who sees it, and when it was active.

> 💡 **Why it matters:** Tracking competitor ad strategy manually means searching one advertiser at a time, scrolling through results, and pasting data into spreadsheets. This actor exports the entire dataset in bulk, filtered and structured, ready for your dashboard.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded dataset._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td>urls</td><td>array</td><td>[]</td><td>Ads Library search URLs or Page URLs. Parameters extracted automatically.</td></tr>
<tr><td>searchQuery</td><td>string</td><td>"coca cola"</td><td>Keyword or phrase to search in ad content. Use this or advertiserPageId, not both.</td></tr>
<tr><td>advertiserPageId</td><td>string</td><td>-</td><td>Facebook Page ID of a specific advertiser (e.g. "14226545351" for Red Bull).</td></tr>
<tr><td>adReachedCountries</td><td>array</td><td>["US"]</td><td>2-letter ISO country codes. Use "ALL" for all countries.</td></tr>
<tr><td>adActiveStatus</td><td>string</td><td>"active"</td><td>Filter: active, inactive, or all.</td></tr>
<tr><td>adType</td><td>string</td><td>"ALL"</td><td>Category: all, political/issue, housing, employment, or credit.</td></tr>
<tr><td>period</td><td>string</td><td>All time</td><td>Preset date range: last 24h, 7d, 14d, 30d, or 90d.</td></tr>
<tr><td>startDate</td><td>string</td><td>-</td><td>Custom start date (YYYY-MM-DD). Overrides period.</td></tr>
<tr><td>endDate</td><td>string</td><td>-</td><td>Custom end date (YYYY-MM-DD). Defaults to today.</td></tr>
<tr><td>sortBy</td><td>string</td><td>"impressions_desc"</td><td>Sort by most impressions or most recent.</td></tr>
<tr><td>maxItems</td><td>integer</td><td>5</td><td>Max ads to collect. Free: up to 100. Paid: up to 1,000,000.</td></tr>
<tr><td>runTag</td><td>string</td><td>-</td><td>Custom tag added to every output row for batch identification.</td></tr>
<tr><td>requestDelayMs</td><td>integer</td><td>500</td><td>Delay between pagination requests in milliseconds.</td></tr>
</tbody>
</table>

**Example: active Nike ads in the US sorted by impressions.**

```json
{
  "searchQuery": "nike shoes",
  "maxItems": 50,
  "adReachedCountries": ["US"],
  "adActiveStatus": "active",
  "sortBy": "impressions_desc"
}
````

**Example: all ads from a specific advertiser across US and UK.**

```json
{
  "advertiserPageId": "14226545351",
  "maxItems": 200,
  "adReachedCountries": ["US", "GB"],
  "adActiveStatus": "all"
}
```

> ⚠️ **Good to Know:** You need a free Meta access token from developers.facebook.com to use this actor. No paid Meta plan is required. The token grants access to Meta's public transparency data.

***

### 📊 Output

Each record contains **20+ fields**. Download as CSV, Excel, JSON, or XML.

#### 🧾 Schema

| Field | Type | Example |
|---|---|---|
| 🆔 adArchiveId | string | `"987654321"` |
| 📝 adCreativeBody | string | `"Summer sale: 50% off all shoes..."` |
| 🖼️ adSnapshotUrl | string | `"https://www.facebook.com/ads/archive/..."` |
| 🔗 linkUrl | string | `"https://www.nike.com/sale"` |
| 👤 pageName | string | `"Nike"` |
| 📅 adDeliveryStartTime | string | `"2026-03-15"` |
| ✅ adActiveStatus | string | `"ACTIVE"` |
| 🎯 publisherPlatforms | array | `["facebook", "instagram"]` |
| 💰 spendLower | number | `500` |
| 💰 spendUpper | number | `999` |
| 📊 impressionsLower | number | `10000` |
| 📊 impressionsUpper | number | `50000` |
| 📍 deliveryByRegion | array | `[{"region": "California", "percentage": 0.18}]` |
| 👥 demographicDistribution | array | `[{"age": "25-34", "gender": "female", "percentage": 0.32}]` |

#### 📦 Sample records

<details>
<summary><strong>📢 Active brand ad with spend data</strong></summary>

```json
{
  "adArchiveId": "987654321",
  "adCreativeBody": "Summer sale: 50% off all running shoes. Free shipping on orders over $50.",
  "adSnapshotUrl": "https://www.facebook.com/ads/archive/render_ad/?id=987654321",
  "linkUrl": "https://www.nike.com/sale",
  "linkTitle": "Nike Summer Sale",
  "pageName": "Nike",
  "pageUrl": "https://www.facebook.com/nike",
  "adDeliveryStartTime": "2026-03-15",
  "adDeliveryStopTime": null,
  "adActiveStatus": "ACTIVE",
  "adType": "REGULAR",
  "publisherPlatforms": ["facebook", "instagram"],
  "spendLower": 500,
  "spendUpper": 999,
  "impressionsLower": 10000,
  "impressionsUpper": 50000,
  "deliveryByRegion": [{"region": "California", "percentage": 0.18}],
  "demographicDistribution": [{"age": "25-34", "gender": "female", "percentage": 0.32}],
  "scrapedAt": "2026-04-17T00:00:00.000Z"
}
```

</details>

<details>
<summary><strong>📅 Inactive seasonal campaign</strong></summary>

```json
{
  "adArchiveId": "111222333",
  "adCreativeBody": "Black Friday: Up to 70% off selected styles. Limited time.",
  "adSnapshotUrl": "https://www.facebook.com/ads/archive/render_ad/?id=111222333",
  "linkUrl": "https://www.example.com/black-friday",
  "linkTitle": "Black Friday Deals",
  "pageName": "Fashion Store",
  "pageUrl": "https://www.facebook.com/fashionstore",
  "adDeliveryStartTime": "2025-11-20",
  "adDeliveryStopTime": "2025-12-01",
  "adActiveStatus": "INACTIVE",
  "adType": "REGULAR",
  "publisherPlatforms": ["facebook"],
  "spendLower": 1000,
  "spendUpper": 4999,
  "impressionsLower": 50000,
  "impressionsUpper": 100000,
  "deliveryByRegion": [],
  "demographicDistribution": [],
  "runTag": "bf-2025",
  "scrapedAt": "2026-04-17T00:00:00.000Z"
}
```

</details>

<details>
<summary><strong>🏛️ Political issue ad</strong></summary>

```json
{
  "adArchiveId": "444555666",
  "adCreativeBody": "Vote YES on Proposition 12 for affordable housing.",
  "adSnapshotUrl": "https://www.facebook.com/ads/archive/render_ad/?id=444555666",
  "linkUrl": null,
  "linkTitle": null,
  "pageName": "Housing Alliance PAC",
  "pageUrl": "https://www.facebook.com/housingalliancepac",
  "adDeliveryStartTime": "2026-02-01",
  "adDeliveryStopTime": null,
  "adActiveStatus": "ACTIVE",
  "adType": "POLITICAL_AND_ISSUE_ADS",
  "publisherPlatforms": ["facebook", "messenger"],
  "spendLower": null,
  "spendUpper": null,
  "impressionsLower": null,
  "impressionsUpper": null,
  "deliveryByRegion": [{"region": "California", "percentage": 0.95}],
  "demographicDistribution": [{"age": "35-44", "gender": "unknown", "percentage": 0.28}],
  "scrapedAt": "2026-04-17T00:00:00.000Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🔍 | **Three input modes.** Search by keyword, advertiser page ID, or paste Ads Library URLs. |
| 🌍 | **All countries.** Filter ads by any combination of country codes or use ALL for global. |
| 💰 | **Spend and impressions.** Estimated budget and reach ranges for competitive benchmarking. |
| 👥 | **Demographics.** Age, gender, and regional delivery breakdowns per ad. |
| 📅 | **Date filtering.** Custom date ranges and presets for campaign-level analysis. |
| 📊 | **Scale to 1M ads.** From quick spot-checks to full advertiser audits. |
| 🔌 | **Official Meta API.** Uses your free access token against Meta's transparency endpoint. |

> Meta's Ads Library is the largest public database of digital advertising, covering Facebook, Instagram, Messenger, and Audience Network.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Setup |
|---|---|---|---|---|
| **⭐ Facebook Ads Library Scraper** *(this Actor)* | $5 free credit, then pay-per-use | Up to 1M ads, 20+ fields | **Live per run** | ⚡ 5 min |
| Manual Ads Library browsing | Free (your time) | One page at a time | Manual | Hours per batch |
| Paid competitive intelligence platforms | $99-999/month | Multi-channel | Daily/weekly | Hours of onboarding |
| Custom Meta API integration | Engineering time | Same data | As coded | Days to weeks |

Pick this actor when you need bulk access to Meta's ad transparency data without building a custom API integration.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the Facebook Ads Library Scraper page on the Apify Store.
3. 🎯 **Set input.** Enter a search query or advertiser page ID. Set country, date range, and filters.
4. 🚀 **Run it.** Click **Start** and let the Actor collect your data.
5. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 📊 Competitive Intelligence

- Monitor competitor ad creative and messaging
- Track spend patterns across markets and seasons
- Identify new product launches through ad activity
- Benchmark your creative against industry leaders

</td>
<td width="50%" valign="top">

#### 🎯 Media Buying

- Analyze competitor targeting by demographics and regions
- Identify which platforms competitors prioritize
- Track ad lifespans to estimate campaign budgets
- Study what creative styles get the most impressions

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 🏛️ Political and Compliance Research

- Audit political ad activity by region and spend
- Monitor housing, employment, and credit ad compliance
- Track issue-based advertising across election cycles
- Build transparency reports for public accountability

</td>
<td width="50%" valign="top">

#### 📈 Agency Reporting

- Pull bulk ad data for client competitive reports
- Tag runs by client or campaign for organized analysis
- Compare ad performance across multiple markets
- Generate weekly or monthly ad landscape summaries

</td>
</tr>
</table>

***

***

### 🌟 Beyond business use cases

Data like this powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Empirical datasets for papers, thesis work, and coursework
- Longitudinal studies tracking changes across snapshots
- Reproducible research with cited, versioned data pulls
- Classroom exercises on data analysis and ethical scraping

</td>
<td width="50%">

#### 🎨 Personal and creative

- Side projects, portfolio demos, and indie app launches
- Data visualizations, dashboards, and infographics
- Content research for bloggers, YouTubers, and podcasters
- Hobbyist collections and personal trackers

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Transparency reporting and accountability projects
- Advocacy campaigns backed by public-interest data
- Community-run databases for local issues
- Investigative journalism on public records

</td>
<td width="50%">

#### 🧪 Experimentation

- Prototype AI and machine-learning pipelines with real data
- Validate product-market hypotheses before engineering spend
- Train small domain-specific models on niche corpora
- Test dashboard concepts with live input

</td>
</tr>
</table>

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20Facebook%20Ads%20Library%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20Facebook%20Ads%20Library%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20Facebook%20Ads%20Library%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20Facebook%20Ads%20Library%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

### ❓ Frequently Asked Questions

<details>
<summary><b>💳 Do I need a paid Apify plan to run this actor?</b></summary>

No. You can start right now on the free Apify plan, which includes **$5 in free monthly credit**. That is enough to run this actor several times and explore the output before committing to anything. Paid plans unlock higher limits, more concurrent runs, and larger datasets. [Create a free Apify account here](https://console.apify.com/sign-up?fpr=vmoqkp) to get started.

</details>

<details>
<summary><b>🚨 What happens if my run fails or returns no results?</b></summary>

Failed runs are not charged. If the source site changes, proxies get rate-limited, or a specific input matches nothing, re-run the actor or open our [contact form](https://tally.so/r/BzdKgA) and we will investigate. You can also check the run log in the Apify console to see why the run stopped.

</details>

<details>
<summary><b>📏 How many items can I scrape per run?</b></summary>

Free users are limited to **10 items per run** so you can preview the output and confirm the actor works for your use case. Paid users can raise maxItems up to **1,000,000** per run. [Upgrade here](https://console.apify.com/sign-up?fpr=vmoqkp) if you need full scale.

</details>

<details>
<summary><b>🕒 How fresh is the data?</b></summary>

Every run fetches live data at the moment of execution. There is no cache or delay: the records you get reflect what the source returned at that moment. Schedule the actor to maintain a rolling snapshot of the data you need.

</details>

<details>
<summary><b>🧑‍💻 Can I call this actor from my own code?</b></summary>

Yes. Apify exposes every actor as a REST endpoint and ships first-class SDKs for [Node.js](https://docs.apify.com/sdk/js) and [Python](https://docs.apify.com/sdk/python). You can start a run, read the dataset, and handle webhooks from your own app in a few lines. All you need is your Apify API token.

</details>

<details>
<summary><b>📤 How do I export the data?</b></summary>

Every Apify dataset can be downloaded in one click from the console as CSV, JSON, JSONL, Excel, HTML, XML, or RSS. You can also pull results programmatically via the [Apify API](https://docs.apify.com/api/v2) or stream them into BigQuery, S3, and other destinations through built-in integrations.

</details>

<details>
<summary><b>📅 Can I schedule the actor to run automatically?</b></summary>

Yes. Use the Apify scheduler to run the actor on any cadence, from hourly to monthly. Results are saved to your dataset and can be delivered to webhooks, email, Slack, cloud storage, or automation tools such as Zapier and Make.

***

</details>

### 🔌 Automating Facebook Ads Library Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the apify-client NPM package.
- 🐍 **Python.** Use the apify-client PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. Schedule weekly runs to track competitor ad changes over time.

### 🔌 Integrate with any app

Facebook Ads Library Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Get run notifications
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe data into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes.

***

### 🔗 Recommended Actors

- [**🛍️ Shopify Products Scraper**](https://apify.com/parseforge/shopify-stores-scraper) - Collect product catalogs from Shopify stores
- [**📊 Smart Apify Actor Scraper**](https://apify.com/parseforge/smart-apify-actor-scraper) - Scrape actor metadata and quality metrics
- [**📰 PR Newswire Scraper**](https://apify.com/parseforge/pr-newswire-scraper) - Extract press releases and news
- [**🏢 Hubspot Marketplace Scraper**](https://apify.com/parseforge/hubspot-marketplace-scraper) - Collect app marketplace data
- [**💼 Craigslist Scraper**](https://apify.com/parseforge/craigslist-scraper) - Classified listings from Craigslist

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more data scrapers and tools.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by Meta Platforms, Inc. All trademarks mentioned are the property of their respective owners. Only publicly available data is collected through Meta's official transparency API.

# 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`):

Search ads within a given date range. Overridden by explicit Start Date if provided.

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

Custom start date (YYYY-MM-DD). Overrides period if both are set.

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

Custom end date (YYYY-MM-DD). Optional — defaults to today.

## `sortBy` (type: `string`):

Sort results by impressions or most recent.

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

Maximum number of ads to collect. Free users: max 100. Paid users: 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.

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

Proxy settings for reliable scraping. Disabled by default — enable if you get blocked or rate limited.

## Actor input object example

```json
{
  "searchQuery": "coca cola",
  "adReachedCountries": [
    "US"
  ],
  "adActiveStatus": "active",
  "adType": "ALL",
  "searchType": "KEYWORD_UNORDERED",
  "sortBy": "impressions_desc",
  "maxItems": 5,
  "requestDelayMs": 500,
  "proxyConfiguration": {}
}
```

# 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": 5
};

// 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": 5,
}

# 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("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": 5
}' |
apify call parseforge/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/facebook-ads-library-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Ads Library Scraper",
        "description": "Collect ads from Meta Ad Library using search URLs, keywords, or Facebook page URLs. Export structured results with ad creatives, images, videos, advertiser details, platform targeting, transparency data, and performance metrics to support competitive analysis and market research.",
        "version": "1.0",
        "x-build-id": "q7OQgLjR6hfgXO639"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~facebook-ads-library-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-facebook-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~facebook-ads-library-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-facebook-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~facebook-ads-library-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-facebook-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "urls": {
                        "title": "Ad Library URLs",
                        "type": "array",
                        "description": "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.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchQuery": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Keyword or phrase to search for in ad content. Use this OR Advertiser Page ID — not both."
                    },
                    "advertiserPageId": {
                        "title": "Advertiser Page ID",
                        "type": "string",
                        "description": "Facebook Page ID of an advertiser (e.g. 14226545351 for Red Bull). Use this OR Search Query — not both."
                    },
                    "adReachedCountries": {
                        "title": "Ad Reached Countries",
                        "type": "array",
                        "description": "2-letter ISO country codes (e.g. US, GB, DE). Use ALL to target all countries. First country is used for session init.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "adActiveStatus": {
                        "title": "Ad Active Status",
                        "enum": [
                            "all",
                            "active",
                            "inactive"
                        ],
                        "type": "string",
                        "description": "Filter by active/inactive status.",
                        "default": "active"
                    },
                    "adType": {
                        "title": "Ad Type",
                        "enum": [
                            "ALL",
                            "POLITICAL_AND_ISSUE_ADS",
                            "HOUSING_ADS",
                            "EMPLOYMENT_ADS",
                            "CREDIT_ADS"
                        ],
                        "type": "string",
                        "description": "Type of ads to retrieve.",
                        "default": "ALL"
                    },
                    "searchType": {
                        "title": "Search Type",
                        "enum": [
                            "KEYWORD_UNORDERED",
                            "keyword_exact_phrase"
                        ],
                        "type": "string",
                        "description": "How to match the search query.",
                        "default": "KEYWORD_UNORDERED"
                    },
                    "period": {
                        "title": "Date Range",
                        "enum": [
                            "",
                            "last24h",
                            "last7d",
                            "last14d",
                            "last30d",
                            "last90d"
                        ],
                        "type": "string",
                        "description": "Search ads within a given date range. Overridden by explicit Start Date if provided."
                    },
                    "startDate": {
                        "title": "Start Date",
                        "type": "string",
                        "description": "Custom start date (YYYY-MM-DD). Overrides period if both are set."
                    },
                    "endDate": {
                        "title": "End Date",
                        "type": "string",
                        "description": "Custom end date (YYYY-MM-DD). Optional — defaults to today."
                    },
                    "sortBy": {
                        "title": "Sort Ads By",
                        "enum": [
                            "impressions_desc",
                            "most_recent"
                        ],
                        "type": "string",
                        "description": "Sort results by impressions or most recent.",
                        "default": "impressions_desc"
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Maximum number of ads to collect. Free users: max 100. Paid users: max 1,000,000."
                    },
                    "runTag": {
                        "title": "Run Tag",
                        "type": "string",
                        "description": "Add this value to a 'runTag' column in every output row. Useful for identifying runs."
                    },
                    "requestDelayMs": {
                        "title": "Request Delay (ms)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Delay between pagination requests in milliseconds.",
                        "default": 500
                    },
                    "proxyConfiguration": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "Proxy settings for reliable scraping. Disabled by default — enable if you get blocked or rate limited.",
                        "default": {}
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
