# Meta Ad Library (`deepmine/meta-ad-library-scraper`) Actor

Meta Ad Library scraper and API: search Facebook, Instagram, Messenger and Threads ads by keyword, advertiser or Ad Library link and country, and get one row per ad with text, headline, images, videos, landing page, button, dates and EU reach. No login.

- **URL**: https://apify.com/deepmine/meta-ad-library-scraper.md
- **Developed by:** [DeepMine](https://apify.com/deepmine) (community)
- **Categories:** Marketing, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.34 / 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

## Meta Ad Library

**Meta Ad Library scraper**: type a keyword, an advertiser or an Ad Library link, pick a country and get one row per ad from the Meta Ad Library (Facebook, Instagram, Messenger, Threads) with the ad text, headline, creative, button, landing page, dates and EU reach.

| Advertiser | Ad text | Headline | Button | Format | Started | Days active |
|---|---|---|---|---|---|---|
| Just Ingredients Shop | The easy part of your day | Just Ingredients Protein Powder | Shop now | Video | 2026-10-08 | 39 |
| ProDough Shop | ProDough Protein lets you make the best high prot… | Best Protein For Protein Yogurt | Shop now | Video | 2026-05-18 | 182 |
| Instacart | Shop Just Ingredients from your favorite stores—a… | Order Just Ingredients on Instacart | Shop now | Dynamic creative | 2026-10-13 | 34 |

<sub>Collected 2026-11-17 from a run with the prefilled search (`protein powder`, US, most impressions first; Meta counted 21,036 matching ads). Every row also has the creative's picture, the video file, the landing page and the ad's Ad Library link.</sub>

**$0.45 per 1,000 ads** on Starter ($0.55 Free, $0.39 Scale, $0.34 Business). The prefilled run (100 ads) costs about $0.05. Ad details are included at no extra cost. No Facebook account, no cookies, no browser.

### What you can do with it

- **Ad research**: see the active ads for "protein powder", "running shoes" or any product in any country, most impressions first.
- **Competitor research**: add your competitors' Facebook pages and get every ad they run, with the creative, text, landing page and how long each ad has been live.
- **Creative inspiration**: collect video and image links, hooks, headlines and buttons by niche and country. Ads that have run for a long time (*Days active*) are usually the ones that work.
- **EU reach data**: with *Include ad details*, ads shown in the EU or UK carry Meta's reach per country plus the targeted ages and gender, the payer and the beneficiary.

### Input

| Field | What it does |
|---|---|
| **Search terms** | Keywords, as in the Ad Library search box. One search per line. |
| **Advertisers** | A Facebook page link (`facebook.com/nike`), a page id (`15087023444`) or an advertiser's Ad Library link. |
| **Country** | Two-letter code where the ads ran (`US`, `GB`, `DE`, ...) or `ALL`. |
| **Max ads per search** | Stop each search after this many ads (30 in the form, up to 10,000). You pay per ad. |
| **Include ad details** | Adds the advertiser's profile and, for EU/UK ads, reach by country, ages and gender. Free; one more request per ad, so a little slower. |
| **Ad Library URLs** | Searches copied from [facebook.com/ads/library](https://www.facebook.com/ads/library/). The link's own filters are used. |
| **Sort, status, media, category, languages, platforms, dates** | The Ad Library's own filters: most impressions or most recent first, active or inactive ads, images or videos, political and issue ads, ad language, platforms, and the date range the ads were shown in. |

Example:

```json
{
  "searchQueries": ["protein powder"],
  "advertisers": ["https://www.facebook.com/nike/"],
  "country": "US",
  "maxAdsPerQuery": 100
}
```

### Output

One row per ad, the same ad once per run even when several searches find it. The first columns are the readable ones: advertiser, ad text, headline, button, format, platforms, start and last-shown dates, days active, the creative's image and video links, the landing page and the ad's Ad Library link. `totalCount` is Meta's count of ads matching the search. Every row then carries Meta's full record (`snapshot`, `publisherPlatform`, ...) under the names other Ad Library tools use, so an existing pipeline keeps working.

The run's summary (key-value store record `OUTPUT`) lists each search with the ads read, Meta's count and why it stopped.

Export the dataset as JSON, CSV or Excel from the Output tab, or read it through the Apify API.

### FAQ

**Do I need a Facebook account or cookies?** No. The Actor reads the public Ad Library, logged out.

**Why do some rows have `creativeHidden: true`?** Meta shows the creative of a few ads to logged-in viewers only. Their text, advertiser, dates and platforms are still in the row.

**Why do image and video links stop working after a while?** They are Meta's signed CDN links and expire after some days. Download the files you want to keep.

# Actor input Schema

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

Keywords to search ads for, as you'd type them in the Ad Library search box, a list of strings (one search per line in the form). Give at least one of searchQueries, advertisers or startUrls.

## `advertisers` (type: `array`):

Advertisers whose ads you want: a Facebook page link (facebook.com/nike), a page id, an Ad Library link of the advertiser, or the page name exactly as it shows on its ads.

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

Two-letter country code where the ads ran (US, GB, DE, ...), or ALL for every country (left out = ALL).

## `maxAdsPerQuery` (type: `integer`):

Stop each search, advertiser or URL after this many ads. You pay per ad, so this caps the cost of each search. Ads come in the order of Sort ads by. About 3 minutes per 1,000 ads.

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

Also fetch each ad's details: the advertiser's verification and Instagram account and followers and, for ads shown in the EU or UK, the reach, reach by country, targeted ages and gender, plus the payer and beneficiary (Meta's full details, with reach by age and gender, are in ad_details). Details are included in the ad price at no extra cost; each ad needs one more request, so runs are slower.

## `startUrls` (type: `array`):

Searches copied from facebook.com/ads/library in your browser. The filters in the link (country, active status, media type, dates) are used. A link to one ad (facebook.com/ads/library/?id=...) returns that ad.

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

`impressions` (default): top ads first, the ones with the most impressions, as the Ad Library sorts them; `recent`: most recent first (grouped by the month they started).

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

`active` (default): only active ads; `inactive`: only ads that stopped; `all`: both.

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

Only ads with this kind of media.

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

All ads, or only one of Meta's special categories: social issues, elections or politics (these carry spend and impressions ranges), housing, employment, or credit and financial products.

## `countries` (type: `array`):

Two-letter country codes (US, GB, DE, ...) to search all at once, instead of the one Country above. Each search covers all of them, and an ad shown in several of them is one row.

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

Only ads in these languages, as two-letter codes (en, es, de, fr, ...). Left empty: every language.

## `publisherPlatforms` (type: `array`):

Only ads shown on any of these platforms. Left empty: every platform.

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

Match the search terms as an exact phrase instead of any order.

## `dateFrom` (type: `string`):

Only ads that were shown on or after this date (YYYY-MM-DD), whatever day they started. This is the Ad Library's own date filter.

## `dateTo` (type: `string`):

Only ads that were shown on or before this date (YYYY-MM-DD).

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

Residential proxies are the default: Meta refuses most datacenter IPs past the first page of results, so an Apify Proxy setting without residential still reads the result pages over residential (at no cost to you). First pages, details and lookups use datacenter IPs first.

## Actor input object example

```json
{
  "searchQueries": [
    "protein powder"
  ],
  "country": "US",
  "maxAdsPerQuery": 100,
  "includeAdDetails": false,
  "sortBy": "impressions",
  "activeStatus": "active",
  "mediaType": "all",
  "adType": "all",
  "exactPhrase": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "searchQueries": [
        "protein powder"
    ],
    "country": "US",
    "maxAdsPerQuery": 100,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("deepmine/meta-ad-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": ["protein powder"],
    "country": "US",
    "maxAdsPerQuery": 100,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("deepmine/meta-ad-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 '{
  "searchQueries": [
    "protein powder"
  ],
  "country": "US",
  "maxAdsPerQuery": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call deepmine/meta-ad-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,deepmine/meta-ad-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/2XdFGYtrj10jMqObI/builds/ccbZLSoxapDuAS6KN/openapi.json
