# Facebook Ad Library Scraper (`spectre_scrape/facebook-ads-library-scraper`) Actor

Scrapes Meta Ad Library via internal APIs -> no browser, no slow crawling. Competitor ad intelligence at $1/1k results.

- **URL**: https://apify.com/spectre\_scrape/facebook-ads-library-scraper.md
- **Developed by:** [Spectre](https://apify.com/spectre_scrape) (community)
- **Categories:** E-commerce, Social media, Lead generation
- **Stats:** 3 total users, 2 monthly users, 80.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.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.

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

## Facebook Ad Library Scraper

Scrape ads from Meta's Ad Library at scale. Search by keyword, filter by country, or pull every ad running on a specific Facebook page. This actor hits Meta's internal GraphQL APIs directly, so there's no login, no cookies, and no browser automation overhead. Feed the output into your competitive research workflow, ad monitoring dashboard, or automation pipeline.

### Who is this for?

**Media buyers and performance marketers** doing competitor research. See what creatives your competitors are running, how long they've been active, and which platforms they target (Facebook, Instagram, Audience Network).

**Marketing agencies** automating weekly ad intelligence reports. Schedule runs on Apify, export to CSV or JSON, and pipe the data straight into your client dashboards.

**Developers and automation builders** (n8n, Make, Zapier) who need Facebook ad data programmatically. Trigger runs via API, process results in your pipeline, and build alerting systems around competitor ad launches.

### How to use it

#### Scraping search results

1. Go to [Meta Ad Library](https://www.facebook.com/ads/library/) and run a search.
2. Copy the full URL from your browser's address bar.
3. Open [Facebook Ad Library Scraper](https://apify.com/spectre_scrape/facebook-ads-library-scraper) on Apify.
4. Paste the URL into the **Input URLs / Keywords** field.
5. Set your **Max ads** limit and pick a **Proxy** (datacenter works for most cases).
6. Click **Start**.
7. When the run finishes, click **Export** to download your data as JSON, CSV, or Excel.

#### Scraping a specific Facebook page

Paste the Facebook page URL directly into the input field. The scraper will extract all ads currently running (or previously run) by that page.

#### Input options

| Field | Description | Default |
| :--- | :--- | :--- |
| Input URLs / Keywords | Ad Library search URLs or Facebook page URLs | — |
| Max ads to scrape | Cap on total ads extracted. Leave empty for all. | 100 |
| Deep Scrape | Extract EU transparency data, spend estimates, and reach (slower) | Off |
| Active status | Filter: all, active, or inactive | all |
| Country | 2-letter ISO code (e.g. US, IN, GB) or ALL for global | ALL |
| Proxy configuration | Datacenter recommended. Use residential if blocked. | Datacenter |

### Why this scraper?

- **No login or cookies required.** Works out of the box.
- **Hits Meta's internal APIs directly.** Fast extraction, no brittle DOM scraping.
- **Search results and page-level scraping.** Two input modes, one actor.
- **Deep Scrape mode.** Optionally pull EU transparency fields, spend estimates, and reach data.
- **JSON, CSV, Excel export.** One click in the Apify console.
- **Proxy support built in.** Datacenter and residential proxy rotation handled automatically.
- **Scheduled runs.** Set it and forget it. Apify handles cron-style scheduling natively.

### Data fields

The scraper extracts these fields for each ad:

| Field | Field | Field |
| :--- | :--- | :--- |
| Ad ID | Ad Archive ID | Archive Types |
| Categories | Contains Digitally Created Media | Collation Count |
| Collation ID | Currency | End Date |
| Entity Type | Gated Type | Has User Reported |
| Hidden Safety Data | Hide Data Status | Impressions With Index |
| Is AAA Eligible | Is Active | Is Profile Page |
| Page ID | Page Name | Political Countries |
| Reach Estimate | Report Count | Snapshot (creatives, CTA, links, cards) |
| Spend | Start Date | State Media Run Label |
| Publisher Platform | Menu Items | Advertiser |
| Insights | AAA Info | |

### Sample output

```json
[
  {
    "ad_archive_id": "975498021164030",
    "collation_count": 1,
    "collation_id": "390607310753339",
    "is_active": false,
    "page_id": "104542139222761",
    "page_name": "Book More Showings",
    "snapshot": {
      "page_id": "104542139222761",
      "page_profile_uri": "https://www.facebook.com/bookmoreshowings/",
      "page_name": "Book More Showings",
      "caption": "WWW.BOOKMORESHOWINGS.COM",
      "cta_text": "Learn more",
      "cards": [
        {
          "body": "🚀 Ready to Transform Your Business?\nAgents are closing $100K+ GCI annually with BMS...",
          "cta_text": "Learn More",
          "link_url": "https://www.bookmoreshowings.com/learn",
          "title": "🔥 Agents Closing $100K GCI Use BMS. Be Next!"
        }
      ],
      "display_format": "DCO"
    },
    "publisher_platform": [
      "FACEBOOK",
      "INSTAGRAM",
      "AUDIENCE_NETWORK"
    ],
    "start_date_formatted": "2025-02-03 08:00:00",
    "end_date_formatted": "2025-07-15 07:00:00",
    "ad_library_url": "https://www.facebook.com/ads/library/?id=975498021164030"
  }
]
````

### API access

Trigger runs programmatically and retrieve results via the Apify API. Works with any HTTP client, cURL, or SDK.

```bash
curl --request POST \
  --url https://api.apify.com/v2/acts/spectre_scrape~facebook-ads-library-scraper/runs?token=YOUR_TOKEN \
  --header 'Content-Type: application/json' \
  --data '{
    "searchQueries": ["marketing"],
    "maxAds": 100,
    "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
  }'
```

Fetch results after the run completes:

```bash
curl --request GET \
  --url https://api.apify.com/v2/acts/LcR8loRYD3Rx1bFET/runs/last/dataset/items?token=YOUR_TOKEN
```

Full API docs: [Apify API reference](https://docs.apify.com/api/v2)

### Integrations

Connect this scraper to your existing stack:

- **Make (Integromat)** and **Zapier**: Use the Apify integration to trigger runs and process results automatically.
- **n8n**: Use the HTTP Request node or the Apify node to build custom workflows.
- **Google Sheets**: Export results directly from the Apify console.
- **Slack / Email**: Set up Apify webhooks to get notified when a run finishes.

### Pricing

This actor costs **$1.00 per 1,000 results** in Apify usage credits. Deep Scrape mode uses more credits due to additional API requests per ad. You can scrape up to 25,000 ads per month on the Apify Starter plan.

### Is it legal to scrape the Facebook Ad Library?

Meta's Ad Library is a public transparency tool. This scraper does not extract private user data. It only collects information that Meta has made publicly available. That said, your results may contain personal data (advertiser names, page info). Personal data is protected by GDPR in the EU and by similar regulations elsewhere. If you're unsure whether your use case is compliant, consult a lawyer.

### Feedback

Found a bug or have a feature request? Open an issue on the actor's **Issues** tab in the Apify Console. We read every report.

***

**Try it free on Apify. No credit card required for the first run.**

👉 [Launch Facebook Ad Library Scraper](https://apify.com/spectre_scrape/facebook-ads-library-scraper)

***

**Keywords**: facebook ads scraper, meta ads scraper, facebook ads library scraper, scrape facebook ads, competitor ad analysis, facebook ad intelligence, instagram ads scraper, meta ads API, ad creative scraper, facebook page ads

# Actor input Schema

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

Enter Facebook Ad Library search URLs or Facebook Page URLs.

## `maxAds` (type: `integer`):

Limit the total number of ads extracted. Leave empty to scrape all.

## `deepScrape` (type: `boolean`):

Enable to extract EU transparency, spend estimates, and reach. Slower as it makes an extra request per ad.

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

Filter ads by active status.

## `countryCode` (type: `string`):

2-letter ISO country code (e.g. US, IN, GB). Use ALL for global.

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

DATACENTER is recommended for cost efficiency. Use RESIDENTIAL only if blocked by Meta.

## Actor input object example

```json
{
  "searchQueries": [
    "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&q=marketing&search_type=keyword_unordered"
  ],
  "maxAds": 100,
  "deepScrape": false,
  "activeStatus": "all",
  "countryCode": "ALL",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "DATACENTER"
    ]
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

List of Ads scraped from Facebook

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

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

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQueries": [
        "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&q=marketing&search_type=keyword_unordered"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "DATACENTER"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("spectre_scrape/facebook-ads-library-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQueries": ["https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&q=marketing&search_type=keyword_unordered"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["DATACENTER"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("spectre_scrape/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 '{
  "searchQueries": [
    "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&q=marketing&search_type=keyword_unordered"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "DATACENTER"
    ]
  }
}' |
apify call spectre_scrape/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Ad Library Scraper",
        "description": "Scrapes Meta Ad Library via internal APIs -> no browser, no slow crawling. Competitor ad intelligence at $1/1k results.",
        "version": "0.1",
        "x-build-id": "lbLQWrdQpeoG4ZZ85"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/spectre_scrape~facebook-ads-library-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-spectre_scrape-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/spectre_scrape~facebook-ads-library-scraper/runs": {
            "post": {
                "operationId": "runs-sync-spectre_scrape-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/spectre_scrape~facebook-ads-library-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-spectre_scrape-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",
                "required": [
                    "searchQueries"
                ],
                "properties": {
                    "searchQueries": {
                        "title": "Input URLs / Keywords",
                        "type": "array",
                        "description": "Enter Facebook Ad Library search URLs or Facebook Page URLs.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxAds": {
                        "title": "Max ads to scrape",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Limit the total number of ads extracted. Leave empty to scrape all.",
                        "default": 100
                    },
                    "deepScrape": {
                        "title": "Scrape ad details (Deep Scrape)",
                        "type": "boolean",
                        "description": "Enable to extract EU transparency, spend estimates, and reach. Slower as it makes an extra request per ad.",
                        "default": false
                    },
                    "activeStatus": {
                        "title": "Active status",
                        "enum": [
                            "all",
                            "active",
                            "inactive"
                        ],
                        "type": "string",
                        "description": "Filter ads by active status.",
                        "default": "all"
                    },
                    "countryCode": {
                        "title": "Country",
                        "type": "string",
                        "description": "2-letter ISO country code (e.g. US, IN, GB). Use ALL for global.",
                        "default": "ALL"
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "DATACENTER is recommended for cost efficiency. Use RESIDENTIAL only if blocked by Meta."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
