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

Scrape the public Facebook and Instagram Ad Library with no login: search by keyword, advertiser page or library URL. Get advertiser, ad text, headline, images, videos, call to action, landing page, start date, platforms and countries.

- **URL**: https://apify.com/goat255/facebook-ads-library-scraper.md
- **Developed by:** [Goutam Soni](https://apify.com/goat255) (community)
- **Categories:** Marketing, Lead generation, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

## Facebook Ads Library Scraper

### What it does

Reads the public Facebook and Instagram Ad Library with no login, no cookies and no access token. Search by keyword, by advertiser page ID or by pasting any Ad Library URL, and get one clean row per ad: the advertiser, ad text, headline, images, video links, call to action, landing page, start date and platforms.

Use it to research competitors' creative, find active advertisers as leads, track how long ads stay live and collect ad swipe files.

### Input

| Field | Type | Description |
|---|---|---|
| `searchQueries` | list | Keywords to search for. |
| `pageIds` | list | Numeric advertiser page IDs, to get every ad from one advertiser. |
| `adLibraryUrls` | list | Ad Library URLs copied from your browser. Each keeps its own filters. |
| `maxAdsPerSearch` | integer | Most ads to keep from each search, 50 by default. |
| `country` | string | Two-letter country code, or ALL. US by default. |
| `activeStatus` | string | `active`, `inactive` or `all`. |
| `adType` | string | `all`, or `political_and_issue_ads`. |
| `mediaType` | string | `all`, `image`, `video`, `meme` or `none`. |
| `exactPhrase` | boolean | Match the search term as an exact phrase. |
| `maxConcurrency` | integer | Searches run at once, 3 by default. |
| `proxyConfiguration` | object | Leave the default unless you have a reason to change it. |

### Example input

```json
{
  "searchQueries": ["running shoes"],
  "country": "US",
  "activeStatus": "active",
  "maxAdsPerSearch": 100
}
```

### Output sample

```json
{
  "input": "running shoes",
  "adArchiveId": "1000000000000000",
  "adLibraryUrl": "https://www.facebook.com/ads/library/?id=1000000000000000",
  "pageId": "100000000000000",
  "pageName": "Acme Co",
  "pageUrl": "https://www.facebook.com/example-page/",
  "pageLikes": 12500,
  "pageCategories": ["Shopping & retail"],
  "isActive": true,
  "startDate": "2026-10-01T07:00:00.000Z",
  "endDate": "2026-11-05T08:00:00.000Z",
  "platforms": ["FACEBOOK", "INSTAGRAM"],
  "displayFormat": "VIDEO",
  "title": "Our lightest running shoe yet",
  "body": "Built for every mile.",
  "caption": "example.com",
  "ctaText": "Shop now",
  "ctaType": "SHOP_NOW",
  "linkUrl": "https://example.com/shoes",
  "images": [],
  "videos": [{"hdUrl": "https://example.com/ad.mp4", "sdUrl": "https://example.com/ad-sd.mp4", "previewImageUrl": "https://example.com/ad.jpg"}],
  "cards": [],
  "collationCount": 3,
  "totalResultsFound": 2913,
  "scrapedAt": "2026-11-05T00:00:00.000Z"
}
```

### Notes

- You pay per ad delivered. A search that could not be read comes back as a row with a `status` and a `message`, and it is not charged.
- `totalResultsFound` is the library's own figure for the search. It stops counting at around 50,000.
- `spend`, `currency`, `reachEstimate`, `impressions` and `disclaimer` (who paid for the ad) are filled only for political and issue ads, which the library makes public by law. Set `adType` to `political_and_issue_ads` to get them. For every other ad they read `null`.
- `images`, `videos` and `cards` depend on the ad's format, so an ad has one of them filled, not all three.
- Media links are temporary, so download any files you want to keep soon after the run.
- This actor is independent and is not affiliated with or endorsed by Meta or Facebook.
- To improve our actors we collect anonymized usage telemetry (run stats and input patterns). No personal account data is collected.

**Found this useful?** [Leave a quick review](https://apify.com/goat255/facebook-ads-library-scraper/reviews). It takes a few seconds and it genuinely helps other people find the actor.

# Actor input Schema

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

Keywords to search for in the Ad Library.

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

Numeric page IDs, to get every ad from one advertiser.

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

Ad Library URLs copied from your browser. Each keeps its own filters.

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

Most ads to keep from each search.

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

Two-letter country code such as US, GB or IN, or ALL for every country.

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

Which ads to include.

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

All ads, or political and issue ads only.

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

Filter by the kind of creative.

## `exactPhrase` (type: `boolean`):

Match the search term as an exact phrase.

## `maxConcurrency` (type: `integer`):

How many searches to run at the same time.

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

Which addresses to read from. The default suits nearly every run, so leave it unless you have a reason to change it.

## Actor input object example

```json
{
  "searchQueries": [
    "running shoes"
  ],
  "maxAdsPerSearch": 10,
  "country": "US",
  "activeStatus": "active",
  "adType": "all",
  "mediaType": "all",
  "exactPhrase": false,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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": [
        "running shoes"
    ],
    "maxAdsPerSearch": 10,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("goat255/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": ["running shoes"],
    "maxAdsPerSearch": 10,
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

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