# Facebook Ads Library Scraper - Meta Ads Spy (`karioski/facebook-ads-library-scraper`) Actor

Scrape the Meta (Facebook & Instagram) Ad Library by keyword, brand or page: ad text, headline, call to action, landing URL, images, videos, advertiser, status and start/end dates. Filter by country, status and media type. No login.

- **URL**: https://apify.com/karioski/facebook-ads-library-scraper.md
- **Developed by:** [KARIOSKI](https://apify.com/karioski) (community)
- **Categories:** Marketing, Social media, E-commerce
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

**Facebook Ads Library Scraper** extracts ads from the **Meta Ad Library** (Facebook, Instagram, Messenger and Audience Network) by **keyword, brand or Facebook page**: **ad text, headline, link description, call to action, landing page URL, images, videos, advertiser and page link, active/inactive status and start/end dates**. No Facebook login and no Meta API token.

### What can this Actor do?

- **Search by keyword or brand**, or get every ad of a **Facebook page** by its ID.
- **Filters**: country (or all), active / inactive / all ads, all or political ads, media type (image, video, meme).
- **Full creative**: ad copy, headline, description, call to action and real landing URL (Facebook redirects removed).
- **Run dates**: when each ad started and, for stopped ads, when it ended.
- **Multiple versions** flag and creatives reused across ads.
- Paste your own Ad Library URLs with any filters.

### Why choose it over other tools?

- See exactly what competitors run, with landing pages, in one spreadsheet.
- Long-running ads are usually winners: sort by start date to find them.
- Cheaper per ad than most Facebook ad spy tools.

### What data can I extract?

| Field | Description |
|---|---|
| `libraryId / adUrl / status / startedRunning / endedRunning` | Ad |
| `advertiserName / advertiserPageUrl` | Advertiser |
| `adText / headline / linkDescription / linkCaption / callToAction / landingUrl` | Creative |
| `imageUrls / videoUrls / videoThumbnails` | Media |
| `hasMultipleVersions / adsWithSameCreative / totalResultsText` | Extras |

### How to use it

1. Enter keywords or brand names, or Facebook page IDs.
2. Choose country, status and media type.
3. Click **Start**.
4. Export the ads to CSV, Excel or JSON.

### Input example

```json
{
  "searchQueries": [
    "protein powder"
  ],
  "pageIds": [
    "15087023444"
  ],
  "country": "US",
  "activeStatus": "active",
  "mediaType": "all",
  "maxAdsPerSearch": 100
}
```

### Output example

```json
{
  "libraryId": "1016451784037642",
  "adUrl": "https://www.facebook.com/ads/library/?id=1016451784037642",
  "status": "active",
  "startedRunning": "Jun 20, 2025",
  "hasMultipleVersions": true,
  "advertiserName": "Nike",
  "advertiserPageUrl": "https://www.facebook.com/nike/",
  "adText": "Get the gear that goes hard on and off the field.",
  "linkCaption": "NIKE.COM",
  "headline": "Nike Air Monarch IV",
  "callToAction": "Shop Now",
  "landingUrl": "https://www.nike.com/t/air-monarch-iv-mens-workout-shoes-extra-wide-p8qNlT/416355-102",
  "country": "US",
  "totalResultsText": ">50,000 results"
}
```

Download the dataset as JSON, CSV, Excel or HTML, or read it with the API.

### How much does it cost?

This Actor uses **pay-per-event** pricing: you pay only for results delivered, and platform usage is included. Prices drop further on higher Apify plans (Silver, Gold).

| What you pay for | Price on paid plans |
|---|---|
| Ad | $0.001 ($1 per 1,000) |

**Example:** the latest 100 ads of 20 competitors (2,000 ads) cost **$2**.

You can set a **maximum cost per run** in the run options; the Actor stops cleanly when it is reached. Failed items and errors are never charged.

### Use cases

- **Performance marketers**: ad creative research and swipe files.
- **Agencies**: competitor audits and pitch decks.
- **E-commerce**: find winning products from ads that keep running.
- **Researchers and journalists**: political and issue ad monitoring.

### Integrations and API

You can run this Actor and get its data in many ways:

- **Apify API and clients** for [JavaScript](https://docs.apify.com/api/client/js) and [Python](https://docs.apify.com/api/client/python): start runs and download results as JSON, CSV, Excel, XML or HTML.
- **Schedules**: run it hourly, daily or weekly to monitor changes.
- **Integrations**: Make, Zapier, n8n, Google Sheets, Slack, Airbyte, webhooks and more.
- **AI agents (MCP)**: add it to Claude, Cursor, VS Code or any MCP client through the [Apify MCP server](https://mcp.apify.com), and your agent can call it as a tool.

### FAQ

#### Does it show spend and reach?

Meta publishes spend and impressions only for political and issue ads (and EU reach data in the ad details). For other ads you get the creative, landing page and dates.

#### Do I need a Facebook account?

No. The Ad Library is public.

#### How do I find a page ID?

Open the advertiser in the Ad Library: the URL contains view_all_page_id=...

#### Is it legal to scrape this data?

This Actor collects only publicly available data and does not log in to any account. Personal data is protected by laws such as the GDPR in the EU; don't scrape personal data unless you have a legitimate reason. If you're unsure whether your use case is legitimate, consult a lawyer. See also Apify's post on [the legality of web scraping](https://blog.apify.com/is-web-scraping-legal/).

### Related tools

- [Google Ads Transparency Scraper](https://apify.com/karioski/google-ads-transparency-scraper): Google ads of the same competitors
- [Website Screenshot](https://apify.com/karioski/website-screenshot): screenshots of landing pages
- [Contact Details Scraper](https://apify.com/karioski/contact-details-scraper): contacts from advertisers' websites

Found a bug or missing a feature? Open an issue on the **Issues** tab. We usually reply within 24 hours.

# Actor input Schema

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

Keywords or brand names to search in the Meta Ad Library, e.g. "nike", "protein powder", "crm software".

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

Optional: numeric Facebook page IDs to get all ads of one advertiser (e.g. 15087023444 for Nike). Find it in the Ad Library URL (view_all_page_id) or the page's About section.

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

Where the ads were shown.

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

Running ads, stopped ads or both.

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

All ads or only political and social issue ads.

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

Filter by creative type.

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

Optional Meta Ad Library search URLs with your own filters.

## `maxAdsPerSearch` (type: `integer`):

The Ad Library loads about 30 ads per scroll.

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

Usually not needed.

## Actor input object example

```json
{
  "searchQueries": [
    "nike"
  ],
  "country": "ALL",
  "activeStatus": "active",
  "adType": "all",
  "mediaType": "all",
  "maxAdsPerSearch": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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": [
        "nike"
    ],
    "maxAdsPerSearch": 30,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("karioski/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 = {
    "searchQueries": ["nike"],
    "maxAdsPerSearch": 30,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("karioski/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 '{
  "searchQueries": [
    "nike"
  ],
  "maxAdsPerSearch": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call karioski/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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