# Facebook Ads Library Scraper - Creative & Reach ($0.50/1k) (`harshmaur/facebook-ads-library-scraper`) Actor

Scrape ads from the Facebook (Meta) Ad Library by keyword or Page - no login, no Meta API key. Full ad creative (text, images, video, CTA, link), advertiser, run dates, ad duration & EU/UK reach. $0.50 per 1,000 ads. 70+ fields per ad. Works with AI Agents, MCP, n8n, Make & Zapier.

- **URL**: https://apify.com/harshmaur/facebook-ads-library-scraper.md
- **Developed by:** [Harsh Maur](https://apify.com/harshmaur) (community)
- **Categories:** Social media, Lead generation, E-commerce
- **Stats:** 2 total users, 1 monthly users, 50.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.40 / 1,000 ad results

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/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

## Facebook Ads Library Scraper — Scrape Meta Ad Library Ads, Creative & Reach (No API Key)

<p align="center">
  <strong>Scrape ads from the Facebook (Meta) Ad Library by keyword or by Page — full ad creative, advertiser, run dates, and EU/UK reach. No login, no Meta API key. $0.50 per 1,000 ads.</strong>
</p>

<p align="center">
  <a href="https://apify.com/harshmaur/facebook-ads-library-scraper">
    <img src="https://img.shields.io/badge/Apify-Try%20Now-00C7B7?style=for-the-badge&logo=apify" alt="Try on Apify">
  </a>
  <a href="https://apify.com/harshmaur/facebook-ads-library-scraper/input-schema">
    <img src="https://img.shields.io/badge/Input-Schema-blue?style=for-the-badge" alt="Input Schema">
  </a>
  <a href="https://apify.com/harshmaur/facebook-ads-library-scraper/api">
    <img src="https://img.shields.io/badge/API-Docs-orange?style=for-the-badge" alt="API Docs">
  </a>
</p>

<p align="center">
  <a href="#what-does-the-facebook-ads-library-scraper-do">What it does</a> •
  <a href="#how-to-scrape-facebook-ads">How to use</a> •
  <a href="#what-data-can-you-extract">Data fields</a> •
  <a href="#output-example">Output</a> •
  <a href="#pricing">Pricing</a> •
  <a href="#faq">FAQ</a>
</p>

---

### What does the Facebook Ads Library Scraper do? {#what-does-the-facebook-ads-library-scraper-do}

**Facebook Ads Library Scraper** extracts ads from the [Meta Ad Library](https://www.facebook.com/ads/library/) — the public archive of every ad running across Facebook, Instagram, Messenger, and the Audience Network. Paste an Ad Library search URL or a Facebook Page URL and get clean, structured data in JSON, CSV, or Excel: the ad copy, images and videos, the call-to-action, the advertiser, how long each ad has been running, and (for EU/UK ads) audience reach and demographics. No Meta Graph API token, no login, no Business Manager.

<table>
<tr>
<td width="50%">

#### 🔍 Search or Page, your choice

Scrape an Ad Library keyword search **or** every ad a specific Facebook Page is running — mix both in one run

#### 🎨 Full ad creative

Headline, primary text, CTA, landing URL, plus every image and video (including each carousel card)

#### ⏱️ Ad duration = winning ads

Every ad gets `ad_duration_days` and `is_long_running` — sort by it to surface proven, long-running winners instantly

</td>
<td width="50%">

#### 📊 Reach & spend, parsed

EU/UK total reach, audience age & gender, plus impression/reach/spend ranges parsed into real numbers — not `"10K–15K"` text

#### 🔄 Export anywhere

JSON, CSV, Excel, XML, HTML · n8n, Zapier, Make, REST API, MCP

#### 💰 $0.50 per 1,000 ads

Pay-per-result, no monthly fee — you're billed only for the ads you actually receive

</td>
</tr>
</table>

---

### Why scrape the Facebook Ad Library?

The Meta Ad Library is the single best public source of competitor advertising intelligence — but the website only lets you scroll one ad at a time, with no export, no sorting by ad age, and the creative buried behind clicks. This scraper turns it into a spreadsheet.

**Built for:**

- 🛒 **Dropshippers & ecommerce** finding winning products and proven creatives
- 🎯 **Performance marketers** doing competitor ad research and swipe files
- 🏢 **Agencies** monitoring every ad their clients' competitors run
- ✍️ **Copywriters & creative teams** building ad inspiration libraries
- 📊 **Market researchers** tracking campaigns, messaging, and ad spend over time
- 🗳️ **Journalists & analysts** auditing political and social-issue ad transparency

---

### What data can you extract from the Facebook Ad Library? {#what-data-can-you-extract}

Each result is one ad with **70+ fields**: every native Ad Library field plus computed fields that competing scrapers don't give you. Every record also carries `scraped_at`, `search_term`, and `input_url`, so mixed datasets stay easy to filter.

| Category | Fields |
| --- | --- |
| **Ad identity** | `ad_archive_id`, `ad_id`, `collation_id`, `collation_count`, `ad_library_url` |
| **Advertiser / Page** | `page_id`, `page_name`, `page_url`, `page_profile_picture_url`, `page_like_count`, `page_categories` |
| **Status & dates** | `is_active`, `start_date` / `end_date` (+ `_iso` and formatted), **`ad_duration_days`**, **`is_long_running`** |
| **Creative (flattened)** | **`ad_text`**, **`headline`**, **`cta_text`**, `cta_type`, `link_url`, `caption`, `media_type` |
| **Media** | `image_urls[]`, `video_urls[]`, `video_preview_image_urls[]`, `image_count`, `video_count`, `card_count` |
| **Targeting & platforms** | `publisher_platform[]`, `platforms[]`, `targeted_or_reached_countries[]` |
| **Reach / spend (parsed)** | `impressions_lower`/`_upper`, `reach_lower`/`_upper`, `spend_lower`/`_upper`, `currency` |
| **EU/UK transparency** _(with Scrape ad details)_ | `advertiser`, `transparency_by_location`, `audience_total_reach`, `audience_age_min`/`_max`, `audience_gender`, `audience_countries[]` |
| **Compliance** | `categories[]`, `contains_sensitive_content`, `is_aaa_eligible`, `violation_types`, `is_violating_eu_siep` |
| **Raw** | the complete native `snapshot` object is preserved for power users |

> **The fields competitors bury, we surface.** `ad_text`, `headline`, and media URLs normally live inside a nested `snapshot` blob — we lift them to the top level so they drop straight into a spreadsheet, and we compute `ad_duration_days` so you can sort for winners in one click.

---

### How to scrape Facebook ads {#how-to-scrape-facebook-ads}

You can scrape the Ad Library two ways — use either or both in a single run.

#### Method 1: Scrape ads by keyword (Ad Library search URL)

1. Open the [Facebook Ad Library](https://www.facebook.com/ads/library/), pick a country, and search for a keyword, brand, or topic.
2. Copy the URL from your browser's address bar.
3. Paste it into the **URLs** field and run.

```json
{
  "urls": [
    { "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=skincare&search_type=keyword_unordered&media_type=all" }
  ],
  "count": 500
}
````

The scraper paginates automatically through every matching ad up to your limit.

#### Method 2: Scrape ads run by a Facebook Page

Paste a Page URL — a vanity handle (`facebook.com/nike`), a `profile.php?id=` link, or a numeric page id. The scraper resolves it to the page and pulls every ad that advertiser is running, with optional date, status, country, and sort filters.

```json
{
  "urls": [
    { "url": "https://www.facebook.com/nike" }
  ],
  "count": 0,
  "scrapePageAds.activeStatus": "active",
  "scrapePageAds.period": "last30d",
  "scrapePageAds.sortBy": "most_recent",
  "scrapePageAds.countryCode": "US"
}
```

#### Input options

| Field | What it does |
| --- | --- |
| `urls` | Ad Library search URLs and/or Facebook Page URLs (mix freely) |
| `count` | Max ads across all URLs combined. Defaults to **100**; set `0` for no limit |
| `limitPerSource` | Max ads per input URL (`0` = all) |
| `scrapeAdDetails` | Also fetch advertiser + EU/UK transparency (reach, age, gender) per ad |
| `scrapePageAds.period` | Page URLs only: `last24h`, `last7d`, `last14d`, `last30d`, or all time |
| `scrapePageAds.activeStatus` | Page URLs only: `all`, `active`, or `inactive` |
| `scrapePageAds.sortBy` | Page URLs only: `impressions_desc` or `most_recent` |
| `scrapePageAds.countryCode` | Page URLs only: 2-letter ISO code or `ALL` |
| `runTag` | Optional label copied onto every output record |

***

### Find winning ads by duration

The single most useful signal in competitor ad research is **how long an ad has been running**. Advertisers kill ads that don't convert — so an ad live for 90+ days is almost certainly profitable. The Ad Library website makes this nearly impossible to see; this scraper computes it for you:

- **`ad_duration_days`** — exact days the ad has been live (clamped to today for active ads)
- **`is_long_running`** — `true` once an ad passes 30 days

Pull a competitor's ads, sort by `ad_duration_days` descending, and the top of the list is their proven winners. That's your swipe file.

***

### Scrape EU & UK ad transparency data

Enable **Scrape ad details** to fetch Meta's transparency data for ads that ran in the EU or UK, where the Digital Services Act requires disclosure:

- `audience_total_reach` — how many people the ad actually reached
- `audience_age_min` / `audience_age_max` and `audience_gender` — who it targeted
- `audience_countries` — where it was delivered
- `advertiser` — the page's about text and ad-library spend summary

> Reach, spend, and impressions are only published by Meta for ads about social issues, elections, or politics, and for ads delivered in certain regions. Standard commercial ads won't carry them — that's a limit of the Ad Library itself, not the scraper.

***

### Output example {#output-example}

```json
{
  "ad_archive_id": "1046730950862281",
  "page_name": "Nike",
  "page_url": "https://www.facebook.com/15087023444",
  "page_like_count": 38500000,
  "is_active": true,
  "start_date_iso": "2025-12-19T08:00:00.000Z",
  "end_date_iso": null,
  "ad_duration_days": 92,
  "is_long_running": true,
  "ad_text": "Free shipping on the latest drops. Member exclusives all week.",
  "headline": "Shop Nike",
  "cta_text": "Shop now",
  "cta_type": "SHOP_NOW",
  "link_url": "https://www.nike.com/",
  "media_type": "carousel",
  "image_urls": ["https://scontent.../a.jpg", "https://scontent.../b.jpg"],
  "video_urls": [],
  "card_count": 7,
  "publisher_platform": ["FACEBOOK", "INSTAGRAM"],
  "platforms": ["facebook", "instagram"],
  "impressions_lower": 10000,
  "impressions_upper": 15000,
  "currency": "USD",
  "categories": ["UNKNOWN"],
  "ad_library_url": "https://www.facebook.com/ads/library/?id=1046730950862281",
  "search_term": "nike",
  "scraped_at": "2026-06-19T12:00:00.000Z"
}
```

***

### How much does it cost to scrape Facebook ads? {#pricing}

#### Pay-per-result model

You pay only for the ads you receive — **no monthly subscription, no platform usage fees**.

- **Per ad:** $0.0005 (**$0.50 per 1,000 ads**)

##### Example cost calculation

| Scrape | Cost |
| --- | --- |
| 1,000 ads | **$0.50** |
| 10,000 ads | **$5.00** |
| 100,000 ads | **$50.00** |

No surprises: set `count` to cap exactly how much you spend per run (it defaults to 100, never unlimited, so an automated call can't run away with your budget).

#### Why pay-per-result?

- Scrape competitor ads occasionally without a standing subscription
- Cap spend precisely with `count` and `limitPerSource`
- Pay nothing for idle time

***

### Use the Facebook Ads Library Scraper with AI agents and MCP

This scraper works as a tool for AI agents out of the box via the [Apify MCP server](https://mcp.apify.com/). Connect it to **Claude, ChatGPT, Cursor, or any MCP-compatible client** and your agent can pull a competitor's live ads, summarize their messaging, and spot their longest-running creatives on demand — no glue code.

**Typical agent workflows:**

- 🤖 "Show me every active ad \[brand] is running and which has been live longest"
- 📊 Feed scraped ad copy and creatives into an LLM for messaging and angle analysis
- 🔁 Combine with scheduled runs + webhooks for autonomous competitor-ad monitoring

The structured JSON (70+ fields per ad, with the creative already flattened) is ready for RAG pipelines and ML datasets.

***

### Integrate with n8n, Zapier, and Make

Automate your ad-intelligence pipeline by connecting this scraper to [n8n](https://n8n.io/), Zapier, or Make.

#### Synchronous run *(quick scrapes under 5 minutes)*

1. Get your token at [Apify Integrations](https://console.apify.com/account/integrations).
2. Add an HTTP Request node:
   - **Method**: `POST`
   - **URL**: `https://api.apify.com/v2/acts/harshmaur~facebook-ads-library-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN`
   - **Body** (`JSON`):

```json
{
  "urls": [{ "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=coffee&search_type=keyword_unordered&media_type=all" }],
  "count": 100
}
```

> ⚠️ The synchronous endpoint times out after **300 seconds**. For large pulls, start the run asynchronously and poll for completion (a **Wait** node in n8n is the reliable pattern), then fetch the dataset.

***

### Support

**📝 Report an issue** — directly in the Run console, so we can reproduce and fix it fast.

**📧 Email** — feature requests and detailed questions: **harshmaur@gmail.com**

> ⭐ **Happy with the data?** A quick review on the [actor page](https://apify.com/harshmaur/facebook-ads-library-scraper) helps other marketers find this scraper and keeps improvements coming.

***

### FAQ {#faq}

#### Do I need a Facebook account or Meta API key?

No. The Ad Library is a public transparency tool — this scraper needs no login, no Meta Graph API token, no Business Manager, and no app review. Paste a URL and run.

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

The Ad Library is published by Meta specifically for public transparency and contains no private user data — only what advertisers chose to show. Scraping public data is generally lawful, but your results can still contain personal data (e.g. an advertiser's name), which is protected by the GDPR in the EU and similar laws elsewhere. Only collect what you have a legitimate reason to use, and consult a lawyer if you're unsure. 📖 More on [the enforceability of terms of use](https://blog.apify.com/enforceability-of-terms-of-use/).

#### How do I scrape all ads from a specific advertiser?

Paste the advertiser's Facebook Page URL into `urls` — a vanity handle (`facebook.com/nike`), a `profile.php?id=` link, or a numeric page id all work. The scraper resolves it to the page and pulls every ad it's running. Use the `scrapePageAds.*` filters to narrow by date, status, country, or sort order.

#### How do I find a competitor's best-performing ads?

Scrape their page, then sort the output by `ad_duration_days` (highest first). Long-running ads are the ones the advertiser keeps paying for — i.e. the ones that work. `is_long_running` flags everything past 30 days.

#### Can I get ad reach, impressions, and spend?

Yes, where Meta publishes it. Reach, impressions, and spend are disclosed for ads about social issues, elections, or politics, and for ads delivered in the EU/UK. Enable **Scrape ad details** to also pull `audience_total_reach`, age, and gender for those ads. Standard commercial ads won't have these numbers — that's a limitation of the Ad Library, not the scraper.

#### How many ads can I scrape?

As many as you want — set `count` to your target (it defaults to 100; use `0` for no limit) and `limitPerSource` to cap each URL. The scraper paginates through all available results.

#### Why are some fields empty?

Meta only publishes certain fields (reach, spend, impressions, transparency) for specific ad types and regions. Empty values mean Meta didn't disclose them for that ad — the scraper returns exactly what the Ad Library exposes.

#### Can I download images and videos from the ads?

The output includes direct URLs to every image and video in each ad (`image_urls`, `video_urls`, including carousel cards). Download them from those URLs with any HTTP client or your automation tool.

***

### Related scrapers

Building a wider competitive-intelligence or data pipeline? Pair this with our other Apify scrapers:

- [**Reddit Scraper**](https://apify.com/harshmaur/reddit-scraper) — posts, comments, communities, and user profiles for social listening
- [**Indeed Jobs Scraper**](https://apify.com/harshmaur/indeed-scraper) — job listings with salary and company data
- [**LinkedIn Jobs Scraper**](https://apify.com/harshmaur/linkedin-jobs-scraper) — job-market intelligence from public LinkedIn listings

***

*Keywords: facebook ads scraper, meta ads scraper, facebook ad library scraper, scrape facebook ads, facebook ad library api, competitor ad research, ad spy tool, ad creative scraper, meta ad library export.*

# Actor input Schema

## `urls` (type: `array`):

Facebook Ad Library search URLs (from https://www.facebook.com/ads/library) and/or Facebook Page URLs to scrape the ads run by those pages. Both types can be mixed.

## `count` (type: `integer`):

Maximum number of ads to scrape across ALL input URLs combined. Defaults to 100 if left blank. Set 0 explicitly for no limit (scrape until each source runs out).

## `limitPerSource` (type: `integer`):

Maximum number of ads to scrape per input URL. Leave empty (or 0) to scrape all available ads for each URL.

## `scrapeAdDetails` (type: `boolean`):

Also fetch per-ad detail data (advertiser info + EU/UK transparency: total reach, audience age & gender, target countries). Adds one extra request per ad, so it is slower and costs more.

## `scrapePageAds.period` (type: `string`):

Only return page ads that started within this window.

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

Filter page ads by whether they are currently active.

## `scrapePageAds.sortBy` (type: `string`):

Order page ads by impressions (default) or by most recently created.

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

2-letter ISO country code (e.g. US, GB, IN) to scope page ads to one country, or ALL for every country.

## `runTag` (type: `string`):

Optional label copied to the 'runTag' field of every output record — handy for grouping results across runs.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=nike&search_type=keyword_unordered&media_type=all"
    },
    {
      "url": "https://www.facebook.com/nike"
    }
  ],
  "count": 100,
  "scrapeAdDetails": false,
  "scrapePageAds.period": "",
  "scrapePageAds.activeStatus": "all",
  "scrapePageAds.sortBy": "impressions_desc",
  "scrapePageAds.countryCode": "ALL"
}
```

# Actor output Schema

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

All scraped Facebook ads.

# 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 = {
    "urls": [
        {
            "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=nike&search_type=keyword_unordered&media_type=all"
        },
        {
            "url": "https://www.facebook.com/nike"
        }
    ],
    "count": 100,
    "scrapePageAds.period": "",
    "scrapePageAds.activeStatus": "all",
    "scrapePageAds.sortBy": "impressions_desc",
    "scrapePageAds.countryCode": "ALL"
};

// Run the Actor and wait for it to finish
const run = await client.actor("harshmaur/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 = {
    "urls": [
        { "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=nike&search_type=keyword_unordered&media_type=all" },
        { "url": "https://www.facebook.com/nike" },
    ],
    "count": 100,
    "scrapePageAds.period": "",
    "scrapePageAds.activeStatus": "all",
    "scrapePageAds.sortBy": "impressions_desc",
    "scrapePageAds.countryCode": "ALL",
}

# Run the Actor and wait for it to finish
run = client.actor("harshmaur/facebook-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 '{
  "urls": [
    {
      "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=nike&search_type=keyword_unordered&media_type=all"
    },
    {
      "url": "https://www.facebook.com/nike"
    }
  ],
  "count": 100,
  "scrapePageAds.period": "",
  "scrapePageAds.activeStatus": "all",
  "scrapePageAds.sortBy": "impressions_desc",
  "scrapePageAds.countryCode": "ALL"
}' |
apify call harshmaur/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Ads Library Scraper - Creative & Reach ($0.50/1k)",
        "description": "Scrape ads from the Facebook (Meta) Ad Library by keyword or Page - no login, no Meta API key. Full ad creative (text, images, video, CTA, link), advertiser, run dates, ad duration & EU/UK reach. $0.50 per 1,000 ads. 70+ fields per ad. Works with AI Agents, MCP, n8n, Make & Zapier.",
        "version": "0.0",
        "x-build-id": "Cr0a4Ny81y19VX5QM"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/harshmaur~facebook-ads-library-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-harshmaur-facebook-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/harshmaur~facebook-ads-library-scraper/runs": {
            "post": {
                "operationId": "runs-sync-harshmaur-facebook-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/harshmaur~facebook-ads-library-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-harshmaur-facebook-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": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "🔗 URLs",
                        "type": "array",
                        "description": "Facebook Ad Library search URLs (from https://www.facebook.com/ads/library) and/or Facebook Page URLs to scrape the ads run by those pages. Both types can be mixed.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "count": {
                        "title": "#️⃣ Total number of ads",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of ads to scrape across ALL input URLs combined. Defaults to 100 if left blank. Set 0 explicitly for no limit (scrape until each source runs out)."
                    },
                    "limitPerSource": {
                        "title": "#️⃣ Limit per input URL",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of ads to scrape per input URL. Leave empty (or 0) to scrape all available ads for each URL."
                    },
                    "scrapeAdDetails": {
                        "title": "Scrape ad details",
                        "type": "boolean",
                        "description": "Also fetch per-ad detail data (advertiser info + EU/UK transparency: total reach, audience age & gender, target countries). Adds one extra request per ad, so it is slower and costs more.",
                        "default": false
                    },
                    "scrapePageAds.period": {
                        "title": "Date range",
                        "enum": [
                            "",
                            "last24h",
                            "last7d",
                            "last14d",
                            "last30d"
                        ],
                        "type": "string",
                        "description": "Only return page ads that started within this window.",
                        "default": ""
                    },
                    "scrapePageAds.activeStatus": {
                        "title": "Active status",
                        "enum": [
                            "all",
                            "active",
                            "inactive"
                        ],
                        "type": "string",
                        "description": "Filter page ads by whether they are currently active.",
                        "default": "all"
                    },
                    "scrapePageAds.sortBy": {
                        "title": "Sort by",
                        "enum": [
                            "impressions_desc",
                            "most_recent"
                        ],
                        "type": "string",
                        "description": "Order page ads by impressions (default) or by most recently created.",
                        "default": "impressions_desc"
                    },
                    "scrapePageAds.countryCode": {
                        "title": "Country",
                        "type": "string",
                        "description": "2-letter ISO country code (e.g. US, GB, IN) to scope page ads to one country, or ALL for every country.",
                        "default": "ALL"
                    },
                    "runTag": {
                        "title": "Run tag",
                        "type": "string",
                        "description": "Optional label copied to the 'runTag' field of every output record — handy for grouping results across runs."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
