# Facebook Ads Library Scraper: Meta Ad Spy Tool (`rbbscrap/facebook-ads-scraper`) Actor

Scrape Meta & Instagram ads from Facebook Ad Library. Extract ad copy, video & image creatives, carousel cards, CTA links, EU spend, reach and running-days. 256MB RAM & sub-second speed.

- **URL**: https://apify.com/rbbscrap/facebook-ads-scraper.md
- **Developed by:** [Hector](https://apify.com/rbbscrap) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 scraped facebook 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

<p align="center">
  <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/y0h5Xh4ZLYL8d8YO7-actor-wMl1edJXbfHfNgbrt-VjQMCbmCrT-fast-facebook-ads-scraper.png" width="110" height="110" style="border-radius: 24px;" alt="Facebook Ads Library Scraper: Meta Ad Spy Tool Official Logo" />
</p>

## Facebook Ads Library Scraper: Meta Ad Spy Tool

**Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** extracts structured Facebook Ads Library Scraper: Meta Ad Spy Tool records, metadata, metrics, and direct links in real time. Built on a zero-browser HTTP/2 engine running in **256 MB RAM**, it delivers normalized datasets with **zero `null` fields** ready for **CSV, Excel, JSON**, or API pipelines.

> **Looking for related scrapers?** Check out [Facebook Marketplace](https://apify.com/rbbscrap/facebook-marketplace-scraper), [Facebook Scraper](https://apify.com/rbbscrap/facebook-pages-posts-scraper), [Reddit Scraper](https://apify.com/rbbscrap/reddit-scraper), [LinkedIn Jobs Scraper](https://apify.com/rbbscrap/linkedin-jobs-scraper), or browse our [full catalog of 118+ dedicated scrapers](https://apify.com/rbbscrap).

***

### What does Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper do?

Scrape Meta & Instagram ads from Facebook Ad Library. Extract ad copy, video & image creatives, carousel cards, CTA links, EU spend, reach and running-days. 256MB RAM & sub-second speed.

Whether you need to monitor Facebook Ads Library Scraper: Meta Ad Spy Tool at scale, enrich B2B/B2C databases, or feed structured records into analytics and AI workflows, **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** handles pagination, field normalization, and schema validation automatically:

- **Bulk Data Extraction:** Collect Facebook Ads Library Scraper: Meta Ad Spy Tool listings, items, and detailed attributes in batches using keywords, filters, or direct URLs.
- **Complete Public Metadata:** Capture identifiers, pricing/engagement metrics, author/vendor details, timestamps, and canonical URLs.
- **Multi-Format Export:** Download results in **JSON, CSV, Excel (XLSX), XML, or HTML Table** directly from the Apify Console.
- **Ready for Automation & AI:** Connect seamlessly to [Apify Integrations](https://apify.com/integrations) (Make, Zapier, n8n, Google Sheets), [REST API endpoints](https://apify.com/rbbscrap/facebook-ads-scraper/api), or the [Apify MCP Server](https://apify.com/rbbscrap/facebook-ads-scraper/api/mcp).

#### Beyond the Official Facebook Ads Library Scraper: Meta Ad Spy Tool API

- **No API Keys or Approval Delays:** Start extracting public Facebook Ads Library Scraper: Meta Ad Spy Tool data immediately without registering developer apps or waiting for quota approvals.
- **No Restrictive Rate Quotas:** Bypass strict per-minute API limits and expensive enterprise tiers while capturing the complete public data points displayed on Facebook Ads Library Scraper: Meta Ad Spy Tool.
- **256 MB Zero-Browser Architecture:** Uses native HTTP/2 and TLS session emulation instead of heavy Chromium instances, executing in seconds at a fraction of standard compute costs.

***

### What data can you scrape from Facebook Ads Library Scraper: Meta Ad Spy Tool?

**Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** extracts the following data points from Facebook Ads Library Scraper: Meta Ad Spy Tool:

<table>
<tr>
<td>📝 <b>Search Terms</b> (<code>searchTerms</code>)</td>
<td>📍 <b>Country</b> (<code>country</code>)</td>
<td>📅 <b>Active Status</b> (<code>activeStatus</code>)</td>
</tr>
<tr>
<td>📅 <b>Media Type</b> (<code>mediaType</code>)</td>
<td>🆔 <b>Ad Archive ID</b> (<code>adArchiveID</code>)</td>
<td>🆔 <b>Page ID</b> (<code>pageId</code>)</td>
</tr>
<tr>
<td>📝 <b>Page Name</b> (<code>pageName</code>)</td>
<td>📝 <b>Ad Title</b> (<code>adTitle</code>)</td>
<td>📝 <b>Ad Body</b> (<code>adBody</code>)</td>
</tr>
<tr>
<td>💰 <b>Caption</b> (<code>caption</code>)</td>
<td>📅 <b>Cta Text</b> (<code>ctaText</code>)</td>
<td>📅 <b>Cta Type</b> (<code>ctaType</code>)</td>
</tr>
</table>

| Data Category | Extracted Fields & Data Points |
| :--- | :--- |
| **Identity & Core Identifiers** | `adArchiveID` (Ad Archive ID), `pageId` (Page ID), `pageName` (Page Name), `adTitle` (Ad Title) |
| **Metrics, Pricing & Engagement** | `country` (Country), `caption` (Caption), `winner_score` (Winner Score) |
| **Details, Attributes & Context** | `searchTerms` (Search Terms), `adBody` (Ad Body), `isActive` (Is Active), `days_active` (Days Active) |
| **Direct Links, Media & Timestamps** | `activeStatus` (Active Status), `mediaType` (Media Type), `ctaText` (Cta Text), `ctaType` (Cta Type), `targetUrl` (Target URL), `startDate` (Start Date) |

***

### Why scrape Facebook Ads Library Scraper: Meta Ad Spy Tool? (Typical Use Cases & Guides)

You can use **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** for a wide range of data and business workflows:

- **Competitive & Market Intelligence:** Track real-time listings, rankings, pricing shifts, and activity across Facebook Ads Library Scraper: Meta Ad Spy Tool without manual copy-pasting.
- **B2B Lead Generation & CRM Enrichment:** Extract structured Facebook Ads Library Scraper: Meta Ad Spy Tool records to enrich pipelines in HubSpot, Salesforce, Clay, Pipedrive, or Airtable.
- **Trend Detection & Sentiment Monitoring:** Analyze volume velocity, user ratings, and community feedback on Facebook Ads Library Scraper: Meta Ad Spy Tool to spot market opportunities early.
- **AI Agents, RAG & LLM Knowledge Pipelines:** Feed normalized, zero-null Facebook Ads Library Scraper: Meta Ad Spy Tool datasets directly into vector databases, autonomous AI agents, and LLM workflows.
- **Automated Reporting & Scheduled Monitoring:** Connect Facebook Ads Library Scraper: Meta Ad Spy Tool to Make.com, n8n, Zapier, or Google Sheets for hands-free daily data refreshes.
- **[Market Research & Competitor Analysis](https://apify.com/use-cases/market-research):** Benchmark Facebook Ads Library Scraper: Meta Ad Spy Tool offerings, pricing strategies, and market share across regions.
- **[Lead Generation & CRM Enrichment](https://blog.apify.com/marketing-leads-scraping-with-apify/):** Build targeted prospect lists and sync verified records straight into HubSpot, Salesforce, or Clay.
- **[AI Agents & RAG Pipelines via MCP](https://blog.apify.com/how-to-use-mcp/):** Connect live Facebook Ads Library Scraper: Meta Ad Spy Tool data directly to Claude Desktop, Cursor, or LangChain agents.

***

### How to scrape Facebook Ads Library Scraper: Meta Ad Spy Tool data

**Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** is designed for a zero-configuration start, even if you have never scraped data before:

1. [Create a free Apify account](https://console.apify.com/sign-up) using your email (includes **$5.00 in free monthly credits**).
2. Open **[Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper](https://apify.com/rbbscrap/facebook-ads-scraper)** and click on the **[Input tab](https://apify.com/rbbscrap/facebook-ads-scraper/input)** — all required fields are already pre-filled with a working example.
3. Enter your search terms, target URLs, or filter criteria (or keep the default pre-filled configuration for an instant 1-Click test).
4. Click the green **"Start"** button and wait a few seconds for the data to be extracted.
5. Download your dataset in **JSON, CSV, Excel (XLSX), or HTML**, or fetch it via the [API tab](https://apify.com/rbbscrap/facebook-ads-scraper/api).

> For more technical details on every parameter, check out the [Input Schema tab](https://apify.com/rbbscrap/facebook-ads-scraper/input-schema) or read the [Apify Platform Documentation](https://docs.apify.com/platform/actors/running).

#### 🔗 How to scrape Facebook Ads Library Scraper: Meta Ad Spy Tool by Search Term or Direct URL

<table>
<tr>
<td><b>Scraping by Search Term / Filter 🔑</b></td>
<td>Enter keywords, categories, or filter parameters just as you would search on Facebook Ads Library Scraper: Meta Ad Spy Tool. Set the maximum number of items you want to extract and click <b>Start</b>.</td>
</tr>
<tr>
<td><b>Scraping by Direct URL 🔗</b></td>
<td>Paste one or more direct Facebook Ads Library Scraper: Meta Ad Spy Tool links (or import a list of URLs from a Google Sheet / CSV) to extract targeted item or profile details in bulk.</td>
</tr>
</table>

***

### ⬇️ Input Configuration & Examples

To start scraping Facebook Ads Library Scraper: Meta Ad Spy Tool, fill in the visual input form in the Apify Console or pass a JSON payload via the API. Full technical specifications are available on the [Input Schema tab](https://apify.com/rbbscrap/facebook-ads-scraper/input-schema).

#### Input Parameters Reference

| Parameter | Type | Default / Prefill | Description |
| :--- | :---: | :---: | :--- |
| `urls` | `array` | — | List of Meta Ad Library URLs or Facebook page ad URLs. Supports search results URLs, page URLs, and filtered URLs. |
| `searchTerms` | `array` | `["Nike"]` | Keywords to search in ad text (e.g. 'nike', 'fitness', 'skincare', 'dropshipping'). |
| `pageId` | `string` | — | View all ads from a specific Facebook page. Extract the page ID from the page URL or About section. |
| `country` | `string` | `ALL` | ISO 2-letter country code (US, FR, GB, DE, etc.). Use 'ALL' for worldwide. Options: `ALL`, `US`, `FR`, `GB`, `DE`, `CA`. |
| `activeStatus` | `string` | `all` | Filter by active, inactive, or all ads. Options: `all`, `active`, `inactive`. |
| `mediaType` | `string` | `all` | Filter by media type: all, image, video, or meme. Options: `all`, `image`, `video`, `meme`. |
| `contentLanguages` | `array` | — | Filter ads by language (ISO 639-1 codes, e.g. \['en', 'fr']). Leave empty for all languages. |
| `sortMode` | `string` | `relevance` | Sort order for results (relevance, total impressions, or start date). Options: `relevance`, `total_impressions`, `start_date`. |
| `sortDirection` | `string` | `desc` | Sort ascending or descending. Options: `desc`, `asc`. |
| `maxResults` | `integer` | `50` | Maximum number of ads to extract per search query or URL. |
| `enrichAds` | `boolean` | `true` | Add CTA detection, ad category (ecommerce/lead_gen/app_install), running duration, hashtag count, word count, and a winner_score (0-100) flagging proven performers by longevity + variants + active status. |
| `proxyConfiguration` | `object` | `{"useApifyProxy":true,"apifyProxyGr...` | Apify Proxy configuration. Residential proxy is strongly recommended to bypass Meta's rate limits and anti-bot challenges. |

#### Example 1: Standard Extraction (1-Click Default)

```json
{
  "searchTerms": [
    "Nike"
  ],
  "country": "ALL",
  "activeStatus": "all",
  "mediaType": "all"
}
```

#### Example 2: Filtered & Batch Extraction

```json
{
  "searchTerms": [
    "Nike"
  ],
  "country": "US",
  "activeStatus": "active",
  "mediaType": "image",
  "sortMode": "total_impressions",
  "sortDirection": "asc",
  "maxResults": 100,
  "enrichAds": true
}
```

***

### ⬆️ Output Example (Table View, JSON & Fields Reference)

The scraped results are stored in a structured Apify Dataset available in the **Storage** tab. Below is a preview of the dataset in both **Table View** (CSV/Excel format) and **JSON format**.

#### Table View (CSV / Excel Dataset Preview)

| Search Terms | Country | Active Status | Media Type |
| :--- | :--- | :--- | :--- |
| `Nike` | `ALL` | `all` | `all` |
| `Nike` | `ALL` | `all` | `all` |
| `Nike` | `ALL` | `all` | `all` |

#### JSON Output Example

```json
{
  "searchTerms": [
    "Nike"
  ],
  "country": "ALL",
  "activeStatus": "all",
  "mediaType": "all"
}
```

#### Output Fields Reference

| Field Name | Type | Description |
| :--- | :---: | :--- |
| `searchTerms` | `array` | Extracted search terms value. |
| `country` | `string` | Extracted country value. |
| `activeStatus` | `string` | Extracted active status value. |
| `mediaType` | `string` | Extracted media type value. |
| `adArchiveID` | `string` | Unique Meta Ad Library archive ID |
| `pageId` | `string` | Facebook Page ID |
| `pageName` | `string` | Advertiser brand name |
| `adTitle` | `string` | Headline of the ad |
| `adBody` | `string` | Primary ad text copy |
| `caption` | `string` | Display link caption |
| `ctaText` | `string` | Call to action button label |
| `ctaType` | `string` | CTA type code |
| `targetUrl` | `string` | Destination landing page URL |
| `startDate` | `string` | Ad start date |
| `isActive` | `boolean` | Whether the ad is currently active |
| `publisherPlatforms` | `array` | Platforms (Facebook, Instagram, etc.) |
| `images` | `array` | Ad creative image URLs |
| `videoUrls` | `array` | Ad creative video URLs |
| `winner_score` | `number / integer` | Longevity and performance score (0-100) |
| `days_active` | `number / integer` | Number of consecutive active days |

***

### 🔗 Scrape any data you need with dedicated scrapers

Combine **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** with our other dedicated scrapers from [@RBBscrap](https://apify.com/rbbscrap) if you want to extract specialized data across platforms:

<table>
<tr>
<td>🔹 <a href="https://apify.com/rbbscrap/facebook-marketplace-scraper"><b>Facebook Marketplace</b></a></td>
<td>🔹 <a href="https://apify.com/rbbscrap/facebook-pages-posts-scraper"><b>Facebook Scraper</b></a></td>
<td>🔹 <a href="https://apify.com/rbbscrap/reddit-scraper"><b>Reddit Scraper</b></a></td>
</tr>
<tr>
<td>🔹 <a href="https://apify.com/rbbscrap/linkedin-jobs-scraper"><b>LinkedIn Jobs Scraper</b></a></td>
<td>🔹 <a href="https://apify.com/rbbscrap/google-autocomplete-keyword-scraper"><b>Google Autocomplete & SEO Scraper</b></a></td>
<td>🔹 <a href="https://apify.com/rbbscrap/hacker-news-scraper"><b>Hacker News Scraper</b></a></td>
</tr>
</table>

| Scraper | Extracted Data & Primary Use Case |
| :--- | :--- |
| **[Facebook Marketplace](https://apify.com/rbbscrap/facebook-marketplace-scraper)** | Listings & Prices |
| **[Facebook Scraper](https://apify.com/rbbscrap/facebook-pages-posts-scraper)** | Pages, Groups & Posts |
| **[Reddit Scraper](https://apify.com/rbbscrap/reddit-scraper)** | Posts, Comments & Subreddits |
| **[LinkedIn Jobs Scraper](https://apify.com/rbbscrap/linkedin-jobs-scraper)** | B2B Leads & Salaries |
| **[Google Autocomplete & SEO Scraper](https://apify.com/rbbscrap/google-autocomplete-keyword-scraper)** | Search Ideas |
| **[Hacker News Scraper](https://apify.com/rbbscrap/hacker-news-scraper)** | Stories, Comments & News |

***

### ⚠️ Error Items & Resilience Reference

**Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** is engineered to process multi-query and batch runs resiliently without crashing if a single query or URL fails:

| Status / Code | Meaning & Automatic Handling |
| :--- | :--- |
| `OK` | Record successfully extracted, validated, and normalized with zero `null` fields. |
| `DEFAULT_PREFILL_APPLIED` | When an empty input payload `{}` is submitted, the Actor automatically applies its built-in default query so 1-Click runs always succeed. |
| `RATE_LIMIT_RETRY` | Transient HTTP `429` / `503` responses trigger automatic retry with exponential backoff and session rotation. |
| `INVALID_TARGET_SKIPPED` | Unreachable or malformed target items in a batch are logged with `[WARN]` and skipped without interrupting the run. |

***

### ❓ Frequently Asked Questions (FAQ)

#### How much does scraping Facebook Ads Library Scraper: Meta Ad Spy Tool cost?

**Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** uses transparent **Pay-Per-Event (`PAY_PER_EVENT`)** pricing set **5x cheaper than the market leader** ($\div 5$):

- **Event Rate:** **$0.001** per *Scraped Facebook Ads Library Scraper Record* (**Scraped Facebook Ads Library Scraper Record.00 per 1,000 items**).
- **🎁 1st Run 100% FREE:** Your very first execution is **100% free** (`$0.00` event charges are applied on your initial run).
- **Apify Free Plan ($5.00/month included):** Every Apify account receives **$5.00 in free monthly credits**, which is enough to extract up to **~5,000 items per month for free**.
- View full details on the [Pricing tab](https://apify.com/rbbscrap/facebook-ads-scraper/pricing) and the [Apify Pricing page](https://apify.com/pricing).

#### Can I integrate Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper with Make, Zapier, n8n, or Google Sheets?

Yes. **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** can be connected with almost any cloud service or web app thanks to [integrations on the Apify platform](https://apify.com/integrations), including [Make](https://docs.apify.com/platform/integrations/make), [Zapier](https://docs.apify.com/platform/integrations/zapier), [n8n](https://docs.apify.com/platform/integrations/n8n), [Slack](https://docs.apify.com/platform/integrations/slack), [Airbyte](https://docs.apify.com/platform/integrations/airbyte), [Google Sheets](https://docs.apify.com/platform/integrations/google-sheets), [Google Drive](https://docs.apify.com/platform/integrations/drive), and [webhooks](https://docs.apify.com/platform/integrations/webhooks).

#### Can I use Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper with the Apify API (Python & Node.js)?

Yes. The Apify API gives you programmatic access to run **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper**, schedule jobs, and fetch datasets. Use the `apify-client` [PyPI package](https://apify.com/rbbscrap/facebook-ads-scraper/api/python) for Python or the `apify-client` [NPM package](https://apify.com/rbbscrap/facebook-ads-scraper/api/javascript) for Node.js, or check the [Apify API Reference](https://docs.apify.com/api/v2):

**Python (`apify-client`)**

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")

run = client.actor("rbbscrap/facebook-ads-scraper").call(run_input={
    "searchTerms": ["Nike"],
    "country": "ALL",
    "activeStatus": "all",
    "mediaType": "all"
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**Node.js (`apify-client`)**

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

const client = new ApifyClient({ token: 'YOUR_APIFY_API_TOKEN' });

const run = await client.actor('rbbscrap/facebook-ads-scraper').call({
    searchTerms: ["Nike"],
    country: "ALL",
    activeStatus: "all",
    mediaType: "all"
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Can I use Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper through an MCP Server (Claude Desktop, Cursor, AI Agents)?

Yes. With the Apify API, you can use **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** in conjunction with an MCP server to connect directly to **Claude Desktop, Cursor, Windsurf, or LibreChat**. Read the official guide on [how to set up Apify Actors with MCP](https://blog.apify.com/how-to-use-mcp/), or go to the [MCP tab](https://apify.com/rbbscrap/facebook-ads-scraper/api/mcp):

1. Start a Server-Sent Events (SSE) session to receive a `sessionId`.
2. Send API messages using that `sessionId` to trigger **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** with your input parameters.
3. Receive structured Facebook Ads Library Scraper: Meta Ad Spy Tool dataset records directly inside your AI agent conversation.

#### Do I need residential proxies or login cookies to scrape Facebook Ads Library Scraper: Meta Ad Spy Tool?

No. **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper** operates on a zero-browser HTTP/2 protocol engine (256 MB RAM) and works out-of-the-box without requiring login cookies or external proxies for standard workloads. For high-volume enterprise runs, you can optionally use [Apify Proxy](https://docs.apify.com/proxy) in the input configuration.

#### Is it legal to scrape data from Facebook Ads Library Scraper: Meta Ad Spy Tool?

Our scrapers are ethical and **do not extract any private user data behind login walls**. They only extract what is shared publicly on the web. However, please keep in mind that personal data is protected by **GDPR ([EU Regulation 2016/679](https://eur-lex.europa.eu/eli/reg/2016/679/oj))** and other regulations worldwide. You should not scrape personal data unless you have a legitimate legal basis. Read more in Apify's guide on the [legality of web scraping](https://blog.apify.com/is-web-scraping-legal/).

#### Your feedback & support

We are continuously improving the performance of our Actors. If you have any technical feedback for **Facebook Ads Library Scraper: Meta Ad Spy Tool Scraper**, need a custom feature, or found a bug, please create an issue on the Actor's [Issues tab](https://apify.com/rbbscrap/facebook-ads-scraper/issues/open) in the Apify Console.

# Actor input Schema

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

List of Meta Ad Library URLs or Facebook page ad URLs. Supports search results URLs, page URLs, and filtered URLs.

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

Keywords to search in ad text (e.g. 'nike', 'fitness', 'skincare', 'dropshipping').

## `pageId` (type: `string`):

View all ads from a specific Facebook page. Extract the page ID from the page URL or About section.

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

ISO 2-letter country code (US, FR, GB, DE, etc.). Use 'ALL' for worldwide.

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

Filter by active, inactive, or all ads.

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

Filter by media type: all, image, video, or meme.

## `contentLanguages` (type: `array`):

Filter ads by language (ISO 639-1 codes, e.g. \['en', 'fr']). Leave empty for all languages.

## `sortMode` (type: `string`):

Sort order for results (relevance, total impressions, or start date).

## `sortDirection` (type: `string`):

Sort ascending or descending.

## `maxResults` (type: `integer`):

Maximum number of ads to extract per search query or URL.

## `enrichAds` (type: `boolean`):

Add CTA detection, ad category (ecommerce/lead_gen/app_install), running duration, hashtag count, word count, and a winner_score (0-100) flagging proven performers by longevity + variants + active status.

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

Apify Proxy configuration. Residential proxy is strongly recommended to bypass Meta's rate limits and anti-bot challenges.

## `maxExecutionTimeSecs` (type: `integer`):

Fail-Fast safety ceiling timeout in seconds (15 to 90s). Prevents long-running runs from wasting compute units.

## Actor input object example

```json
{
  "searchTerms": [
    "Nike"
  ],
  "country": "ALL",
  "activeStatus": "all",
  "mediaType": "all",
  "sortMode": "relevance",
  "sortDirection": "desc",
  "maxResults": 50,
  "enrichAds": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxExecutionTimeSecs": 75
}
```

# 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": [
        "Nike"
    ],
    "country": "ALL",
    "activeStatus": "all",
    "mediaType": "all",
    "sortMode": "relevance",
    "sortDirection": "desc",
    "maxResults": 50,
    "enrichAds": true,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    },
    "maxExecutionTimeSecs": 75
};

// Run the Actor and wait for it to finish
const run = await client.actor("rbbscrap/facebook-ads-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": ["Nike"],
    "country": "ALL",
    "activeStatus": "all",
    "mediaType": "all",
    "sortMode": "relevance",
    "sortDirection": "desc",
    "maxResults": 50,
    "enrichAds": True,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
    "maxExecutionTimeSecs": 75,
}

# Run the Actor and wait for it to finish
run = client.actor("rbbscrap/facebook-ads-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": [
    "Nike"
  ],
  "country": "ALL",
  "activeStatus": "all",
  "mediaType": "all",
  "sortMode": "relevance",
  "sortDirection": "desc",
  "maxResults": 50,
  "enrichAds": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxExecutionTimeSecs": 75
}' |
apify call rbbscrap/facebook-ads-scraper --silent --output-dataset

```

## MCP server setup

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