# Facebook Ads Library Scraper: Meta Ads by Keyword (`kaleidoscopelabs/facebook-ads-library-scraper`) Actor

Search the Facebook Ads Library (Meta Ads Library) by keyword or pasted Ad Library search URL: up to several thousand ads per keyword, with its text, links, media, dates and Page, ranked as the library lists them, plus the library's own ad count per search.

- **URL**: https://apify.com/kaleidoscopelabs/facebook-ads-library-scraper.md
- **Developed by:** [Kaleidoscope Labs](https://apify.com/kaleidoscopelabs) (community)
- **Categories:** Social media, Lead generation, E-commerce
- **Features:** Limited permissions
- **Stats:** 9 total users, 4 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.80 / 1,000 searches

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

### What can Facebook Ads Library Scraper do?

**Search the Facebook Ads Library, also called the Meta Ads Library, by keyword and get up to several thousand ads per keyword: the text, links, media, dates and Page of each, ranked as the library lists them, plus the library's own ad count for each search.**

[![Use it from your AI agent: copy the MCP setup prompt](https://assets.kaleidoscopelabs.io/afy/mcp/mcp-setup.5ac6bded.png)](https://mcp.apify.com/?tools=kaleidoscopelabs/facebook-ads-library-scraper)

![One keyword search, "meal kit" in the US: 4,960 ads in the library's count, the first 500 returned in the library's order, from 177 Pages.](https://assets.kaleidoscopelabs.io/afy/fb-ads-search/hero.1582f24e.png)

- 🔎 **By keyword:** a product, a brand or a category, as you would type it in the library's search box; in quotes, an exact phrase.
- 🔗 **By search URL:** paste a Meta Ads Library search from your browser, its filters and all; a link with a filter this Actor can't apply stops the run with a message naming it.
- 🔢 **How many ads:** the library's own count for each search, with the ads returned and why the search ended.
- 🖼️ **Each ad:** its text, headline, link, button, dates and days active, platforms, format, versions, image and video links, and a carousel's cards.
- 🏷️ **Its Page:** the Page's ID, name, link, picture, categories and likes, from the ad itself.
- 🎚️ **Filters:** country, running now or ended, media type, platforms, languages, a date range, and the library's order setting (Most recent or Impressions).

Run it from Apify Console, through the API, on a schedule, or from an AI agent.

### What data can you get from the Facebook Ad Library?

![Ads by format for two keywords: "meal kit" is 90% video; "protein bars" is 49% video, 39% image, 11% DCO.](https://assets.kaleidoscopelabs.io/afy/fb-ads-search/formats.d6f562bc.png)

Two kinds of record in one dataset: one `ad` record per ad, and one `search` record per search.

| Data | Field |
|---|---|
| The record's type, the search as you gave it, and its type | `recordType`, `query`, `searchType` |
| The ad's rank in the search | `place` |
| The ad's ID, link, dates and days active, and whether it is running | `adArchiveId`, `url`, `startDate`, `endDate`, `activeDays`, `active` |
| Its text, headline, link with its description and domain, button, and "paid for by" byline | `text`, `title`, `linkUrl`, `linkDescription`, `linkCaption`, `ctaText`, `ctaType`, `byline` |
| Its platforms, format, versions and the AI-media flag | `platforms`, `format`, `collationCount`, `collationId`, `containsAiMedia` |
| Its categories and impressions range, as the library shows them | `categories`, `impressionsText` |
| Its image and video links, a carousel's cards, and when the links expire | `imageUrls`, `videos`, `cards`, `mediaExpires` |
| Its Page: ID, name, link, picture, categories and likes | `pageId`, `pageName`, `pageUrl`, `pagePictureUrl`, `pageCategories`, `pageLikes` |
| Whether the Page is labelled as a person's (to leave such Pages out), and a partnership ad's creator | `personLabelled`, `partnership`, `creator` |
| For a search: the library's count, the ads returned and those an earlier search of the run returned, and why it ended | `adCount`, `adCountCapped`, `adsReturned`, `adsSeenBefore`, `stoppedBy` |
| For a search: its filters and its link in the Ad Library | `country`, `activeStatus`, `mediaType`, `platforms`, `languages`, `startedAfter`, `startedBefore`, `sort`, `libraryUrl` |
| When it was read, and what the record lacks, and why | `readAt`, `missing` |

A run stores each ad once: when two keywords find the same ad, the second search counts it in `adsSeenBefore` and does not return or charge it again. Its `place` ranks skip those ads, and any ad the same search already returned.

Media links (`imageUrls`, `videos`, the cards' and `pagePictureUrl`) are Meta's and expire, usually within a few days: `mediaExpires` gives the day for an ad's links. Download them within your run's flow.

### How deep does a search go?

A broad keyword gives several thousand ads in a run; a narrower search (a country, a date range, a media type or a language) reads it more completely. A search ends for one of these reasons, in its `stoppedBy`:

- `limit`: **Max ads per search** was reached;
- `end`: the library's list ended;
- `depth`: the library lists no more for one search;
- `partial`: it was read, then cut short: the library counted ads it did not show, or stopped listing them, with the reason in `missing`. The ads stored are kept, and the search is charged;
- notRead: it could not be read to the end (the run's spending limit or time, or the library did not answer), with the reason in `missing`. The ads stored before are kept, and the search is not charged.

At Max ads per search 10,000, a broad keyword usually reads until the run's time runs out (2 hours by default): its search ends `stoppedBy` notRead, its ads kept and charged, the search not. A run reads several searches at once. Resurrect the run to go on: each search goes on where it stopped. A search the first end left at `stoppedBy` notRead keeps that record, not charged, and gets its own record when it ends.

### How to use Facebook Ads Library Scraper

1. Create a free Apify account and open Facebook Ads Library Scraper.
2. In **Keywords**, enter what to search, one per line; or in **Ad Library search URLs**, paste searches from your browser.
3. Choose the **Country** (a two-letter code, or ALL), the other filters, and **Max ads per search**.
4. Click **Start**. Records appear in the Output tab, in the Ads and Searches views; export them as JSON, CSV or Excel, or read them from the API.

### How much does it cost to search the Facebook Ad Library?

Facebook Ads Library Scraper is priced per event, with no usage fees on top:

| Event | Price | When |
|---|---|---|
| Search | $0.004 each | each keyword or search URL read, whether it finds ads or not |
| Ad | $0.00075 each | each ad stored, once per run |

The platform also charges $0.00005 when a run starts. A search the run could not read (`stoppedBy` notRead) is not charged, and its ads stored before are charged as ads; a `partial` or `depth` search is charged. The prefilled input (one keyword, up to 100 ads) costs at most $0.079, plus the start. One keyword at the default, Max ads per search 10,000, costs at most $7.504; since a broad keyword gives several thousand ads in a run, it usually costs less.

| You search | Max ads per search | It costs at most |
|---|---|---|
| 1 keyword | 100 | $0.079 |
| 10 keywords | 100 | $0.79 |
| 10 keywords | 1,000 | $7.54 |
| 100 keywords | 0 (the count only) | $0.40 |

Prices shown are for Apify's free plan; on paid plans they are up to 30% lower.

- **Apify's free plan credit of $5 a month** covers about 6,300 ads in searches of 100 ads each, or about 6,600 in searches of 1,000.

### Input example

Two keywords, one an exact phrase, in the United States, ads running now, 500 ads each:

```json
{
  "keywords": ["meal kit", "\"protein bars\""],
  "country": "US",
  "activeStatus": "active",
  "maxAds": 500
}
```

### Output example

![One ad record and one search record, shortened: where the ad ranks, its dates, platforms and format, its Page, and the search's own count.](https://assets.kaleidoscopelabs.io/afy/fb-ads-search/record.08f90fd6.png)

An ad record and a search record from a run of the input above, shortened; the ad's text, link and button are left out here (…):

```json
[
  {
    "recordType": "ad",
    "query": "meal kit",
    "searchType": "keyword",
    "place": 132,
    "country": "US",
    "activeStatus": "active",
    "readAt": "2026-11-12T01:48:53Z",
    "adArchiveId": "1131553862593598",
    "url": "https://www.facebook.com/ads/library/?id=1131553862593598",
    "startDate": "2026-11-11",
    "activeDays": 1,
    "active": true,
    "platforms": ["FACEBOOK", "INSTAGRAM", "THREADS"],
    "format": "VIDEO",
    "text": "…",
    "linkUrl": "…",
    "ctaText": "…",
    "mediaExpires": "2026-11-16",
    "partnership": false,
    "pageId": "320774061283785",
    "pageName": "HelloFresh",
    "pageCategories": ["Food Service"],
    "personLabelled": false,
    "missing": []
  },
  {
    "recordType": "search",
    "query": "meal kit",
    "searchType": "keyword",
    "country": "US",
    "activeStatus": "active",
    "mediaType": "all",
    "platforms": [],
    "languages": [],
    "sort": "most_recent",
    "adCount": 4582,
    "adCountCapped": false,
    "adsReturned": 500,
    "adsSeenBefore": 0,
    "stoppedBy": "limit",
    "libraryUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&is_targeted_country=false&media_type=all&q=meal%20kit&search_type=keyword_unordered&sort_data[direction]=desc&sort_data[mode]=relevancy_monthly_grouped",
    "readAt": "2026-11-12T01:48:03Z",
    "missing": []
  }
]
```

Did it save you time? A rating on this page helps others find it; an Issue tells us what to fix.

### FAQ

#### Is it legal to read the Facebook Ad Library?

The Ad Library is public: Meta publishes it so that anyone can see the ads Pages run. This Actor reads its public pages, signed out, as any visitor sees them. Whether your use is lawful depends on what you do with the data and where; if in doubt, ask a lawyer.

#### Does it collect personal data?

It reads only public Ad Library pages, signed out. Some fields can carry personal data: an ad's Page when the Page is a person's (public figures, creators, artists; `personLabelled` marks them), its "paid for by" text, a partnership ad's creator, and the ad's own texts and media, which can show people. You are responsible for how you use the data under GDPR, KVKK or similar laws; if in doubt, ask a lawyer. Apify runs in the United States.

#### Why does a search return fewer ads than its count?

The library counts every ad that matches; one search lists part of them, several thousand for a broad keyword in a run. A search can also return fewer when an earlier search of the run returned some of the same ads (`adsSeenBefore`). Narrow a broad keyword with a country, dates, a media type or a language to see others.

#### Can I search a Page's ads?

Use Facebook Ad Library Checker for a Page: it takes Page links, IDs and brand names, and a search URL of a Page's ads (view_all_page_id).

### Support and feedback

Open an issue on the Issues tab with the run's ID and the Ref from the run's last message: it tells us what happened without your data.

### Other Actors

| Actor | Use it with this one to |
|---|---|
| [Meta Ad Library & Facebook Ad Library Checker](https://apify.com/kaleidoscopelabs/facebook-ads-library-checker) | Check whether the Pages behind the ads run others, how many, and the day the newest started |
| [Ads Transparency Center: Google Ads Scraper](https://apify.com/kaleidoscopelabs/google-ads-transparency-data) | See whether the same advertisers run ads on Google too |

*Facebook Ads Library Scraper is an independent tool, not affiliated with, endorsed by or sponsored by Meta Platforms, Inc. Facebook is a trademark of Meta Platforms, Inc.*

# Changelog

This Actor's version history is a separate document: https://apify.com/kaleidoscopelabs/facebook-ads-library-scraper/changelog.md

# Actor input Schema

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

One per line: a product, a brand or a category, as you would type it in the Ad Library's search box. In quotes ("meal kit") it is an exact phrase. Each keyword is searched under the filters below.

## `searchUrls` (type: `array`):

One per line: an Ad Library keyword search's link (facebook.com/ads/library/?q=…), copied from your browser. Its own filters apply (dates, media type, language, platform, country), not the ones below. A Page's ad list (view_all_page_id) belongs in Facebook Ad Library Checker, and a link with filters this Actor does not apply stops the run with a message naming them.

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

Where the ads ran: a two-letter country code such as US or DE, or ALL for anywhere.

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

Running now, ended, or both.

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

The ads' media, as the Ad Library's filter names it.

## `platforms` (type: `array`):

Only ads that run on these platforms; none chosen is every platform.

## `languages` (type: `array`):

Only ads in these languages: two- or three-letter codes such as en or de; none is every language.

## `startedAfter` (type: `string`):

Only ads running on or after this day (YYYY-MM-DD). The library keeps ads that ran during the dates, not only those that started in them.

## `startedBefore` (type: `string`):

Only ads running on or before this day (YYYY-MM-DD). The library keeps ads that ran during the dates, not only those that started in them.

## `sort` (type: `string`):

The order the library lists the ads in: Most recent (the newest months first, by relevance within a month) or Impressions, as the library sorts it; both orders give a signed-out visitor the same ads.

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

How many ads each search stores at most, 0 to 10,000; each costs one ad. A broad keyword gives several thousand ads in a run; a narrower search (a country, a date range, a media type or a language) reads it more completely. 0 is the ad count only.

## Actor input object example

```json
{
  "keywords": [
    "meal kit",
    "\"running shoes\""
  ],
  "searchUrls": [
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=meal%20kit&search_type=keyword_unordered&media_type=all"
  ],
  "country": "US",
  "activeStatus": "active",
  "mediaType": "all",
  "platforms": [],
  "languages": [
    "en"
  ],
  "sort": "most_recent",
  "maxAds": 100
}
```

# Actor output Schema

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

The run's default dataset: one ad record per ad a search returned, and one search record per search, with the library's count, the ads returned and why it ended.

## `summary` (type: `string`):

What the run did: the searches read, the ads stored, the searches not read to the end, and the Ref to quote in an issue.

## `progress` (type: `string`):

The searches the run could not read: written when the platform moves the run and at its end, so a run moved or resurrected counts them once.

# 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": [
        "meal kit"
    ],
    "searchUrls": [],
    "country": "ALL",
    "activeStatus": "active",
    "mediaType": "all",
    "platforms": [],
    "languages": [],
    "sort": "most_recent",
    "maxAds": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("kaleidoscopelabs/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 = {
    "keywords": ["meal kit"],
    "searchUrls": [],
    "country": "ALL",
    "activeStatus": "active",
    "mediaType": "all",
    "platforms": [],
    "languages": [],
    "sort": "most_recent",
    "maxAds": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("kaleidoscopelabs/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 '{
  "keywords": [
    "meal kit"
  ],
  "searchUrls": [],
  "country": "ALL",
  "activeStatus": "active",
  "mediaType": "all",
  "platforms": [],
  "languages": [],
  "sort": "most_recent",
  "maxAds": 100
}' |
apify call kaleidoscopelabs/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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