# $0.4/1K | Facebook Ads Library Scraper - Meta Ads & EU Reach (`scrapercompany/facebook-ads-library-scraper`) Actor

Scrape the Meta Ad Library: ads by keyword, advertiser page or a pasted Ad Library link with its filters. Get ad copy, links, images, videos, carousel cards, run dates and platforms, plus optional payer, beneficiary and EU reach. No login. $0.40 per 1,000 ads. Made by ScraperCompany.

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

## Pricing

from $0.40 / 1,000 ads

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Facebook Ads Library Scraper - Meta Ads and EU Reach

**Facebook Ads Library Scraper** by ScraperCompany reads Meta's public **Ad Library** (Facebook, Instagram, Messenger, Audience Network and Threads ads).

### ⭐ Like this Actor? Leave a review

If Facebook Ads Library Scraper saved you time, please [leave a review on the Store](https://apify.com/scrapercompany/facebook-ads-library-scraper/reviews). It takes a minute, helps other people find a scraper that works, and tells us what to build next.

> 🟢 **Nothing to set up:** no code, no login and no keys. Click **Try for free**, start a run, and export JSON, CSV or Excel, or pull the results through the Apify API. You pay only for results; failed and empty requests are free.

### 📦 What you get

| What you get | Price | Per 1,000 |
| --- | --- | --- |
| Meta Ad Library ads by keyword, advertiser page or pasted Ad Library link: advertiser, run dates, platforms, creative text, links, images, videos and cards | $0.0004 | $0.40 |

- 💵 **Price:** **$0.4 per 1,000** `ad` events ($0.0004 each); failed and empty requests are free.
- ⚙️ **Setup:** none. No account on the site, no cookies, no keys.
- 📁 **Export:** JSON, CSV, Excel or HTML from the **Output** tab, or the Apify API.
- 🔁 **Automate:** schedules, webhooks, Make, Zapier, n8n and AI agents (MCP).

### ✨ What can this Facebook Ad Library scraper do?

Paste an Ad Library link with any filters, a Facebook page link, an advertiser page id or keywords, and get each ad's **advertiser, run dates, platforms, copy, link, call to action, images, videos and carousel cards**, with no login. Turn on **Ad details** for **payer, beneficiary and EU reach**. Pricing is pay-per-event: **$0.40 per 1,000 ads**; searches with no ads and failed requests are free.

- **Paste any Ad Library link**: country, status, media, date, platform and language filters are kept.
- **Advertiser pages**: a Facebook page link or page id returns every ad that page runs.
- **Keyword search** with any-word or exact-phrase matching, sorted by relevance or most impressions.
- **Optional ad details**: payer and beneficiary, advertiser card, EU reach by age, gender and country.
- Up to 300 ads per batch, with batches that continue exactly where the last one stopped.

### 🚀 Quick start: how to scrape Meta Ad Library ads

1. Click **Try for free** (or open the Actor in Apify Console) and go to the **Input** tab.
2. Open <code>facebook.com/ads/library</code>, set your filters and copy the address, or enter a Facebook page link (<code>facebook.com/nike</code>), an advertiser page id, or keywords. One search per line.
3. Adjust the options if needed. Dates accept an exact date (`2026-12-01`) or a relative one (`30 days` from today), so saved tasks and schedules never go stale.
4. Click **Start** and wait for the run to finish.
5. Download the results from the **Output** tab as JSON, CSV, Excel or HTML, or fetch them with the Apify API.

💡 **Tip:** run it once with the pre-filled input to see the output, then change the input to your own.

### ⚖️ What makes it different?

| | **Facebook Ads Library Scraper** | Many alternatives |
| --- | --- | --- |
| Setup | Nothing to configure: no login, no keys | Often your own accounts, cookies or network setup |
| You pay for | Successful results; failed and empty requests are free | Often run time, or every attempt |
| When a request fails | Retried automatically, and never charged | Often an empty or failed run |

### 👥 Who uses Facebook Ad Library data?

- **Competitor research**: See every ad a competitor is running, with its copy, creative and start date.
- **Creative inspiration**: Pull the most-seen ads for a keyword and study their hooks, offers and calls to action.
- **Agencies and lead generation**: Find advertisers in a niche and how long they keep their ads running.
- **EU transparency research**: Read payer, beneficiary and EU reach by age, gender and country.

### 🧭 Common jobs

#### Track a competitor's ads

Add their Facebook page link, set Ad status to all, and schedule the run weekly to see new creatives.

#### Find the most-seen ads for a niche

Enter keywords, set Sort to total_impressions and the country you sell in.

#### Export an Ad Library search

Set up the search on facebook.com/ads/library, then paste the address as one line.

### 📋 What Facebook Ad Library data can you extract?

| Field | Description |
| --- | --- |
| `ads[].ad_archive_id / url` | The ad and its Ad Library link |
| `ads[].page_id / page_name / page_profile_url / page_like_count` | The advertiser |
| `ads[].is_active / start_date / end_date` | Whether it is running, and when it ran |
| `ads[].publisher_platforms` | Facebook, Instagram, Messenger, Audience Network, Threads |
| `ads[].title / body / caption / link_url / cta_text` | The ad copy, link and call to action |
| `ads[].images / videos / cards` | Creative URLs, including carousel cards |
| `ads[].collation_count` | How many ads share this creative |
| `ads[].spend / impressions_text / reach_estimate` | Where Meta publishes them (political and issue ads) |
| `ads[].details` | With Ad details on: payer, beneficiary, advertiser card, EU reach |
| `total_count / next_cursor` | Ad Library matches, and where the next batch starts |

Every dataset item also carries `input` (the options used for that request), `request_id` (quote it to support), `billed` and `scraped_at`.

### ⌨️ Input

| Input | Name | What it does |
| --- | --- | --- |
| `targets` | Ad Library links, pages, keywords or page ids | .??.com/nike`), an advertiser's numeric page id (`15087023444`), or keywords such as `running shoes`. |
| `maxAds`| Max ads per search | Most ads to return for each line, in the Ad Library's own order (1-300). |
|`maxPages`| Pages per search | How many batches of up to "Max ads per search" to fetch for each line (1-20). |
|`country`| Country | Where the ads were shown:`ALL`or a two-letter code such as`US`, `GB`, `DE`. |
| `active_status`| Ad status | Active ads, inactive ads, or all. Overrides a pasted link's own status. |
|`media_type`| Media type | Only ads with this kind of creative. |
|`ad_type`| Ad category | All ads, or only one of Meta's special categories: political and issue, housing, employment, or loans and other financial products. |
|`sort`| Sort |`relevance`(the Ad Library's own order) or`total_impressions`(most seen first). |
|`details`| Ad details (payer, beneficiary, EU reach) | Adds each ad's "See ad details" panel: payer and beneficiary, the advertiser card (likes, Instagram followers, verification) and, for ads shown in the EU, total reach with age, gender and country breakdowns. |
|`search_type` | Keyword matching | For keywords: any of the words (`keyword_unordered`) or the exact phrase (`keyword_exact_phrase`). |
| `start_date_min` | Shown on or after | Only ads shown on or after this date (`YYYY-MM-DD`). |
| `start_date_max` | Shown on or before | Only ads shown on or before this date (`YYYY-MM-DD`). |
| `publisher_platforms`| Platforms | Only ads shown on these platforms:`facebook`, `instagram`, `messenger`, `audience_network`, `threads`. |
| `content_languages` | Creative languages | Only ads in these languages, as two-letter codes (`en`, `es\`). |

### 📥 Input example

This is the default input; running the Actor without changes uses it.

```json
{
  "targets": [
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444&search_type=page&media_type=all"
  ],
  "maxAds": 100,
  "maxPages": 1,
  "details": false,
  "includeErrors": true,
  "maxConcurrency": 3,
  "maxRetries": 2
}
```

### 📤 Output example

One dataset item per request (trimmed here; real items contain all the fields):

```json
{
  "input": {
    "query": "nike",
    "country": "US",
    "limit": 1
  },
  "ads": [
    {
      "ad_archive_id": "1016451784037642",
      "body": "Get the gear that goes hard on and off the field.",
      "byline": null,
      "caption": "NIKE.COM",
      "cards": [
        {
          "body": "Get the gear that goes hard on and off the field.",
          "caption": "nike.com",
          "cta_text": "Shop Now",
          "cta_type": "SHOP_NOW",
          "has_media": true,
          "image_url": "https://scontent.xx.fbcdn.net/v/508839160_1795820578003799_8147925336477608418_n.jpg",
          "link_description": null,
          "link_url": "https://www.nike.com/t/tempo-shorts-toddler-shorts-Gx0CH3/267358-019?dplnk=member",
          "title": "Nike Tempo Shorts",
          "video_hd_url": null,
          "video_preview_image_url": null,
          "video_sd_url": null
        },
        {
          "body": "Get the gear that goes hard on and off the field.",
          "caption": "nike.com",
          "cta_text": "Shop Now",
          "cta_type": "SHOP_NOW",
          "has_media": true,
          "image_url": "https://scontent.xx.fbcdn.net/v/509269099_740526921689557_370794322046462071_n.jpg",
          "link_description": null,
          "link_url": "https://www.nike.com/t/air-monarch-iv-mens-workout-shoes-extra-wide-p8qNlT/416355-102?dplnk=member",
          "title": "Nike Air Monarch IV",
          "video_hd_url": null,
          "video_preview_image_url": null,
          "video_sd_url": null
        }
      ],
      "categories": [
        "UNKNOWN"
      ],
      "collation_count": null,
      "collation_id": null,
      "contains_digital_created_media": false,
      "contains_sensitive_content": false,
      "cta_text": "Shop now",
      "cta_type": "SHOP_NOW",
      "currency": null,
      "disclaimer_label": null,
      "display_format": "DPA",
      "end_date": "2025-08-28",
      "end_timestamp": 1756364400,
      "images": [],
      "impressions_text": null,
      "is_active": true,
      "link_description": null,
      "link_url": "https://www.nike.com/us/en_us",
      "page_categories": [
        "Sportswear"
      ],
      "page_id": "15087023444",
      "page_like_count": 39488946,
      "page_name": "Nike",
      "page_profile_picture_url": "https://scontent.xx.fbcdn.net/v/509357337_4088170881445143_8138324132275675252_n.jpg",
      "page_profile_url": "https://www.facebook.com/nike/",
      "publisher_platforms": [
        "facebook",
        "instagram"
      ],
      "reach_estimate": null,
      "snapshot": {
        "caption": "NIKE.COM",
        "cta_type": "SHOP_NOW",
        "display_format": "DPA",
        "page_id": "15087023444",
        "page_name": "Nike"
      },
      "spend": null,
      "start_date": "2025-06-20",
      "start_timestamp": 1750402800,
      "targeted_or_reached_countries": [],
      "title": "{{product.name}}",
      "total_active_time": null,
      "url": "https://www.facebook.com/ads/library/?id=1016451784037642",
      "videos": []
    }
  ],
  "filters": {
    "active_status": "active",
    "ad_type": "all",
    "content_languages": [],
    "countries": [
      "US"
    ],
    "media_type": "all",
    "page_id": null,
    "publisher_platforms": [],
    "query": "nike",
    "search_type": "keyword_unordered",
    "sort": "relevance",
    "start_date_max": null,
    "start_date_min": null
  },
  "has_next_page": true,
  "meta": {
    "pages": 1,
    "source": "facebook_ad_library",
    "stopped_on_time_budget": false
  },
  "next_cursor": "fbads1.eyJjIjpudWxsLCJzIjoxfQ",
  "returned": 1,
  "search_parameters": {
    "source_url": "https://www.facebook.com/ads/library/?country=US&q=nike&search_type=keyword_unordered&active_status=active&ad_type=all&media_type=all"
  },
  "total_count": 26706,
  "request_id": "req_3f9c0d6e2b8a4c1f9e7d5b3a1c0e8f6d",
  "billed": true,
  "scraped_at": "2026-10-01T14:03:27.512Z"
}
```

A request that fails is saved with an `error` message instead (turn off **Include failed requests** to skip those). Failed requests are never charged.

### 💰 How much does it cost to scrape Meta Ad Library ads?

This Actor uses **pay-per-event** pricing: you pay for successful requests, not for compute time.

| Event | Charged when | Price | Per 1,000 |
| --- | --- | --- | --- |
| `ad` | One ad returned from the Meta Ad Library: advertiser, run dates, platforms, copy, link, call to action, images, videos and carousel cards. | $0.0004 | $0.40 |
| `ad-details` | The "See ad details" panel for one ad, only with "Ad details" on: payer and beneficiary, the advertiser card, and EU reach with age, gender and country breakdowns where Meta publishes them. | $0.002 | $2.00 |

The **$0.4/1K** in the title is the price of 1,000 `ad` events.

#### Cost examples

| Job | Cost |
| --- | --- |
| 1,000 ads from 10 competitors | **$0.40** |
| 100 ads with EU details | **$0.24** |
| 10 competitors weekly for a year, 50 ads each | **$10.40** |

Apify's $5 of free monthly usage covers about **12,500** `ad` events.

- ✅ Failed requests (errors, invalid input, a site refusing after retries) are **free**.
- ✅ Requests where the source returns nothing at all (no results, nothing priced) are saved but **not charged**.
- ✅ Set **Maximum cost per run** when you start a run and the Actor stops cleanly before going over it.

### 🔌 Integrations

#### ⏰ Schedules and webhooks

Use Apify **Schedules** to repeat a run hourly, daily or weekly and compare results over time, and **webhooks** or the **Integrations** tab to push new results to Make, Zapier, n8n, Google Sheets, Slack or your own warehouse.

#### 🤖 AI agents and MCP

Results are structured JSON, so they are easy to feed to a model. AI agents such as Claude can run this Actor and read its results through the [Apify MCP server](https://mcp.apify.com).

#### 💻 API: JavaScript and Python

Call the Actor from any language through the [Apify API](https://docs.apify.com/api/v2). With the JavaScript client (`npm install apify-client`):

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('scrapercompany/facebook-ads-library-scraper').call({
    "targets": [
        "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444&search_type=page&media_type=all"
    ]
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

With Python (`pip install apify-client`):

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("scrapercompany/facebook-ads-library-scraper").call(run_input={
    "targets": ["https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444&search_type=page&media_type=all"],
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

### ❓ FAQ

#### Do I need an account on the site, or an API key?

No. The Actor is ready to run as is, and you only pay the per-event prices above.

#### Do I need a Facebook account or cookies?

No. The Actor reads the public Ad Library, signed out.

#### Can I search by advertiser name?

Meta keeps advertiser-name search for signed-in users. Use the advertiser's Facebook page link or page id instead, or a keyword.

#### Why are spend and impressions empty?

Meta publishes spend, impressions and reach ranges for political and issue ads. For other ads, turn on Ad details to get EU reach where the ad ran in the EU.

#### Why do some titles read {{product.name}}?

Catalog ads show Meta's template text; the product names and links are in each ad's cards.

#### How many ads can I get?

Up to 300 per batch and 20 batches per search line. Each batch continues where the last one stopped.

#### Is it legal to scrape Meta Ad Library ads?

The Actor collects publicly available information that anyone can see without logging in. You are responsible for how you use the results: respect the source site's terms, copyright and privacy law (such as GDPR) and do not collect personal data without a lawful basis. If in doubt, ask a lawyer.

#### What happens when a request fails?

Failed attempts are retried automatically. If a request still fails it is saved with the error message and not charged, and the rest of the batch keeps going. A run only fails when every request failed.

#### Why did a request return an error?

Read the `error` field: it says what was wrong with the input, for example a malformed date or an unknown id. Fix it and run again; failed requests cost nothing.

#### How many requests can I run at once?

Any number per run. The Actor sends up to 3 requests in parallel by default (change it under **Run options**); larger batches simply take longer.

### 🔗 Related scrapers

- [Facebook Events Scraper](https://apify.com/scrapercompany/facebook-events-scraper): public city and Page events
- [Instagram Scraper](https://apify.com/scrapercompany/instagram-scraper): profiles, posts and hashtags
- [TikTok Scraper](https://apify.com/scrapercompany/tiktok-scraper): profiles, videos and hashtags
- [Google Search Scraper](https://apify.com/scrapercompany/google-search-scraper): search results and ads

### 📝 Tried it? Tell others

Once you have run Facebook Ads Library Scraper, a [short review on the Store](https://apify.com/scrapercompany/facebook-ads-library-scraper/reviews) helps the next person decide.

### 💬 Support

Questions, a field you need, or a site that stopped working? Open an issue on the **Issues** tab. Include the `request_id` from the dataset item so we can trace the request. We read every issue.

# Changelog

This Actor's version history is a separate document: https://apify.com/scrapercompany/facebook-ads-library-scraper/changelog.md

# Actor input Schema

## `targets` (type: `array`):

One search per line: an Ad Library link copied from the address bar (<code>facebook.com/ads/library/?…</code>, all its filters are kept), a single ad link (<code>…/ads/library/?id=…</code>), a Facebook page link (<code>facebook.com/nike</code>), an advertiser's numeric page id (<code>15087023444</code>), or keywords such as <code>running shoes</code>.

## `maxAds` (type: `integer`):

Most ads to return for each line, in the Ad Library's own order (1-300). You pay per ad returned, so this caps the cost per line ($0.04 for 100). For more than 300, raise "Pages per search".

## `maxPages` (type: `integer`):

How many batches of up to "Max ads per search" to fetch for each line (1-20). Each batch continues exactly where the last one stopped; paging stops early when the results run out.

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

Where the ads were shown: <code>ALL</code> or a two-letter code such as <code>US</code>, <code>GB</code>, <code>DE</code>. Overrides the country in a pasted link.

## `active_status` (type: `string`):

Active ads, inactive ads, or all. Overrides a pasted link's own status.

## `media_type` (type: `string`):

Only ads with this kind of creative.

## `ad_type` (type: `string`):

All ads, or only one of Meta's special categories: political and issue, housing, employment, or loans and other financial products.

## `sort` (type: `string`):

<code>relevance</code> (the Ad Library's own order) or <code>total_impressions</code> (most seen first).

## `details` (type: `boolean`):

Adds each ad's "See ad details" panel: payer and beneficiary, the advertiser card (likes, Instagram followers, verification) and, for ads shown in the EU, total reach with age, gender and country breakdowns. One more charge per ad ($0.002); "Max ads per search" goes up to 100.

## `search_type` (type: `string`):

For keywords: any of the words (<code>keyword_unordered</code>) or the exact phrase (<code>keyword_exact_phrase</code>).

## `start_date_min` (type: `string`):

Only ads shown on or after this date (<code>YYYY-MM-DD</code>).

## `start_date_max` (type: `string`):

Only ads shown on or before this date (<code>YYYY-MM-DD</code>).

## `publisher_platforms` (type: `array`):

Only ads shown on these platforms: <code>facebook</code>, <code>instagram</code>, <code>messenger</code>, <code>audience_network</code>, <code>threads</code>.

## `content_languages` (type: `array`):

Only ads in these languages, as two-letter codes (<code>en</code>, <code>es</code>).

## `customRequests` (type: `array`):

Optional list of JSON objects, one request each, using the field names shown above. Each object is merged over the options above, so you only need to give what differs. Each object needs one of <code>url</code>, <code>query</code> or <code>page_id</code>. Example: <code>{"query":"running shoes","country":"US","limit":200,"sort":"total_impressions"}</code>

## `includeErrors` (type: `boolean`):

When on, a request that fails (for example an unknown property id) is saved as a dataset item with an <code>error</code> message so you can see what went wrong. Failed requests are never charged.

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

How many requests run at the same time (1-8). Parallel runs share one limit, so extra requests wait for a free slot instead of failing.

## `maxRetries` (type: `integer`):

How many times a request that failed for a temporary reason is tried again right away. A request still failing then gets one more try at the end of the run, after a 30-second pause. Invalid input is never retried.

## Actor input object example

```json
{
  "targets": [
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444&search_type=page&media_type=all"
  ],
  "maxAds": 50,
  "maxPages": 1,
  "details": false,
  "includeErrors": true,
  "maxConcurrency": 3,
  "maxRetries": 2
}
```

# Actor output Schema

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

One dataset item per request.

## `summary` (type: `string`):

Counts of succeeded, failed, skipped and charged requests.

# 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 = {
    "targets": [
        "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444&search_type=page&media_type=all"
    ],
    "maxAds": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapercompany/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 = {
    "targets": ["https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444&search_type=page&media_type=all"],
    "maxAds": 50,
}

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

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "targets": [
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444&search_type=page&media_type=all"
  ],
  "maxAds": 50
}' |
apify call scrapercompany/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapercompany/facebook-ads-library-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/yxiX8wCFkzktyGLuw/builds/Q0bruccHqu4II07s4/openapi.json
