# Facebook Ads Library Scraper - Hard Limit, No Overcharge (`myceworks/facebook-ads-library-browser`) Actor

Scrape ads from the public Facebook Ad Library for any country, keyword or advertiser page: text, title, link, images, videos, platforms, dates. maxAds is a hard limit, filters run inside the Ad Library, and you never pay for more ads than you asked for.

- **URL**: https://apify.com/myceworks/facebook-ads-library-browser.md
- **Developed by:** [Gyuni](https://apify.com/myceworks) (community)
- **Categories:** Social media, Marketing, Lead generation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.75 / 1,000 ads

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

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

## Facebook Ads Library Scraper — Hard Limit, No Overcharge

Get ads from the public **Facebook Ad Library** (Facebook, Instagram, Messenger, Audience Network) for any country:

- Search by **keywords** (or exact phrase) or list all ads of an **advertiser page**
- Filter by **country**, **active / inactive**, **media type** and **start date** — the filters run inside the Ad Library
- Per ad: advertiser, text, title, link, CTA, images, videos, display format, platforms, start and end dates, page likes and categories

### Why this Actor

The most common complaint about Ad Library scrapers is the bill: "asked for 40 ads, got 5,505 and a $27 charge", "ignores the date range", "a free-plan test used my whole monthly credit".

| | Here |
|---|---|
| `maxAds` | A **hard limit**. The run stops at that number; you are never charged for more |
| Filters | Sent to the Ad Library itself, not applied after downloading everything |
| Proxy | Residential proxy is included in the price — no separate proxy bill |
| Empty search | Recognised from the Ad Library's own result count, ends in seconds and **charges nothing** |
| Run timeout | Stops 45 s before the timeout with everything collected so far |

### Input

```json
{
  "searchTerms": "air fryer",
  "country": "US",
  "activeStatus": "active",
  "mediaType": "all",
  "startDateMin": "2026-09-01",
  "maxAds": 200
}
```

Or paste a full Ad Library URL into `startUrl` to reuse filters you set on the website.

### Output (one item per ad)

| Field | Meaning |
|---|---|
| `adArchiveId`, `adLibraryUrl` | Ad ID and public link |
| `pageName`, `pageId`, `pageUrl`, `pageLikeCount`, `pageCategories` | Advertiser |
| `title`, `body`, `linkUrl`, `caption`, `ctaText` | Creative text and destination |
| `images`, `videos`, `displayFormat`, `cardCount` | Media (URLs) and format: IMAGE, VIDEO, CAROUSEL, DCO, DPA … |
| `isActive`, `startDate`, `endDate`, `platforms` | Delivery |
| `spend`, `reachEstimate`, `currency` | Filled by Facebook only for political/issue ads and some regions |

### Run summary

Each run writes a `SUMMARY` record to its key-value store: `matchingAdsReported` (the Ad Library's own "~N results" count), `adsReturned` and `maxAds`.

### Pricing

Pay per ad: one **ad-result** event per ad — **$2.50 per 1,000 ads** on the free plan, $2.25 (Starter), $2.00 (Scale), $1.75 (Business). Residential proxy is included. Apify adds its standard actor-start fee of $0.00005 per run. Never more than `maxAds`; searches with no ads cost nothing. The run stops when your spending limit is reached.

Tested on 7 searches in the US, UK, Germany, France and Spain: 7/7 returned 140–150 of 150 requested ads.

### Limits — read before you rely on it

- This Actor reads the public Ad Library website. Facebook can change it or block access at any time; when that happens the run ends without charging and we fix it.
- Spend and reach are shown by Facebook only for political and issue ads (and EU/UK reach on the website for some ads).
- Image and video URLs are signed by Facebook and expire after some time — download them soon if you need them.
- For EU/UK ads with official reach and targeting data, use the official Meta Ad Library API.

Not affiliated with, endorsed or sponsored by Meta Platforms, Inc. "Facebook", "Instagram" and "Meta" are trademarks of Meta Platforms, Inc., used here only to describe the public data source.

# Actor input Schema

## `searchTerms` (type: `string`):

Keywords as you would type them in the Ad Library search box.

## `exactPhrase` (type: `boolean`):

Match the search terms as one exact phrase.

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

All ads of one Facebook page (numeric ID). Use instead of search terms.

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

ISO code of the country the ads were shown in (US, GB, DE …) or ALL.

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

Only running ads, only stopped ads, or both.

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

All ads, or only political and issue ads.

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

Filter by creative type.

## `startDateMin` (type: `string`):

YYYY-MM-DD. Applied by the Ad Library itself.

## `startDateMax` (type: `string`):

YYYY-MM-DD.

## `startUrl` (type: `string`):

Paste a full facebook.com/ads/library URL with your filters instead of the fields above.

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

Hard limit. The run stops at this number and never charges more.

## `proxy` (type: `string`):

Facebook blocks most data-center IPs. Residential is the default and is included in the price.

## Actor input object example

```json
{
  "searchTerms": "air fryer",
  "exactPhrase": false,
  "country": "US",
  "activeStatus": "active",
  "adType": "all",
  "mediaType": "all",
  "maxAds": 100,
  "proxy": "RESIDENTIAL"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `full` (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": "air fryer"
};

// Run the Actor and wait for it to finish
const run = await client.actor("myceworks/facebook-ads-library-browser").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": "air fryer" }

# Run the Actor and wait for it to finish
run = client.actor("myceworks/facebook-ads-library-browser").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": "air fryer"
}' |
apify call myceworks/facebook-ads-library-browser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,myceworks/facebook-ads-library-browser"
        }
    }
}
```

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/cLaeyOsdoyEG83bZA/builds/P9YfuQOqxQ8glrbJm/openapi.json
