# Facebook & Meta Ads Library Scraper — Ad Intelligence Tool (`aiscraperdev/facebook-meta-ads-library-scraper`) Actor

Scrape Facebook & Instagram ads by keyword, brand, or country. Extract ad copy, creatives, CTA, video URLs & advertiser data. No login required.

- **URL**: https://apify.com/aiscraperdev/facebook-meta-ads-library-scraper.md
- **Developed by:** [Randeep Dhillon](https://apify.com/aiscraperdev) (community)
- **Categories:** Social media, Lead generation, Developer tools
- **Stats:** 5 total users, 2 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.00 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

### Meta Ads Library Scraper — Facebook & Instagram Ad Intelligence

Extract structured ad data from the **Meta (Facebook & Instagram) Ads Library** 
at scale. Search by keyword, brand name, or paste any Ad Library URL directly.
No Meta account, cookies, or API key required.

---

#### What you can do with this scraper

- **Competitor research** — see every ad your competitors are running right now
- **Creative inspiration** — build a swipe file of winning image and video ads
- **Dropshipping & ecommerce** — find trending products being heavily advertised
- **Agency reporting** — pull client competitor data in minutes, not hours
- **Market research** — track ad trends by keyword, country, or industry
- **Lead generation** — identify brands actively spending on paid ads

---

#### How to use

**Step 1 — Add your search queries**

The `Search Queries / URLs` field accepts three types of input (you can mix them):

| Input type | Example |
|---|---|
| Keyword | `skincare`, `dropshipping`, `fitness app` |
| Facebook Page URL | `https://www.facebook.com/nike` |
| Ad Library URL | `https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=IN&q=example` |

You can add multiple queries at once — the actor will scrape all of them in a single run.

**Step 2 — Set your filters**

| Filter | Options | Default |
|---|---|---|
| **Country** | Any 2-letter code: `US`, `IN`, `UK`, `ALL` | `ALL` |
| **Ad Status** | All / Active / Inactive | `All` |
| **Ad Type** | All / Political & Issue / Housing / Employment | `All` |
| **Media Type** | All / Image / Video / Meme | `All` |
| **Platform** | All / Facebook / Instagram / Messenger / Audience Network | `All` |
| **Max Results** | Any number, or `-1` to scrape everything | `100` |

**Step 3 — Run and export**

Click **Start** and wait for the run to complete. Download your results in **JSON, CSV, or Excel**.

---

#### Sample output

```json
{
  "ad_id": "1555263375851429",
  "ad_format": "video",
  "ad_body_text": "Vintage and new Pokémon cards starting at $1 ⚡️",
  "ad_headline": "Live on Whatnot",
  "cta_text": "Install Now",
  "landing_page_url": "https://...",
  "image_url": "https://...",
  "video_url": "https://...",
  "page_name": "Whatnot",
  "page_country": "US",
  "ad_status": "Active",
  "ad_active_duration_days": 238,
  "start_date": "2025-01-15",
  "publisher_platforms": ["facebook", "instagram"]
}
````

***

#### Input schema reference

```json
{
  "searchQueries": ["nike", "https://www.facebook.com/adidas"],
  "countryCode": "US",
  "adStatus": "active",
  "adType": "all",
  "mediaType": "video",
  "platform": "instagram",
  "maxResults": 500
}
```

***

#### Who uses this

- **Digital marketers** tracking competitor campaigns
- **Dropshippers** validating winning products before investing in inventory
- **Marketing agencies** building pitch decks and client reports
- **Growth hackers** identifying high-spend advertisers in any niche
- **Researchers** studying political and issue-based ad campaigns

***

#### Pricing

This actor uses **Pay-Per-Result** pricing — you only pay for ads actually scraped.
**$3.00 per 1,000 ads** on the free plan.

***

#### Tips for best results

- Use **residential proxies** for maximum coverage — without proxies Meta limits results heavily
- Set `adStatus` to `active` to focus only on currently running campaigns
- Sort by impressions using an Ad Library URL to find the highest-performing ads first
- Use `maxResults: -1` carefully — popular keywords can return thousands of ads

***

#### Limitations

- Spend and impressions data is only available for **EU/political/special category ads** — Meta does not expose this for standard commercial ads
- Media URLs (images, videos) are **temporary CDN links** — download them promptly after scraping
- Results may vary without proxy configuration

***

#### Related scrapers

- Facebook Page Scraper
- Instagram Profile Scraper
- TikTok Ads Scraper

# Actor input Schema

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

Keywords, Facebook Page URLs, or paste Ad Library URLs directly.

## `countryCode` (type: `string`):

2-letter country code (e.g., US, IN, ALL).

## `adStatus` (type: `string`):

Filter ads by their current delivery status.

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

Filter by the type of ad campaign.

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

Filter by the type of media used in the ad.

## `platform` (type: `string`):

Filter by the Meta platform where the ad is displayed.

## `maxResults` (type: `integer`):

Maximum number of ads to scrape per query (-1 for all).

## Actor input object example

```json
{
  "searchQueries": [
    "all"
  ],
  "countryCode": "ALL",
  "adStatus": "all",
  "adType": "all",
  "mediaType": "all",
  "platform": "all",
  "maxResults": 100
}
```

# 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": [
        "all"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("aiscraperdev/facebook-meta-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": ["all"] }

# Run the Actor and wait for it to finish
run = client.actor("aiscraperdev/facebook-meta-ads-library-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "all"
  ]
}' |
apify call aiscraperdev/facebook-meta-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=aiscraperdev/facebook-meta-ads-library-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook & Meta Ads Library Scraper — Ad Intelligence Tool",
        "description": "Scrape Facebook & Instagram ads by keyword, brand, or country. Extract ad copy, creatives, CTA, video URLs & advertiser data. No login required.",
        "version": "0.0",
        "x-build-id": "Pvljijtqkd2bgO12s"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/aiscraperdev~facebook-meta-ads-library-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-aiscraperdev-facebook-meta-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/aiscraperdev~facebook-meta-ads-library-scraper/runs": {
            "post": {
                "operationId": "runs-sync-aiscraperdev-facebook-meta-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/aiscraperdev~facebook-meta-ads-library-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-aiscraperdev-facebook-meta-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "searchQueries"
                ],
                "properties": {
                    "searchQueries": {
                        "title": "Search Queries / URLs",
                        "type": "array",
                        "description": "Keywords, Facebook Page URLs, or paste Ad Library URLs directly.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "countryCode": {
                        "title": "Country",
                        "type": "string",
                        "description": "2-letter country code (e.g., US, IN, ALL).",
                        "default": "ALL"
                    },
                    "adStatus": {
                        "title": "Ad Status",
                        "enum": [
                            "all",
                            "active",
                            "inactive"
                        ],
                        "type": "string",
                        "description": "Filter ads by their current delivery status.",
                        "default": "all"
                    },
                    "adType": {
                        "title": "Ad Type",
                        "enum": [
                            "all",
                            "political_and_issue_ads",
                            "housing",
                            "employment"
                        ],
                        "type": "string",
                        "description": "Filter by the type of ad campaign.",
                        "default": "all"
                    },
                    "mediaType": {
                        "title": "Media Type",
                        "enum": [
                            "all",
                            "image",
                            "video",
                            "meme"
                        ],
                        "type": "string",
                        "description": "Filter by the type of media used in the ad.",
                        "default": "all"
                    },
                    "platform": {
                        "title": "Platform",
                        "enum": [
                            "all",
                            "facebook",
                            "instagram",
                            "messenger",
                            "audience_network"
                        ],
                        "type": "string",
                        "description": "Filter by the Meta platform where the ad is displayed.",
                        "default": "all"
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "type": "integer",
                        "description": "Maximum number of ads to scrape per query (-1 for all).",
                        "default": 100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
