# Meta Ad Library Scraper: Facebook and Instagram Ads (`arcadium/meta-ad-library`) Actor

Facebook and Instagram ads from the Meta Ad Library for a keyword or a page, $0.70 per 1,000 ads. Each row: advertiser, ad text, headline, button, landing page and domain, start date, days running and platforms.

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

## Pricing

from $0.70 / 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 Scraper: Facebook and Instagram Ads

Give it a keyword or a Facebook page id and it returns the ads Meta publishes in its public Ad Library as JSON: one row per ad with the advertiser, ad text, headline, button, landing page and domain, start date, days running and the platforms it runs on. $0.70 per 1,000 ads; you pay only for rows you get.

**Why this actor**

- Finds who is advertising a topic right now: search "webinar" in the US and get the advertisers with active Facebook and Instagram ads, how long each ad has run and where it points.
- Reads the public Ad Library like a visitor: no Facebook account, no login. The page runs in a real browser, the ads come from the page's own data.
- The first 30 ads per search load with the page; more are read 10 per page.
- Searches that cannot be read fully come back as free error rows with a code.

Built by Arcadium Data: public data, dated and agent-ready, never personal data.

### Use with AI agents

Returns the active ads for a keyword or a Facebook page: advertiser, ad copy, headline, button, landing page, start date, days running, platforms. Agents can call it through the Apify MCP server (`https://mcp.apify.com`, open source as `apify/actors-mcp-server`) as `arcadium/meta-ad-library`: the input schema is read from the actor, the result is a dataset of JSON rows.

Input example for "which US advertisers run ads for live webinars":

```json
{
  "searchTerms": ["webinar", "masterclass"],
  "country": "US",
  "activeStatus": "active",
  "maxAds": 100
}
```

Output example (one row, shortened):

```json
{
  "rowType": "ad",
  "adArchiveId": "9608115189220583",
  "adLibraryUrl": "https://www.facebook.com/ads/library/?id=9608115189220583",
  "pageId": "1234567890",
  "pageName": "Example College Planning",
  "pageUrl": "https://www.facebook.com/examplecollegeplanning/",
  "startDate": "2025-02-17",
  "endDate": null,
  "daysRunning": 634,
  "isActive": true,
  "platforms": ["facebook", "instagram", "audience_network", "messenger"],
  "body": "If you only received $5,500 in college aid...",
  "title": "Join The Webinar Now",
  "ctaText": "Learn more",
  "linkUrl": "https://go.example.com/invitation",
  "displayDomain": "go.example.com",
  "collationCount": 1,
  "searchTerm": "webinar",
  "country": "US",
  "scrapedAt": "2026-11-12T03:11:00.390Z"
}
```

### What you get

One row per ad (`rowType: "ad"`), or per group of identical creatives: Meta groups ads that share a creative, and `collationCount` says how many the group holds.

| Field | Meaning |
| --- | --- |
| `adArchiveId`, `adLibraryUrl` | Meta's id of the ad and its Ad Library page |
| `pageId`, `pageName`, `pageUrl` | The advertiser's Facebook page |
| `startDate`, `endDate`, `daysRunning`, `isActive` | When the ad started, stopped (null while it runs) and for how many days |
| `platforms` | facebook, instagram, messenger, audience_network, threads |
| `displayFormat` | IMAGE, VIDEO, CAROUSEL, DCO (dynamic creative) and others |
| `body`, `title`, `ctaText` | Ad text, headline and button |
| `linkUrl`, `displayDomain` | Landing page and the domain shown under the ad |
| `collationCount`, `collationId` | Size of Meta's group of identical creatives |
| `searchTerm`, `country`, `scrapedAt` | Which search found it, the country filter, when it was read |

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `searchTerms` | none | Keywords or phrases, one search each |
| `pageIds` | none | Facebook page ids: all ads of those pages |
| `country` | `US` | Two-letter code, or `ALL` |
| `activeStatus` | `active` | `active`, `inactive` or `all` |
| `mediaType` | `all` | `all`, `image`, `video`, `meme`, `image_and_meme`, `none` |
| `maxAds` | 50 | Ads per search term or page (up to 5,000) |
| `pageDelaySec` | 4 | Pause between result pages |
| `includeErrorRows` | true | Free row for a search that could not be read fully |
| `proxyConfiguration` | automatic | Your own proxy URLs replace the automatic proxies |

