# Meta Ad Library Scraper - Facebook & Instagram Ads (`seemuapps/meta-ad-library-scraper`) Actor

Scrape Facebook and Instagram ads from the Meta Ad Library by keyword, advertiser page or URL - ad copy, creatives, CTA, dates, platforms and status.

- **URL**: https://apify.com/seemuapps/meta-ad-library-scraper.md
- **Developed by:** [Andrew](https://apify.com/seemuapps) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 ad results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 & Instagram Ads

Scrape every ad in the Meta Ad Library for any keyword, advertiser page or Ad Library URL - ad copy, headlines, creatives, call-to-action, landing page, run dates, platforms and active status. No login, no cookies, no Meta developer account.

### What you get

One dataset row per ad with:

- **Identity**: `adArchiveId`, `adLibraryUrl`, `pageId`, `pageName`, `pageProfileUrl`, `pageLikeCount`, `pageCategories`
- **Status and timing**: `isActive`, `startDate`, `endDate`, `totalActiveTimeSeconds`
- **Ad copy**: `title`, `body`, `caption`, `linkDescription`, `ctaText`, `ctaType`, `linkUrl`, `extraTexts`, `extraLinks`
- **Creatives**: `images` (direct URLs), `videos` (HD/SD MP4 + preview image), `cards` for carousel ads, `displayFormat`
- **Distribution**: `publisherPlatforms` (facebook, instagram, messenger, threads, audience\_network), `collationCount` (number of variants)
- **Political and issue ads**: `spend`, `currency`, `reachEstimate`, `impressions`, `disclaimer`, `byline`

Export to JSON, CSV, Excel or Google Sheets from the Apify console, or pull the dataset via API.

### Use cases

- **Competitor ad monitoring** - track every active ad a competitor page is running and when creatives change
- **Creative research and swipe files** - pull ad copy, hooks and video creatives for a niche keyword
- **Ad spend intelligence** - see which advertisers dominate a keyword by impressions and how long ads have run
- **Lead generation** - find businesses actively advertising in a category or country
- **Political ad transparency** - collect spend, reach and disclaimer data for political and issue ads

### How to use

1. Enter one or more **Keywords** (e.g. `protein powder`), **Advertiser page IDs** (the `view_all_page_id` number from an Ad Library URL), or paste full **Ad Library URLs** - filters embedded in a URL are honoured automatically.
2. Pick a **Country** (2-letter code or `ALL`), **Ad status** (active, inactive or all), **Media type**, and optionally a **Language** and **Start/End date** window.
3. Set **Max ads per query** (default 100; `0` pages through the whole result set).
4. Run the actor. Results appear in the **Dataset** tab, one row per ad.

To find a page ID: open the advertiser's page in the Ad Library and copy the number after `view_all_page_id=` in the URL, or just paste that URL into **Ad Library URLs**.

### Output example

```json
{
  "query": "lululemon",
  "queryType": "keyword",
  "adArchiveId": "1399070072320010",
  "adLibraryUrl": "https://www.facebook.com/ads/library/?id=1399070072320010",
  "isActive": true,
  "startDate": "2026-08-25T07:00:00.000Z",
  "endDate": "2026-09-18T07:00:00.000Z",
  "pageId": "33693527731",
  "pageName": "lululemon",
  "pageLikeCount": 3701264,
  "pageCategories": ["Clothing (Brand)"],
  "publisherPlatforms": ["facebook", "instagram"],
  "displayFormat": "DCO",
  "title": "Bring the racket.",
  "body": "Quiet? Please. New tennis gear lets your game speak volumes.",
  "caption": "shop.lululemon.com",
  "linkUrl": "https://shop.lululemon.com/story/tennis",
  "ctaText": "Learn more",
  "ctaType": "LEARN_MORE",
  "images": [],
  "videos": [{ "hdUrl": "https://video.xx.fbcdn.net/...mp4", "sdUrl": "...", "previewImageUrl": "..." }],
  "cards": [],
  "collationCount": 2
}
```

### Pricing

Pay per event: a small fee per search page fetched plus a fee per ad returned. Free-plan users are capped at 30 ads per run; upgrade to any paid Apify plan to remove the cap.

### FAQ

**Which countries are supported?** Any country the Ad Library covers. Use a 2-letter ISO code (`US`, `GB`, `AU`, `DE`, `BR` ...) or `ALL`.

**Can I get inactive ads?** Yes - set **Ad status** to `INACTIVE` or `ALL`. Inactive ads keep their creatives and copy.

**Do I get spend and impressions?** Meta only publishes those ranges for political and social-issue ads. For commercial ads the fields are `null`; use `collationCount`, `totalActiveTimeSeconds` and the impressions sort order as proxies.

**Are the media URLs permanent?** Creative URLs are signed CDN links that expire after a few days. Download them promptly if you need to keep the files.

**How many ads can I scrape?** The Ad Library reports up to ~50,000 matches per keyword. Set **Max ads per query** to `0` and the actor pages through all of them within the run timeout.

# Actor input Schema

## `keywords` (type: `array`):

Search the Ad Library by keyword or phrase (e.g. 'protein powder', 'lululemon'). Each keyword is a separate search.

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

Numeric Facebook page IDs to pull every ad from (find it in the Ad Library URL as view\_all\_page\_id=...). Use this to scrape all ads for a specific competitor.

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

Paste full facebook.com/ads/library URLs. Keyword (q=), page (view\_all\_page\_id=), country, status, media type and date filters embedded in the URL are honoured.

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

2-letter country code the ads were shown in (US, GB, AU, DE, ...) or ALL for worldwide.

## `adActiveStatus` (type: `string`):

Only currently running ads, only ended ads, or both.

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

Filter by creative format. 'Meme' is Meta's name for image ads with text overlaid.

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

All ads, or only political and social-issue ads (these include spend and impression ranges).

## `searchType` (type: `string`):

How keywords are matched against ad text (keyword searches only).

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

Order results by estimated impressions (most-seen ads first) or by most recent.

## `language` (type: `string`):

Optional 2-letter language code to filter ad text (EN, ES, FR, DE, ...). Leave empty for all languages.

## `startDate` (type: `string`):

Only ads that started running on or after this date, YYYY-MM-DD. Leave empty for no lower bound.

## `endDate` (type: `string`):

Only ads that started running on or before this date, YYYY-MM-DD. Leave empty for no upper bound.

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

Maximum ads to return for each keyword, page ID or URL. Set 0 for no limit (the actor pages through the whole result set).

## Actor input object example

```json
{
  "keywords": [
    "lululemon"
  ],
  "country": "ALL",
  "adActiveStatus": "ACTIVE",
  "mediaType": "ALL",
  "adType": "all",
  "searchType": "keyword_unordered",
  "sortBy": "total_impressions",
  "maxAdsPerQuery": 100
}
```

# Actor output Schema

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

One record per ad: adArchiveId, adLibraryUrl, isActive, startDate, endDate, pageId, pageName, pageLikeCount, pageCategories, publisherPlatforms, displayFormat, title, body, caption, linkUrl, ctaText, ctaType, images, videos, cards, collationCount, spend, currency, reachEstimate, impressions.

# 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 = {
    "keywords": [
        "lululemon"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("seemuapps/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 = { "keywords": ["lululemon"] }

# Run the Actor and wait for it to finish
run = client.actor("seemuapps/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 '{
  "keywords": [
    "lululemon"
  ]
}' |
apify call seemuapps/meta-ad-library-scraper --silent --output-dataset

```

## MCP server setup

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