# Facebook Ad Library Scraper | $0.50 per 1,000 ads (`v0iddo/facebook-ads-library-scraper`) Actor

Collect public ads from the Meta Ad Library by keyword, advertiser Page ID or Ad Library link: ad text, headline, landing page, button, images and videos, dates, platforms and version count, plus spend and reach ranges where Meta publishes them. Not affiliated with Meta.

- **URL**: https://apify.com/v0iddo/facebook-ads-library-scraper.md
- **Developed by:** [vøiddo](https://apify.com/v0iddo) (community)
- **Categories:** Marketing, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 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/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 Ad Library Scraper | $0.50 per 1,000 ads

Collect public ads from the Meta Ad Library by keyword, advertiser Page ID or Ad Library link: ad text, headline, landing page, button, images and videos, dates, platforms and version count, plus spend and reach ranges where Meta publishes them. Not affiliated with Meta.

- Pay per result row: the platform usage of the run is included, and a run that finds nothing has no result charges.
- No login, no cookies, no account on the Meta Ad Library: public pages only.
- Export to JSON, CSV, Excel, XML or HTML, or read the rows through the Apify API.
- Start it from the Console, on a schedule, through the API, or as a tool for agents over MCP.
- Tested every day on its example input, with the rows checked, and repaired when a check fails.

### What you can use it for

- Competitor ad research: every active ad of a brand's Page, with text, headline, button and landing page.
- Creative inspiration: collect ads for a keyword with their images, videos and format.
- Ad longevity: start and end dates show which ads a brand keeps running, a sign that they work.
- Agency reporting: snapshot the ads of a client's rivals on a schedule.

### What you get

Every result is one row in the run's dataset. Download it as JSON, CSV, Excel or HTML, or read it through the Apify API. The main fields:

| Field | Meaning |
|---|---|
| `adArchiveId` | Ad ID |
| `pageName` | Advertiser |
| `isActive` | Active |
| `startDate` | Started |
| `endDate` | Ended |
| `platforms` | Platforms |
| `body` | Ad text |
| `title` | Headline |
| `ctaText` | Button |
| `linkUrl` | Landing page |
| `displayFormat` | Format |
| `imageUrls` | Images |
| `adLibraryUrl` | Ad Library link |

Example row:

```json
{
  "adArchiveId": "1000000000000001",
  "adLibraryUrl": "https://www.facebook.com/ads/library/?id=1000000000000001",
  "pageId": "100000000000001",
  "pageName": "Example Outdoor Supply",
  "pageProfileUrl": "https://www.facebook.com/exampleoutdoorsupply/",
  "pageCategories": [
    "Sporting Goods Store"
  ],
  "pageLikeCount": 125000,
  "isActive": true,
  "startDate": "2026-09-14",
  "endDate": null,
  "platforms": [
    "facebook",
    "instagram"
  ],
  "body": "Trail season is here. Free shipping on every order this week.",
  "title": "Shop the trail collection",
  "linkUrl": "https://www.example.com/trail",
  "linkDescription": "Boots, packs and layers",
  "ctaText": "Shop now",
  "displayFormat": "IMAGE",
  "imageUrls": [
    "https://scontent.example.net/v/t39/trail-1.jpg"
  ],
  "videoUrls": [],
  "collationCount": 3,
  "collationId": "2000000000000001",
  "currency": null,
  "impressionsText": null,
  "impressionsLower": null,
  "impressionsUpper": null,
  "spendLower": null,
  "spendUpper": null,
  "reachEstimate": null,
  "disclaimer": null,
  "targetedCountries": [],
  "demographics": [],
  "searchedFor": "example outdoor",
  "searchCountry": "US"
}
```

### How to use it

1. Open the **Input** tab (or call the actor through the API, see below).
2. Fill in **Search terms**, **Country**, **Ad status**; the form opens with a working example.
3. Set **Maximum results** to cap the size and the cost of the run.
4. Click **Start**. Rows appear on the **Output** tab while the run works.
5. Download the dataset, or connect it to Google Sheets, Make, Zapier, n8n or a webhook.

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `searchTerms` | array | no | Words to search the Ad Library for, for example a brand or product name. One per line. Each term is one search; a run reads at most 25 searches (terms, Page IDs and links together). |
| `pageIds` | array | no | Numeric Facebook Page IDs of advertisers whose ads you want, one per line. Each ID is one search. The ID is the number after view_all_page_id= in an Ad Library link of that advertiser. |
| `adLibraryUrls` | array | no | Optional search links copied from the browser, such as https://www.facebook.com/ads/library/?active_status=active\&ad_type=all\&country=US\&q=nike\&search_type=keyword_unordered. A link keeps its own filters. Only Ad Library search links work. Each link is one search. |
| `country` | string | no | Where the ads were shown: a two-letter country code such as US, GB or DE, or ALL for every country. Used for search terms and Page IDs. Default: `"US"`. |
| `activeStatus` | select | no | Which ads to return: ads that are running now, ads that stopped, or both. Allowed: active, inactive, all. Default: `"active"`. |
| `adType` | select | no | Ad category in the Ad Library. Political and issue ads come with spend and impressions ranges. Allowed: all, political_and_issue_ads, housing_ads, employment_ads, credit_ads. Default: `"all"`. |
| `mediaType` | select | no | Only ads that contain this kind of media. Allowed: all, image, video, meme, none. Default: `"all"`. |
| `startDateMin` | string | no | Optional. Only ads that started running on or after this date, as YYYY-MM-DD. |
| `startDateMax` | string | no | Optional. Only ads that started running on or before this date, as YYYY-MM-DD. |
| `maxAdsPerSearch` | integer | no | The most ads to read for each search term, Page ID or link. The Ad Library shows about 30 ads first and about 10 more each time the page loads more. At most 1000. Default: `100`. |
| `maxItems` | integer | no | The run stops after this many result rows. It also caps what one run can cost. Default: `100`. |
| `proxyConfiguration` | object | no | Leave as is: the run starts on the cheapest network the site accepts and switches to Apify Proxy automatically when the site blocks it. Pick proxy groups here only to force one specific network. |

Example input:

```json
{
  "searchTerms": [
    "nike"
  ],
  "country": "US",
  "activeStatus": "active",
  "maxItems": 20
}
```

### Pricing

You pay per result row in the dataset (the current price per 1,000 results is on the Pricing tab). A run that finds nothing produces no rows and no result charges. Set **Maximum results** to cap what a single run can cost.

### Limits and notes

- Reads the public Meta Ad Library only (facebook.com/ads/library). It opens the Ad Library page in a real browser, as a visitor who is not logged in, and scrolls down so the page loads more ads. No login and no account cookies are used.
- If Meta shows a login, verification or CAPTCHA page instead of the Ad Library, the run stops and says so; it never tries to get around that.
- Not affiliated with Meta. The data is what the public Ad Library shows to a visitor who is not logged in.
- The Ad Library shows about 30 ads first and about 10 more each time the page is scrolled, so large searches take a few minutes. Each search term, Page ID or link is read up to Ads per search (at most 1000), and a run reads at most 25 searches. Ads that appear in several searches are returned once.
- Version count (collationCount) is how many copies of the same ad Meta groups together. The end date is empty for ads that still run.
- Spend, impressions and reach ranges, the country list and audience splits are filled only for ads where the Ad Library publishes them (political and issue ads, and some ads shown in the EU). For all other ads they are empty.
- Dynamic catalog ads can show placeholders such as {{product.name}} where Meta fills in a product at delivery time.
- The Paid for by disclaimer is the label Meta prints on political and issue ads. It can name the payer.
- Image and video links are temporary Meta CDN links. The actor does not download the files; download them soon if you need them.
- Ad text is returned as the advertiser wrote it, with e-mail addresses and phone numbers removed. Apart from the advertiser (Page) name and the Paid for by label, no names are published as fields. Nothing about the people who saw or reacted to an ad is collected.
- Some ad categories (housing, employment, credit) exist only for certain countries; other countries return nothing for them.
- Only publicly visible data is collected. No login, no paywalled content, no personal contact details.
- Sites change their pages from time to time. The actor is checked automatically and repaired when a check fails.
- Each run sends one short usage record to the developer: the Actor and run IDs, the number of results, whether the run succeeded (and if not, the kind of error, such as "blocked" or "input problem"), whether the account is on a paid Apify plan, how the run was started (for example from the Console, the API or a schedule) and a one-way fingerprint of the account (a hash, not the account ID), so that repeat runs of one account count once. It contains nothing from your input or results.

### Run it through the API

Python, with the `apify-client` package:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("v0iddo/facebook-ads-library-scraper").call(run_input={"searchTerms": ["nike"], "country": "US", "activeStatus": "active", "maxItems": 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

JavaScript, with the `apify-client` package:

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

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('v0iddo/facebook-ads-library-scraper').call({"searchTerms": ["nike"], "country": "US", "activeStatus": "active", "maxItems": 20});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

One HTTP call that waits for the run and returns the rows (for runs that finish within 5 minutes):

```bash
curl -X POST "https://api.apify.com/v2/acts/v0iddo~facebook-ads-library-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"searchTerms": ["nike"], "country": "US", "activeStatus": "active", "maxItems": 20}'
```

### Use it from an agent (MCP)

Claude, Cursor, VS Code and other MCP clients can call this actor as a tool through the Apify MCP server. Add it to the client's MCP configuration:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=v0iddo/facebook-ads-library-scraper",
      "headers": {
        "Authorization": "Bearer <YOUR_APIFY_TOKEN>"
      }
    }
  }
}
```

Then ask, for example: "Show the active ads of this brand in the Meta Ad Library with their text and landing pages."

### FAQ

#### Do I need an account on the Meta Ad Library, cookies or an API key?

No. The actor reads only what every visitor of the Meta Ad Library can see, without logging in. You only need an Apify account to start it.

#### How many results can one run return?

Up to 5,000 rows per run. Without a limit it stops at 100. Set **Maximum results** to the number you need; large jobs can also be split into several runs or scheduled.

#### How am I charged?

Per result row in the dataset, at the price on the Pricing tab for your Apify plan. The platform usage of the run is included in that price. A run that finds nothing produces no rows and no result charges, and your spending limit for a run is always respected.

#### Why did my run return no results?

The status message of the run says why: nothing matched the input, the input was not a page the actor understands, or the site refused every network the actor tried. Check the input against the example above and run it again with a small limit.

#### Can I run it on a schedule?

Yes. Save your input as a task and add a schedule in the Apify Console (daily, hourly or with a cron expression). Each run gets its own dataset, so you keep a history.

#### Which formats can I export?

JSON, CSV, Excel, XML, HTML table and RSS from the Output tab or the API. Integrations send the rows to Google Sheets, Slack, Make, Zapier, n8n or a webhook.

#### Is collecting this data allowed?

The actor collects only what the Meta Ad Library publishes to every visitor, without a login. Public data can still be personal data under laws such as the GDPR, and sites have their own terms: make sure your use of the data follows the rules that apply to you.

#### What happens when the Meta Ad Library changes its pages?

Automated tests run the actor every day on the example input and check the rows, not only that the run finished. When a check fails, the actor is repaired and rebuilt; the build history on this page shows each update.

#### Something is missing or wrong. Where do I report it?

Open an issue on the Issues tab of this actor with the run link. Requests for a new field are welcome too.

# Actor input Schema

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

Words to search the Ad Library for, for example a brand or product name. One per line. Each term is one search; a run reads at most 25 searches (terms, Page IDs and links together).

## `pageIds` (type: `array`):

Numeric Facebook Page IDs of advertisers whose ads you want, one per line. Each ID is one search. The ID is the number after view_all_page_id= in an Ad Library link of that advertiser.

## `adLibraryUrls` (type: `array`):

Optional search links copied from the browser, such as https://www.facebook.com/ads/library/?active_status=active\&ad_type=all\&country=US\&q=nike\&search_type=keyword_unordered. A link keeps its own filters. Only Ad Library search links work. Each link is one search.

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

Where the ads were shown: a two-letter country code such as US, GB or DE, or ALL for every country. Used for search terms and Page IDs.

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

Which ads to return: ads that are running now, ads that stopped, or both.

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

Ad category in the Ad Library. Political and issue ads come with spend and impressions ranges.

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

Only ads that contain this kind of media.

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

Optional. Only ads that started running on or after this date, as YYYY-MM-DD.

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

Optional. Only ads that started running on or before this date, as YYYY-MM-DD.

## `maxAdsPerSearch` (type: `integer`):

The most ads to read for each search term, Page ID or link. The Ad Library shows about 30 ads first and about 10 more each time the page loads more. At most 1000.

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

The run stops after this many result rows. It also caps what one run can cost.

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

Leave as is: the run starts on the cheapest network the site accepts and switches to Apify Proxy automatically when the site blocks it. Pick proxy groups here only to force one specific network.

## Actor input object example

```json
{
  "searchTerms": [
    "nike"
  ],
  "country": "US",
  "activeStatus": "active",
  "adType": "all",
  "mediaType": "all",
  "maxAdsPerSearch": 100,
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

One dataset row per processed item.

# 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": "US",
    "activeStatus": "active",
    "maxItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("v0iddo/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 = {
    "searchTerms": ["nike"],
    "country": "US",
    "activeStatus": "active",
    "maxItems": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("v0iddo/facebook-ads-library-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": "US",
  "activeStatus": "active",
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call v0iddo/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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