# Meta Ad Library Scraper — no token, with creatives (`bovi/meta-ad-library-scraper`) Actor

Scrape public Meta Ad Library ads. Get advertiser, creative, delivery, and media fields. Run with searchTerms or pageIds; scrape mode needs no Meta login or token. Pricing: $0.0016 per result event on Free, plus $0.00005 per Actor Start event.

- **URL**: https://apify.com/bovi/meta-ad-library-scraper.md
- **Developed by:** [Vitalii Bondarev](https://apify.com/bovi) (community)
- **Features:** Limited permissions
- **Stats:** 4 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.55 / 1,000 meta ad library scraper — no token, with creatives

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

Extract public Facebook and Instagram Ad Library ads: copy, advertisers, delivery, exposed metrics, and creative image and video URLs. `scrape` mode needs no Meta login or access token, but cloud runs need a residential proxy (Apify `RESIDENTIAL` is the default); `official` mode uses your own access token from an ID-verified Meta developer account. Each result costs $0.0016 on the Free plan (full table in Pricing).

- Audit competitor creatives, messaging, landing URLs, and calls to action.
- Review political and issue ad spend, impressions, and reach where Meta exposes them.
- Download available creative images and videos to the run's key-value store.
- Monitor duration and parsing quality with `days_active`, `longevity_score`, and `parse_confidence`.

### What you get

Missing scalar values are `null`; missing arrays are empty. Fields are grouped by mode.

**Both modes**

| Fields | Type | What it contains |
| --- | --- | --- |
| `ad_id`, `page_id`, `page_name` | string | Ad and advertiser identifiers |
| `body`, `link_description` | string | Ad text and link description |
| `platforms` | array of strings | Placements |
| `start_date`, `is_active`, `currency` | string, boolean, string | Start date, active flag, currency (can be empty) |
| `days_active` | integer | Active days; `null` when neither Meta's active time nor a start date is available |
| `longevity_score` | number | Normalized score from 0 to 1; `null` when `days_active` is `null` |
| `spend_lower`, `spend_upper`, `spend_midpoint`, `impressions_lower`, `impressions_upper`, `impressions_midpoint` | number | Meta ranges and midpoints; `null` when not exposed |

**`scrape` mode only**

| Fields | Type | What it contains |
| --- | --- | --- |
| `page_profile_uri` | string | Advertiser profile link |
| `page_like_count` | integer | Page likes; `null` when unavailable |
| `page_categories` | array of strings | Page categories |
| `title`, `caption`, `link_url`, `cta_text`, `cta_type`, `display_format` | string | Copy, destination, call to action, and format |
| `card_count` | integer | Carousel card count; `0` when none |
| `media_images`, `media_videos` | array of strings | Direct Meta CDN URLs |
| `downloaded_images`, `downloaded_videos` | array of strings | Key-value-store URLs when `downloadMedia` is enabled and files are available |
| `end_date` | ISO 8601 string | End date; `null` when unavailable |
| `total_active_time` | number | Active time as reported by Meta; `null` when not returned |
| `reach_estimate`, `has_metrics` | number, boolean | Reach and whether metric values are available |
| `targeted_or_reached_countries` | array of strings | Country data |
| `contains_digital_created_media` | boolean | Digital-media indicator returned by Meta |
| `regional_regulation_data` | object | Regional transparency data; `null` when not returned |
| `query`, `query_type`, `country` | string | Query source, query type, and country |
| `parse_confidence` | number | Parsing confidence from 0 to 1 |

**`official` mode only**

| Fields | Type | What it contains |
| --- | --- | --- |
| `headline`, `link_caption`, `snapshot_url` | string | Official API creative fields and snapshot URL |
| `bodies_all` | array of strings | All official API body values |
| `stop_date`, `languages` | string, array | Stop date and ad languages |
| `audience_size_lower`, `audience_size_upper`, `eu_total_reach` | integer | Audience ranges and EU total reach |
| `demographic_distribution`, `delivery_by_region`, `beneficiary_payers`, `target_locations` | array | Distributions, payers and declared locations |
| `target_ages`, `target_gender` | string | Declared targeting |

### Sample output

Shortened `scrape` mode sample: `body`, `total_active_time`, `targeted_or_reached_countries`, `contains_digital_created_media` and `regional_regulation_data` are omitted, `link_description` is shown as `null`, and the signed CDN URL is trimmed.

```json
{
  "ad_id": "1046730950862281", "page_id": "146705838515566", "page_name": "Sukeban World",
  "page_profile_uri": "https://www.facebook.com/61551864263186/", "page_like_count": 427,
  "page_categories": ["Sports league"],
  "title": null, "caption": "instagram.com", "link_description": null,
  "link_url": "http://instagram.com/sukeban_world", "cta_text": "Visit Instagram profile",
  "cta_type": "VIEW_INSTAGRAM_PROFILE", "display_format": "VIDEO",
  "media_images": [],
  "media_videos": ["https://video-iad3-1.xx.fbcdn.net/o1/v/t2/f2/m86/example.mp4?_nc_cat=104&oe=..."],
  "card_count": 0, "platforms": ["INSTAGRAM"],
  "start_date": "2025-07-09", "end_date": "2025-11-21", "is_active": false,
  "days_active": 135, "longevity_score": 1,
  "currency": "", "spend_lower": null, "spend_upper": null, "spend_midpoint": null,
  "impressions_lower": null, "impressions_upper": null, "impressions_midpoint": null,
  "reach_estimate": null, "has_metrics": false, "parse_confidence": 1,
  "query": "nike", "query_type": "term", "country": "US"
}
```

### Pricing

Billing is pay per event. `apify-actor-start` is charged when the Actor starts, with one event per GB of run memory and a minimum of one event. `apify-default-dataset-item` is one scraped result with all fields. This Actor does not use Pay per event + usage, so compute, proxy traffic, and storage are not billed separately.

| Plan | `apify-actor-start` | `apify-default-dataset-item` |
|---|---:|---:|
| Free | $0.00005 | $0.0016 |
| Bronze | $0.0000495 | $0.001584 |
| Silver | $0.000049 | $0.001568 |
| Gold | $0.0000485 | $0.001552 |
| Platinum | $0.0000485 | $0.001552 |
| Diamond | $0.0000485 | $0.001552 |

Prices are per event on the plan named in the row.

Examples on the Free plan, each with one Actor Start event:

- 100 results: 100 x $0.0016 = $0.16, plus $0.00005 start = $0.16005 on Free.
- 1,000 results: 1,000 x $0.0016 = $1.60, plus $0.00005 start = $1.60005 on Free.
- 10,000 results: 10,000 x $0.0016 = $16.00, plus $0.00005 start = $16.00005 on Free.

The $5 monthly credit on the Free plan covers 31 full 100-result runs (3,100 results).

The event `ad-scraped` has no price, so you are not charged for it.

### How to use

1. **Open** the Actor in Apify Console and click Start.
2. **Choose** `scrape` for public token-free access, or `official` with your own token from an ID-verified Meta developer account.
3. **Enter** `searchTerms`, `pageIds`, or both; set countries and filters as needed (`matchType`, `docId`, `downloadMedia` and the proxy apply to `scrape` mode only).
4. **Configure** a residential proxy for cloud runs in `scrape` mode (the proxy setting is used by `scrape` mode only); the default Apify proxy uses `RESIDENTIAL`.
5. **Set** `maxAds` and `pageSize` to control result volume and streaming batches.
6. **Enable** `downloadMedia` (`scrape` mode only) to save available files to the run's key-value store.
7. **Review** `parse_confidence` and the log, then repeat through Apify Schedules if you want to track new ads over time.

```json
{
  "mode": "scrape",
  "searchTerms": ["nike"],
  "countries": ["US"],
  "adType": "all",
  "activeStatus": "all",
  "mediaType": "all",
  "maxAds": 3,
  "proxyConfiguration": {"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}
}
```

Export the dataset as JSON or CSV, or read it through the Apify dataset API.

### Input parameters

| Parameter | What it does | Default |
|---|---|---|
| `mode` | Selects token-free `scrape` or official Graph API mode | `scrape` |
| `searchTerms` | Searches each supplied keyword or phrase | None; provide `searchTerms` and/or `pageIds` |
| `countries` | Two-letter country codes to search | `["US"]` |
| `adType` | Selects `all` or `political_and_issue_ads` | `all` |
| `activeStatus` | Filters `all`, `active`, or `inactive` ads | `all` |
| `mediaType` | `scrape` mode only: keeps `all`, `image`, `video`, `meme`, or `none` | `all` |
| `maxAds` | Caps results. In `scrape` mode the cap applies per query and per country job; in `official` mode it applies per query across the countries. When unset, each scrape job stops at the pagination ceiling of 200 pages (about 6,000 ads) or when Meta returns no further cursor, and every result is billed | Unset |
| `pageSize` | Controls ads pushed in each streaming batch; minimum `1`, maximum `100` | `25` |
| `matchType` | `scrape` mode only: uses `broad` word matching or `exact` phrase matching | `broad` |
| `downloadMedia` | `scrape` mode only: downloads media to the run key-value store and returns URLs | `false` |
| `docId` | `scrape` mode only: sets Meta’s persisted-query ID for scrape pagination | Built-in default |
| `proxyConfiguration` | `scrape` mode only: configures the cloud-scraping proxy | Apify `RESIDENTIAL` proxy |
| `accessToken` | Supplies the Meta Graph API token in official mode | None; required in official mode |
| `pageIds` | Looks up ads from advertiser page IDs in either mode | None |
| `apiVersion` | Selects the official Graph API version | `v23.0` |

### Limits and edge cases

| Condition | What the buyer sees | What to do |
|---|---|---|
| Cloud `scrape` mode lacks a suitable proxy | Meta may block the Ad Library; a warning may be logged and no ads returned | Use a high-quality residential or mobile proxy |
| A scrape job is blocked | It is retried on a fresh proxy IP up to three attempts; pushed batches remain and the log says `Gave up on ... after 3 attempts` | Provide a reliable residential or mobile proxy and retry |
| No ads are returned for the whole run | The log reports a possible block or rotated `docId` | Try a residential proxy and refresh `docId` |
| Meta changes the response structure | The log warns that output may be incomplete | Check the warning and refresh `docId` if rotated |
| Direct media URLs are used without downloading | Meta CDN links expire (per the `downloadMedia` input description) | Enable `downloadMedia` and use the storage URLs |
| Commercial ads do not expose spend or impressions | Metric fields are often `null` | Use returned values; choose `political_and_issue_ads` for ads carrying those metrics |
| `official` mode lacks `accessToken` | The run fails because an ID-verified Meta developer account token is required | Supply your own Meta access token |
| Official mode is used for commercial ads | Metadata is returned without spend, impressions, demographics, or media URLs | Use `scrape` mode for creative media and richer fields |
| The official API rate-limits a query | The limit is logged and processing continues to the next query; pushed batches remain | Retry later or reduce volume |
| A batch reaches `pageSize` or a job ends | Accumulated rows are pushed to the dataset | Read the dataset after the run |
| A run is aborted, times out, or fails after rows are pushed | Pushed rows remain; rows in the current in-memory batch are not pushed | Start another run for remaining results |

### FAQ

#### How much does it cost to scrape the Meta Ad Library?

See Pricing: 100 results cost $0.16005 on the Free plan.

#### Why did my run return zero ads?

In `scrape` mode, zero results can indicate a block or rotated `docId`. Check the log, use a residential proxy, refresh `docId`, and provide `searchTerms` or `pageIds`.

#### Why is my Meta Ad Library scrape not working in the cloud?

Meta can block datacenter IPs and flag shared or low-reputation residential pools. Configure a high-quality residential or mobile proxy. If `parse_confidence` is low, review the warning and consider refreshing `docId`.

#### Why use this instead of the official Meta Ad Library API?

`scrape` mode needs no Meta developer account or access token and can return creative image and video URLs with richer inline data. `official` mode uses the Graph API, requires your own token from an ID-verified Meta developer account, and returns metadata without media URLs for commercial ads.

#### Is scraping public Meta Ad Library data legal or allowed?

This Actor uses public, logged-out Ad Library data and does not require Facebook login or authentication-gated access. Whether use is legal or allowed depends on Meta's terms and applicable law for your use case.

### Related actors

- [Meta Ads Library Spy](https://apify.com/bovi/meta-ads-library-scraper) — related Meta ad-library research.
- [Ad Creative-Angle Analyzer](https://apify.com/bovi/ad-creative-angle-analyzer) — related CTA, offer, hook, and trigger analysis.
- [TikTok Ads Library Scraper](https://apify.com/bovi/tiktok-ads-library-scraper) — related TikTok ad-library extraction.

# Actor input Schema

## `mode` (type: `string`):

scrape = token-free (no Meta account needed, richer data incl. media; needs a residential proxy on cloud). official = uses the official Graph API with your own access token (rock-solid metadata, requires an ID-verified token).

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

Keywords to search ads for. Each term runs as a separate query.

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

Two-letter country codes. Each is searched separately. Default: US.

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

all = commercial + everything; political_and_issue_ads = only political/issue ads (which carry spend & impressions).

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

Filter ads by whether they are currently running.

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

Filter by creative format. 'all' keeps everything.

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

Cap results per query. Leave empty for as many as pagination yields.

## `pageSize` (type: `integer`):

How many ads to push per batch (real-time output).

## `matchType` (type: `string`):

broad = ads containing the words in any order; exact = the exact phrase. Applies to search-term queries.

## `downloadMedia` (type: `boolean`):

Download the image/video creative files to this run's key-value store and return permanent URLs (Meta's CDN links expire). Extra compute.

## `docId` (type: `string`):

Meta's persisted-query id for the Ad Library pagination query. Rotates ~monthly; leave empty to use the built-in default. Set it to recover instantly if Meta rotates it before we update the actor.

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

REQUIRED for token-free scraping on the cloud — Meta blocks datacenter IPs. Use a RESIDENTIAL group.

## `accessToken` (type: `string`):

Only for mode='official'. A Graph API token from an ID-verified Meta developer account (developers.facebook.com → Graph API Explorer).

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

Look up all ads from specific advertiser page IDs (works in both modes). Find a page ID via the Ad Library: open an advertiser, copy the numeric id.

## `apiVersion` (type: `string`):

Graph API version for official mode, e.g. v23.0.

## Actor input object example

```json
{
  "mode": "scrape",
  "searchTerms": [
    "nike",
    "adidas"
  ],
  "countries": [
    "US"
  ],
  "adType": "all",
  "activeStatus": "all",
  "mediaType": "all",
  "maxAds": 100,
  "pageSize": 25,
  "matchType": "broad",
  "downloadMedia": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "apiVersion": "v23.0"
}
```

# Actor output Schema

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

Dataset containing Meta Ad Library Scraper records (page_name, body, cta_text, link_url, is_active, days_active, longevity_score, has_metrics, spend_midpoint, media_images, media_videos, parse_confidence).

# 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"
    ],
    "countries": [
        "US"
    ],
    "maxAds": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("bovi/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 = {
    "searchTerms": ["nike"],
    "countries": ["US"],
    "maxAds": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("bovi/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 '{
  "searchTerms": [
    "nike"
  ],
  "countries": [
    "US"
  ],
  "maxAds": 100
}' |
apify call bovi/meta-ad-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bovi/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/gJ0MDNt3APRgFJbpu/builds/Ve0YaIL1wXarIVafp/openapi.json
