# Meta Ads (Facebook & Instagram) Scraper (`lurkapi/meta-ads-facebook-instagram-scraper`) Actor

Scrape ads from the Meta Ad Library by URL, keyword, page or ad ID. Filter by country, language, platform, media type, dates and category. Optional add-ons: EU transparency demographics and media downloads.

- **URL**: https://apify.com/lurkapi/meta-ads-facebook-instagram-scraper.md
- **Developed by:** [LurkAPI](https://apify.com/lurkapi) (community)
- **Categories:** E-commerce, Lead generation, Social media
- **Stats:** 5 total users, 2 monthly users, 95.1% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 ad scrapeds

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 (Facebook & Instagram) Scraper

Scrape ads from Meta's public Ad Library by URL, search keyword, ad ID, or advertiser page. Filter by country, language, platform, media type, date range, and category. Optional add-ons download ad creatives and add audience demographics where Meta exposes them.

### 🎬 What it does

Give it any Meta Ad Library input, and it will:

1. **Scrape as many ads as you want** from any input, capped by your **Maximum number of ads** setting. Handles pagination behind the scenes.
2. **Return clean data** for each ad: archive ID, advertiser page, ad text, call to action, link, dates, platforms, image and video URLs, plus more than 30 other fields.
3. **Optionally download the images and videos**: ad images and SD or HD videos saved straight into your run's storage.
4. **Optionally add transparency data**: spend, impressions, and audience demographics where Meta exposes them (political, housing, employment, and financial ads).

It handles Meta's bot defenses for you.

### 📋 How to use it

#### Step 1: Pick your input

You can mix any of these in one run. Results are de-duplicated across sources.

- **Ads Library URLs**: paste any link from `facebook.com/ads/library`. Set your filters on the Meta site first, then copy the URL.
- **Search keyword**: type a keyword in the Search field and use the filter section to pick country, language, platforms, media type, active status, dates, and category.
- **Ad archive IDs**: paste one or more numeric ad IDs and the actor will look each one up.
- **Page IDs**: paste numeric Facebook Page IDs to scrape every ad the page has run.

#### Step 2: Set limits and add-ons

- Set **Maximum number of ads** to control cost. Default is 100; raise it for bigger runs.
- Tick any **paid add-ons** you want: transparency demographics, save images, save SD videos, save HD videos. Each add-on is billed only when it returns a real result for a row.
- Untick any **output fields** you do not need. Hidden fields are removed from each row so your output stays small.

#### Step 3: Run and get results

Hit Start. Rows appear in the Output tab as they are pulled. Results are grouped into five tabs: Overview, Ads, Advertiser, Media, Transparency. Saved image and video files appear under Files.

Every row has a **status** field. `Success` means the ad was scraped cleanly. `Age-gated: media requires login...` means Meta blocks the creative for that ad without an account; the metadata is still included.

### 💰 Pricing

You only pay for what you get. Every event is billed per result.

| Event | Rate | When it fires |
|---|---|---|
| Ad scraped | $0.50 / 1,000 | Once per ad row returned |
| Transparency add-on | $2.00 / 1,000 | When Meta exposes audience data for that ad |
| Save image | $0.50 / 1,000 | Once per image saved to your storage |
| Save SD video | $1.00 / 1,000 | Once per SD video saved |
| Save HD video | $2.00 / 1,000 | Once per HD video saved |

Add-ons only fire when they return a real result, so a run on commercial ads with the transparency add-on enabled will not be charged for transparency if Meta does not expose the data.

### 💡 Good to know

- Search keywords match ad copy text. If your keyword is a brand name and returns few results, the actor automatically looks for advertiser pages with that name and includes their ads too.
- Meta caps results to the last 30 days unless you set a date range. Use the Start date filters to scan further back.
- `Impressions: high to low` is the default sort because it is the most reliable. `Most recent` is supported but Meta pagination on that sort can be inconsistent on larger runs.
- Spend and impression ranges are returned by Meta only for special-category ads (political, housing, employment, financial). For commercial ads these fields are null.
- Files are stored in your Apify storage. How long they are kept depends on your Apify plan.

### ❓ FAQ

**Why does one ad show "Age-gated"?**
Meta hides the creative on age-gated ads (alcohol, medical, and similar categories) unless you are logged in. The actor still returns every other field for these rows but the media URLs come back empty.

**My keyword returned very few ads. Is the actor broken?**
The actor automatically detects this and looks for advertiser pages whose name matches your keyword. If your keyword is a brand name like `medvi`, results may be scattered across several brand pages; the actor finds them and pulls ads from each.

**My run took longer than expected.**
Larger runs need more requests. Lower **Maximum number of ads** to cap each run, or split a wide search by date window or country into several shorter runs.

**Can I download images and videos in one run?**
Yes. Tick the save add-ons in the Input form. Saved files appear in the Files tab and the row's `savedImageKeys`, `savedVideoSdKey`, and `savedVideoHdKey` fields point to them.

**What if a URL is blocked or unsupported?**
The actor pushes a row with a clear `status` explaining what happened, so a run with no scraped ads always tells you why.

**What does a `status: "Partial: ..."` row mean?**
Meta's CDN occasionally throttles individual image downloads. The actor retries every image up to four times across different IPs before giving up. When some images still fail, the row's `status` says `Partial: N/M images saved...` and the URLs that did not download appear in `imageUrlsNotSaved`. You can retry those URLs later or rerun the actor. We only charge for the images we actually saved.

### 🔗 Other tools you might like

- [TikTok Shop Scraper](https://apify.com/lurkapi/tiktok-shop-scraper)
- [Google Ads Scraper](https://apify.com/lurkapi/google-ads-scraper)
- [Google Shopping Ads Spy Scraper](https://apify.com/lurkapi/google-shopping-ads-spy-scraper)

### ⚖️ Disclaimer

This tool is intended for personal, research, and educational use. You are responsible for complying with Meta's Terms of Service and applicable laws in your jurisdiction. The developer is not liable for misuse. Data availability depends on Meta at run time.

**Keywords:** facebook ads scraper, meta ads scraper, instagram ads scraper, facebook ad library scraper, meta ad library api, ads transparency scraper, competitor ads scraper

# Actor input Schema

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

Paste one or more URLs from facebook.com/ads/library. Any share-link or search URL works.
## `searchQuery` (type: `array`):

One keyword per line (e.g. 'Nike running shoes', 'Adidas'). Each keyword is scraped separately; results are merged.
## `adIds` (type: `array`):

List of numeric Ad archive IDs (e.g. 1234567890123). One ID returns exactly one row — the requested ad.
## `pageIds` (type: `array`):

List of Facebook Page IDs (numeric) or @handles (e.g. 'nike', 'coca-cola'). We scrape every ad each page has run.
## `country` (type: `array`):

Pick one or more countries. Defaults to Worldwide.
## `contentLanguages` (type: `array`):

ISO 639-1 language codes (e.g. en, es, fr).
## `publisherPlatforms` (type: `array`):

Which Meta surfaces the ad ran on.
## `mediaType` (type: `string`):

Filter by ad creative type.
## `activeStatus` (type: `string`):

Whether the ad is currently running.
## `adCategory` (type: `string`):

Meta's special categories. 'All' includes everything; the others restrict to that special category (audience demographics are exposed by Meta only for these).
## `dateFrom` (type: `string`):

Only ads whose first impression is on or after this date. YYYY-MM-DD. Leave empty for no lower bound.
## `dateTo` (type: `string`):

Only ads whose first impression is on or before this date. YYYY-MM-DD. Set both date fields to scan further back than Meta's default 30-day window.
## `sortBy` (type: `string`):

'Impressions: high to low' is the most reliable default. 'Most recent' is supported for time-sensitive monitoring.
## `maxItems` (type: `integer`):

Hard cap on ads scraped across all inputs. Use this to control cost.
## `includeTransparency` (type: `boolean`):

Adds age, gender, region breakdown and total reach where Meta exposes them (special-category ads, EU runs). Billed per row where data is returned. See the Pricing tab for rates.
## `saveImages` (type: `boolean`):

Downloads every ad image into the run's key-value store. Billed per saved image.
## `saveVideosSd` (type: `boolean`):

Downloads SD-quality video files. Billed per saved SD video.
## `saveVideosHd` (type: `boolean`):

Downloads HD-quality video files when Meta exposes them. Billed per saved HD video.
## `outputAdText` (type: `boolean`):

Include the ad's body text in each row.
## `outputCta` (type: `boolean`):

Include CTA button text, link, domain, headline and sub-headline.
## `outputPlatforms` (type: `boolean`):

Include the list of Meta surfaces (Facebook, Instagram, Audience Network, Messenger) the ad ran on.
## `outputMediaUrls` (type: `boolean`):

Include preview image and video URLs found in the ad creative.
## `outputDates` (type: `boolean`):

Include the ad's first impression date, end date and creation timestamp.
## `outputPageInfo` (type: `boolean`):

Include the advertiser's Facebook page metadata.
## `outputPageInstagram` (type: `boolean`):

Include the advertiser's linked Instagram handle and follower count when exposed.
## `outputLanguages` (type: `boolean`):

Include the languages Meta detected in the ad creative.
## `outputSpendImpressions` (type: `boolean`):

Include spend and impression ranges. Meta only exposes these for political, housing, employment and financial ads.
## `outputPolitical` (type: `boolean`):

Include political/issue-ad specific fields when present.
## `outputSnapshotUrl` (type: `boolean`):

Include the URL of the Ads Library snapshot iframe so you can open any ad in your browser.

## Actor input object example

```json
{
  "startUrls": [],
  "searchQuery": [
    "Nike"
  ],
  "adIds": [],
  "pageIds": [],
  "country": [
    "ALL"
  ],
  "contentLanguages": [],
  "publisherPlatforms": [],
  "mediaType": "all",
  "activeStatus": "active",
  "adCategory": "all",
  "sortBy": "impressions_high_to_low",
  "maxItems": 10,
  "includeTransparency": false,
  "saveImages": false,
  "saveVideosSd": false,
  "saveVideosHd": false,
  "outputAdText": true,
  "outputCta": true,
  "outputPlatforms": true,
  "outputMediaUrls": true,
  "outputDates": true,
  "outputPageInfo": true,
  "outputPageInstagram": true,
  "outputLanguages": true,
  "outputSpendImpressions": true,
  "outputPolitical": true,
  "outputSnapshotUrl": true
}
````

# Actor output Schema

## `overview` (type: `string`):

One row per ad with the headline fields.

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

Ad copy, CTA and platform details.

## `advertiser` (type: `string`):

Page-level metadata for each ad's advertiser.

## `media` (type: `string`):

Image and video URLs plus saved-file keys when the media add-ons are enabled.

## `transparency` (type: `string`):

Spend, impressions and audience demographics where Meta exposes them.

## `keyValueStore` (type: `string`):

Downloaded ad images and videos when the save add-ons are enabled.

# 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 = {
    "startUrls": [],
    "searchQuery": [
        "Nike"
    ],
    "adIds": [],
    "pageIds": [],
    "country": [
        "ALL"
    ],
    "contentLanguages": [],
    "publisherPlatforms": [],
    "mediaType": "all",
    "activeStatus": "active",
    "adCategory": "all",
    "dateFrom": "",
    "dateTo": "",
    "sortBy": "impressions_high_to_low",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("lurkapi/meta-ads-facebook-instagram-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 = {
    "startUrls": [],
    "searchQuery": ["Nike"],
    "adIds": [],
    "pageIds": [],
    "country": ["ALL"],
    "contentLanguages": [],
    "publisherPlatforms": [],
    "mediaType": "all",
    "activeStatus": "active",
    "adCategory": "all",
    "dateFrom": "",
    "dateTo": "",
    "sortBy": "impressions_high_to_low",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("lurkapi/meta-ads-facebook-instagram-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 '{
  "startUrls": [],
  "searchQuery": [
    "Nike"
  ],
  "adIds": [],
  "pageIds": [],
  "country": [
    "ALL"
  ],
  "contentLanguages": [],
  "publisherPlatforms": [],
  "mediaType": "all",
  "activeStatus": "active",
  "adCategory": "all",
  "dateFrom": "",
  "dateTo": "",
  "sortBy": "impressions_high_to_low",
  "maxItems": 10
}' |
apify call lurkapi/meta-ads-facebook-instagram-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Meta Ads (Facebook & Instagram) Scraper",
        "description": "Scrape ads from the Meta Ad Library by URL, keyword, page or ad ID. Filter by country, language, platform, media type, dates and category. Optional add-ons: EU transparency demographics and media downloads.",
        "version": "0.0",
        "x-build-id": "iMRGf949HI0ztdW3y"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/lurkapi~meta-ads-facebook-instagram-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-lurkapi-meta-ads-facebook-instagram-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/lurkapi~meta-ads-facebook-instagram-scraper/runs": {
            "post": {
                "operationId": "runs-sync-lurkapi-meta-ads-facebook-instagram-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/lurkapi~meta-ads-facebook-instagram-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-lurkapi-meta-ads-facebook-instagram-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",
                "properties": {
                    "startUrls": {
                        "title": "Ads Library URLs",
                        "type": "array",
                        "description": "Paste one or more URLs from facebook.com/ads/library. Any share-link or search URL works.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchQuery": {
                        "title": "Search keywords",
                        "type": "array",
                        "description": "One keyword per line (e.g. 'Nike running shoes', 'Adidas'). Each keyword is scraped separately; results are merged.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "adIds": {
                        "title": "Ad archive IDs",
                        "type": "array",
                        "description": "List of numeric Ad archive IDs (e.g. 1234567890123). One ID returns exactly one row — the requested ad.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "pageIds": {
                        "title": "Page IDs or @handles",
                        "type": "array",
                        "description": "List of Facebook Page IDs (numeric) or @handles (e.g. 'nike', 'coca-cola'). We scrape every ad each page has run.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "country": {
                        "title": "Country",
                        "type": "array",
                        "description": "Pick one or more countries. Defaults to Worldwide.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "ALL",
                                "AR",
                                "AU",
                                "AT",
                                "BE",
                                "BR",
                                "CA",
                                "CL",
                                "CN",
                                "CO",
                                "CZ",
                                "DK",
                                "EG",
                                "FI",
                                "FR",
                                "DE",
                                "GR",
                                "HK",
                                "HU",
                                "IN",
                                "ID",
                                "IE",
                                "IL",
                                "IT",
                                "JP",
                                "MY",
                                "MX",
                                "NL",
                                "NZ",
                                "NG",
                                "NO",
                                "PE",
                                "PH",
                                "PL",
                                "PT",
                                "RO",
                                "RU",
                                "SA",
                                "SG",
                                "ZA",
                                "KR",
                                "ES",
                                "SE",
                                "CH",
                                "TW",
                                "TH",
                                "TR",
                                "UA",
                                "AE",
                                "GB",
                                "US",
                                "VN"
                            ],
                            "enumTitles": [
                                "🌍 Worldwide",
                                "Argentina",
                                "Australia",
                                "Austria",
                                "Belgium",
                                "Brazil",
                                "Canada",
                                "Chile",
                                "China",
                                "Colombia",
                                "Czech Republic",
                                "Denmark",
                                "Egypt",
                                "Finland",
                                "France",
                                "Germany",
                                "Greece",
                                "Hong Kong",
                                "Hungary",
                                "India",
                                "Indonesia",
                                "Ireland",
                                "Israel",
                                "Italy",
                                "Japan",
                                "Malaysia",
                                "Mexico",
                                "Netherlands",
                                "New Zealand",
                                "Nigeria",
                                "Norway",
                                "Peru",
                                "Philippines",
                                "Poland",
                                "Portugal",
                                "Romania",
                                "Russia",
                                "Saudi Arabia",
                                "Singapore",
                                "South Africa",
                                "South Korea",
                                "Spain",
                                "Sweden",
                                "Switzerland",
                                "Taiwan",
                                "Thailand",
                                "Turkey",
                                "Ukraine",
                                "United Arab Emirates",
                                "United Kingdom",
                                "United States",
                                "Vietnam"
                            ]
                        },
                        "default": [
                            "ALL"
                        ]
                    },
                    "contentLanguages": {
                        "title": "Content languages",
                        "type": "array",
                        "description": "ISO 639-1 language codes (e.g. en, es, fr).",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "publisherPlatforms": {
                        "title": "Publisher platforms",
                        "type": "array",
                        "description": "Which Meta surfaces the ad ran on.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "facebook",
                                "instagram",
                                "audience_network",
                                "messenger"
                            ],
                            "enumTitles": [
                                "Facebook",
                                "Instagram",
                                "Audience Network",
                                "Messenger"
                            ]
                        },
                        "default": []
                    },
                    "mediaType": {
                        "title": "Media type",
                        "enum": [
                            "all",
                            "image",
                            "image_and_meme",
                            "video",
                            "meme",
                            "none"
                        ],
                        "type": "string",
                        "description": "Filter by ad creative type.",
                        "default": "all"
                    },
                    "activeStatus": {
                        "title": "Active status",
                        "enum": [
                            "active",
                            "inactive",
                            "all"
                        ],
                        "type": "string",
                        "description": "Whether the ad is currently running.",
                        "default": "active"
                    },
                    "adCategory": {
                        "title": "Ad category",
                        "enum": [
                            "all",
                            "housing_and_real_estate_ads",
                            "employment_ads",
                            "credit_ads",
                            "political_and_issue_ads"
                        ],
                        "type": "string",
                        "description": "Meta's special categories. 'All' includes everything; the others restrict to that special category (audience demographics are exposed by Meta only for these).",
                        "default": "all"
                    },
                    "dateFrom": {
                        "title": "Start date (from)",
                        "type": "string",
                        "description": "Only ads whose first impression is on or after this date. YYYY-MM-DD. Leave empty for no lower bound."
                    },
                    "dateTo": {
                        "title": "Start date (to)",
                        "type": "string",
                        "description": "Only ads whose first impression is on or before this date. YYYY-MM-DD. Set both date fields to scan further back than Meta's default 30-day window."
                    },
                    "sortBy": {
                        "title": "Sort",
                        "enum": [
                            "impressions_high_to_low",
                            "most_recent"
                        ],
                        "type": "string",
                        "description": "'Impressions: high to low' is the most reliable default. 'Most recent' is supported for time-sensitive monitoring.",
                        "default": "impressions_high_to_low"
                    },
                    "maxItems": {
                        "title": "Maximum number of ads",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Hard cap on ads scraped across all inputs. Use this to control cost.",
                        "default": 100
                    },
                    "includeTransparency": {
                        "title": "📊 EU transparency demographics",
                        "type": "boolean",
                        "description": "Adds age, gender, region breakdown and total reach where Meta exposes them (special-category ads, EU runs). Billed per row where data is returned. See the Pricing tab for rates.",
                        "default": false
                    },
                    "saveImages": {
                        "title": "🖼️ Save ad images to storage",
                        "type": "boolean",
                        "description": "Downloads every ad image into the run's key-value store. Billed per saved image.",
                        "default": false
                    },
                    "saveVideosSd": {
                        "title": "🎬 Save SD videos to storage",
                        "type": "boolean",
                        "description": "Downloads SD-quality video files. Billed per saved SD video.",
                        "default": false
                    },
                    "saveVideosHd": {
                        "title": "🎥 Save HD videos to storage",
                        "type": "boolean",
                        "description": "Downloads HD-quality video files when Meta exposes them. Billed per saved HD video.",
                        "default": false
                    },
                    "outputAdText": {
                        "title": "Ad text / body copy",
                        "type": "boolean",
                        "description": "Include the ad's body text in each row.",
                        "default": true
                    },
                    "outputCta": {
                        "title": "Call to action (text, URL, headline, description)",
                        "type": "boolean",
                        "description": "Include CTA button text, link, domain, headline and sub-headline.",
                        "default": true
                    },
                    "outputPlatforms": {
                        "title": "Publisher platforms",
                        "type": "boolean",
                        "description": "Include the list of Meta surfaces (Facebook, Instagram, Audience Network, Messenger) the ad ran on.",
                        "default": true
                    },
                    "outputMediaUrls": {
                        "title": "Image / video URLs",
                        "type": "boolean",
                        "description": "Include preview image and video URLs found in the ad creative.",
                        "default": true
                    },
                    "outputDates": {
                        "title": "Start, end and creation dates",
                        "type": "boolean",
                        "description": "Include the ad's first impression date, end date and creation timestamp.",
                        "default": true
                    },
                    "outputPageInfo": {
                        "title": "Advertiser page (name, URL, category, likes, verified)",
                        "type": "boolean",
                        "description": "Include the advertiser's Facebook page metadata.",
                        "default": true
                    },
                    "outputPageInstagram": {
                        "title": "Instagram account info",
                        "type": "boolean",
                        "description": "Include the advertiser's linked Instagram handle and follower count when exposed.",
                        "default": true
                    },
                    "outputLanguages": {
                        "title": "Detected ad languages",
                        "type": "boolean",
                        "description": "Include the languages Meta detected in the ad creative.",
                        "default": true
                    },
                    "outputSpendImpressions": {
                        "title": "Spend & impressions (special-category ads only)",
                        "type": "boolean",
                        "description": "Include spend and impression ranges. Meta only exposes these for political, housing, employment and financial ads.",
                        "default": true
                    },
                    "outputPolitical": {
                        "title": "Political ad metadata (sponsors, payers, audience)",
                        "type": "boolean",
                        "description": "Include political/issue-ad specific fields when present.",
                        "default": true
                    },
                    "outputSnapshotUrl": {
                        "title": "Ad snapshot URL (Meta's iframe)",
                        "type": "boolean",
                        "description": "Include the URL of the Ads Library snapshot iframe so you can open any ad in your browser.",
                        "default": true
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