### Use from code

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("arcadium/meta-ad-library").call(run_input={
    "searchTerms": ["webinar", "masterclass"],
    "country": "US",
    "maxAds": 100,
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    if row.get("rowType") == "ad":
        print(row["pageName"], row["daysRunning"], row["linkUrl"])
```

JavaScript:

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

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('arcadium/meta-ad-library').call({ searchTerms: ['webinar'], maxAds: 60 });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
const advertisers = new Set(items.filter((r) => r.rowType === 'ad').map((r) => r.pageName));
console.log([...advertisers]);
```

### Pricing

You pay per row delivered, at the price of your Apify plan. Error rows and repeats are free.

| Apify plan | Ad, per 1,000 |
| --- | --- |
| Every plan | $0.70 |

Plus a one-off $0.04 per GB of memory when a run starts (the default run uses 2 GB, so $0.08).

Set a maximum cost per run in the Apify run options and the actor stops before it goes over.

### Use cases

- Lead lists of advertisers: companies that run active ads for webinars, masterclasses, courses or any other offer, with the landing page and how long they have been advertising.
- Competitor ad watch: the ads a competitor's Facebook page runs now, with copy, button and landing page.
- Market research: which advertisers and platforms dominate a topic in a country.
- Agency prospecting: advertisers that keep an ad running for months are paying for it to work.

### Limitations

- Only what the Ad Library shows without a login. Ads about social issues, elections and politics carry extra data that is not output.
- Impressions, spend and targeting are published by Meta for political and EU ads only; they are not output.
- The Ad Library is large (a search such as "webinar" counts over 23,000 ads). Meta limits how fast result pages are read, so a search for more than 30 ads takes about 5 to 8 seconds per 10 ads.
- A search for more than 30 ads reads the further pages through a residential proxy: Meta rate-limits datacenter addresses on those pages.
- Image and video links are not output; open `adLibraryUrl` to see the creative.
- If Meta shows a login wall or a CAPTCHA, the run stops that search, does nothing about it and reports it as a free `blocked` error row. Run again later.

### Privacy

The actor outputs what the Ad Library publishes about advertisers: the name and link of the Facebook page and the ad itself. Email addresses and phone numbers are removed from ad text. Page names of individuals are Meta's published page names; use them as business contacts only.

### FAQ

**How do I get only active ads?**
That is the default (`activeStatus: "active"`). Use `all` for stopped ads too.

**Why is `body` filled for a dynamic creative ad?**
Those ads hold template text such as `{{product.name}}` at the top level. The actor reads the text of the first card instead.

**How many ads can I get per search?**
Up to `maxAds` (5,000). The first 30 load with the page; each further 10 take one more request.

**Something looks wrong in the output. Who do I tell?**
Open an issue on the actor page with the run link. We read them all.

# Actor input Schema

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

Words or phrases to find in ads or advertiser names, for example "webinar" or "free masterclass". One per line.

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

Numeric ids of Facebook pages to list all ads of, for example 110727677915913. Optional, instead of or next to search terms.

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

Where the ads are shown, as a two-letter code such as US or GB, or ALL for every country.

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

active = ads running now (default), inactive = stopped ads, all = both.

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

Only ads with this kind of creative.

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

Maximum ads returned for each search term or page. The first 30 per search come cheaply; more are read page by page (10 per page) and use more traffic.

## `pageDelaySec` (type: `integer`):

Wait between result pages. Meta limits fast paging.

## `includeErrorRows` (type: `boolean`):

Add a free row for every search that could not be read fully (code and message).

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

Leave empty: the actor picks a proxy itself. Your own proxy URLs are used when given.

## Actor input object example

```json
{
  "searchTerms": [
    "webinar"
  ],
  "country": "US",
  "activeStatus": "active",
  "mediaType": "all",
  "maxAds": 50,
  "pageDelaySec": 4,
  "includeErrorRows": true
}
```

# Actor output Schema

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

All rows of this run in the default dataset.

## `record_stats` (type: `string`):

Requests, data volume, retries, per-input results and cost per result for this run.

## `view_overview` (type: `string`):

No description

## `view_errors` (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": [
        "webinar"
    ],
    "country": "US",
    "maxAds": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("arcadium/meta-ad-library").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": ["webinar"],
    "country": "US",
    "maxAds": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("arcadium/meta-ad-library").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": [
    "webinar"
  ],
  "country": "US",
  "maxAds": 50
}' |
apify call arcadium/meta-ad-library --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,arcadium/meta-ad-library"
        }
    }
}
```

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/ajRNAxloC1MJgBSV5/builds/17jSsdrENxAFzgCSn/openapi.json
