# Facebook Ads Library Scraper (`tuhin/facebook-ads-library-scraper`) Actor

Scrape the Facebook & Instagram (Meta) Ads Library by keyword or advertiser page — ad creatives, ad copy, media, start/end dates, platforms, CTA and landing links. Spy on competitor Facebook ads.

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

## Pricing

from $17.50 / 1,000 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Facebook Ads Library Scraper 📘 Spy on Facebook & Instagram Ads

**Scrape the Facebook (Meta) Ads Library by keyword or brand and get every ad — creative, copy, media, platforms, dates and landing links.** Research competitor Facebook & Instagram ads at scale, no login and no Meta API token required.

### 🚀 What it does

- ✅ Search the **Meta Ads Library** by keyword / brand
- ✅ For each ad: **advertiser page**, **ad copy**, **CTA**, **landing URL**, **image/video**, **start & end dates**, **active status**
- ✅ **Platforms** the ad runs on: Facebook, Instagram, Messenger, Audience Network, WhatsApp, Threads
- ✅ Covers **all commercial advertisers** (not just political ads)
- ✅ Filter by country, ad category, and active/inactive status

### 💡 Use cases

- **Competitor ad research** — see exactly what ads a brand runs and for how long
- **Winning-creative swipe files** for media buyers and agencies
- **Ad intelligence & market research**; spot new campaigns and offers
- Track your own brand's active ads

### ⚙️ Input

```json
{ "searchTerms": ["nike", "hellofresh"], "country": "US", "activeStatus": "all", "maxAdsPerSearch": 100 }
```

| Field | Description |
|-------|-------------|
| `searchTerms` | Keywords / brands to search. |
| `country` | 2-letter country (e.g. `US`, `GB`, `DE`) or `ALL`. |
| `adType` | `all` or a special category (political, employment, housing, financial). |
| `activeStatus` | `all` / `active` / `inactive`. |
| `maxAdsPerSearch` | Ads to collect per term. |

### 📦 Output (one row per ad)

```json
{
  "adArchiveId": "1234567890",
  "pageName": "JD Sports US", "pageId": "…",
  "adText": "New Nike drops just landed…", "ctaText": "Shop now",
  "linkUrl": "https://www.jdsports.com/…",
  "imageUrl": "https://…", "videoUrl": null,
  "platforms": ["FACEBOOK","INSTAGRAM","THREADS"],
  "isActive": true, "startDate": "2026-08-03", "endDate": null,
  "adLibraryUrl": "https://www.facebook.com/ads/library/?id=1234567890",
  "collectedAt": "2026-08-31T19:00:00Z"
}
```

Export to CSV / Excel / JSON, or via the Apify API.

### 🔑 Keywords

facebook ads library scraper, meta ads scraper, facebook ad spy, instagram ads scraper, competitor ad research, ad library api, facebook ads intelligence, ad creative spy.

### ⚠️ Notes

- Uses Residential proxy (required — Meta blocks datacenter). Scrapes the **public** Ads Library only.
- Some catalog/dynamic ads store templated copy (e.g. `{{product.brand}}`) — that is how Meta publishes them.

# Actor input Schema

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

Each entry can be: a keyword ("weight loss"), a brand, a domain or website URL ("nike.com" — searched by brand), a Facebook page URL, a numeric Facebook page ID (returns ALL ads from that advertiser), or a full Ads Library URL. Auto-detected.

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

2-letter country code for the Ads Library, e.g. "US", "GB", "DE", or "ALL".

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

Ad Library category.

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

Which ads to include.

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

How many ads to collect per search term.

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

Facebook requires Residential proxies. Keep this on.

## Actor input object example

```json
{
  "searchTerms": [
    "hellofresh",
    "shopify.com",
    "https://www.facebook.com/ads/library/?view_all_page_id=15087023444"
  ],
  "country": "US",
  "adType": "all",
  "activeStatus": "all",
  "maxAdsPerSearch": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `ads` (type: `string`):

One row per ad with advertiser, copy, media, dates, platforms and links.

# 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.com"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("tuhin/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 '{
  "searchTerms": [
    "nike.com"
  ]
}' |
apify call tuhin/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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