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

Extract ads from the Meta Ad Library across Facebook, Instagram, and more. Get creatives, copy, CTAs, platforms, and activity dates for competitor research.

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

## Pricing

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

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## Facebook Ads Library Scraper

Extract public advertising data from the Meta Ad Library. Scrape ads from Facebook Page URLs or Ad Library search URLs across Facebook, Instagram, and other Meta publisher platforms.

### ✨ Key Features

- 📢 Scrape ads from **Facebook Pages** or **Meta Ad Library** URLs
- 📱 Publisher platforms: Facebook, Instagram, WhatsApp, Threads, Audience Network, and more
- ✍️ Ad copy, titles, CTAs, landing links, and creative cards
- 🖼️ Images, videos, and carousel creatives when available
- ✅ Filter by **active / inactive**, date range, and sort order
- 🏢 Optional **About** info and per-ad detail enrichment
- 🔢 Optional **count-only** mode for total ads per page
- 📋 Structured JSON output, streamed while the run is in progress

### 💪 Why Choose This Actor?

- **Focused**: Meta Ad Library ads without product-page enrichment add-ons
- **Flexible**: Page URLs or pre-filtered Ad Library search URLs
- **Structured**: Renamed, integration-friendly field names
- **Practical**: Built for competitor monitoring and creative research

### 🎯 Perfect For

- 🕵️ Competitor ad monitoring
- 🎨 Creative and messaging research
- 🌍 Platform / country campaign analysis
- 🤖 Enrichment pipelines and automation

### 📝 Input Requirements

- `sourceUrls` (required): Facebook Page URLs and/or Meta Ad Library URLs
- `maxAdsPerUrl` (optional): Max ads per URL (default `50`)
- `adStatus` (optional): `all`, `active`, or `inactive`
- `sortBy` (optional): `default`, `impressions`, or `recent`
- `activeAfter` / `activeBefore` (optional): Date filters
- `countOnly` / `includeAboutInfo` / `includeAdDetails` (optional)

#### Input Example

```json
{
  "sourceUrls": [
    "https://www.facebook.com/SHEINOFFICIAL"
  ],
  "maxAdsPerUrl": 50,
  "adStatus": "active",
  "sortBy": "impressions"
}
```

#### Output Example

```json
{
  "pageName": "SHEIN",
  "archiveId": "1229350099285014",
  "isActive": true,
  "title": "Summer sale starts now",
  "body": "Shop the latest drops…",
  "ctaLabel": "Shop now",
  "landingUrl": "https://www.shein.com/",
  "platforms": ["FACEBOOK", "INSTAGRAM"],
  "startedAt": "2026-03-16T07:00:00.000Z",
  "endedAt": "2026-07-09T07:00:00.000Z",
  "scrapedAt": "2026-08-04T06:00:00.000Z"
}
```

### 🚀 How to Use

1. Add one or more Facebook Page or Ad Library URLs
2. Optionally set status, sort, date range, and detail options
3. Click **Start**
4. Download results as JSON, CSV, Excel, or HTML

### 📌 Notes

- Filters already present in an Ad Library URL override matching input fields
- Results may appear only after the upstream run finishes collecting ads
- This actor does **not** follow landing pages for product/price enrichment

# Actor input Schema

## `sourceUrls` (type: `array`):

Facebook Page URLs and/or Meta Ad Library URLs (brand page or filtered search). Filters already set in an Ad Library URL take priority over the fields below.

## `maxAdsPerUrl` (type: `integer`):

Maximum number of ads to collect for each source URL. Ignored when Count only is enabled.

## `countOnly` (type: `boolean`):

Return only the total number of ads per page instead of scraping individual ads.

## `includeAboutInfo` (type: `boolean`):

Extract Ad Library About-tab details such as business address, admin countries, and page history.

## `includeAdDetails` (type: `boolean`):

Open each ad’s detail view for richer advertiser info, spend signals, and EU reach/audience fields when available.

## `adStatus` (type: `string`):

Filter by active/inactive. Ignored if the Ad Library URL already sets active\_status.

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

Default, impressions high→low, or most recent. Ignored if the Ad Library URL already sets sorting.

## `activeAfter` (type: `string`):

Only ads active on or after this date. Use YYYY-MM-DD or a relative value such as 1 day / 2 months.

## `activeBefore` (type: `string`):

Only ads active on or before this date. Use YYYY-MM-DD or a relative value such as 1 day / 2 months.

## Actor input object example

```json
{
  "sourceUrls": [
    "https://www.facebook.com/SHEINOFFICIAL"
  ],
  "maxAdsPerUrl": 50,
  "countOnly": false,
  "includeAboutInfo": false,
  "includeAdDetails": false,
  "adStatus": "all",
  "sortBy": "default"
}
```

# 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 = {
    "sourceUrls": [
        "https://www.facebook.com/SHEINOFFICIAL"
    ],
    "maxAdsPerUrl": 50,
    "countOnly": false,
    "includeAboutInfo": false,
    "includeAdDetails": false,
    "adStatus": "all",
    "sortBy": "default"
};

// Run the Actor and wait for it to finish
const run = await client.actor("easyapi/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 = {
    "sourceUrls": ["https://www.facebook.com/SHEINOFFICIAL"],
    "maxAdsPerUrl": 50,
    "countOnly": False,
    "includeAboutInfo": False,
    "includeAdDetails": False,
    "adStatus": "all",
    "sortBy": "default",
}

# Run the Actor and wait for it to finish
run = client.actor("easyapi/facebook-ads-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 '{
  "sourceUrls": [
    "https://www.facebook.com/SHEINOFFICIAL"
  ],
  "maxAdsPerUrl": 50,
  "countOnly": false,
  "includeAboutInfo": false,
  "includeAdDetails": false,
  "adStatus": "all",
  "sortBy": "default"
}' |
apify call easyapi/facebook-ads-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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