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

Scrape Facebook Ads Library data including advertisers, ad creatives, copy, landing pages, active dates, platforms, and ad details. Analyze competitor campaigns, discover winning creatives, research advertising trends, and gain actionable marketing intelligence.

- **URL**: https://apify.com/api-empire/facebook-ads-library-scraper.md
- **Developed by:** [API Empire](https://apify.com/api-empire) (community)
- **Categories:** Social media, Automation, Agents
- **Stats:** 100 total users, 8 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $4.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 — Extract Ads, Creatives and Pages

Facebook Ads Library Scraper pulls structured data straight from Meta's public Ad Library: every matching ad, its creative (images, video, carousel cards, copy), and the advertiser's page context, in one run. Point it at a Facebook Page URL or an Ad Library search link and it returns typed, normalized JSON — no HTML, no selectors, no login required. Filter by country, activity status, and time window, or switch to count-only mode for a fast audit. After reading this, you'll know exactly which fields you get and how to wire them into a script, dashboard, or agent.

### What is Facebook Ads Library Scraper?

Facebook Ads Library Scraper is an Apify Actor that scrapes Meta's public Ad Library — the ad-transparency archive Meta operates for Facebook, Instagram, Messenger, and Audience Network. It runs fully logged out: no Facebook account, password, or session cookie is required. Give it a Page URL or an Ad Library search link and it returns one structured record per ad, enriched with the advertiser's page context and, optionally, a deeper per-ad details lookup.

- Scrape **ads** — creative, timing, status, and platform placement for any Page or search
- Scrape **ad creative/media** — body text, title, CTA, link, images, video, and carousel cards
- Scrape **advertiser page info** — page name, ID, categories, like count, and an optional "about" snippet
- Export as JSON, CSV, or Excel through the Apify dataset
- No proxy setup required — residential routing is handled for you when you turn it on

### What data does Facebook Ads Library Scraper collect?

Every run returns three kinds of data in the same dataset row — the ad itself, its creative/media, and the advertiser's page context — plus transparency fields Meta discloses only for political and issue ads.

| Data Type | Key Fields | JSON Field Names |
| --- | --- | --- |
| Ads | archive ID, run dates, active status, platforms, variant count | `adArchiveID`, `startDateFormatted`, `endDateFormatted`, `isActive`, `publisherPlatform`, `collationCount` |
| Ad creative / media | body text, title, CTA, link URL, images, video, carousel cards | `snapshot.body`, `snapshot.title`, `snapshot.ctaText`, `snapshot.linkUrl`, `snapshot.images`, `snapshot.videos`, `snapshot.cards` |
| Advertiser / page info | page name, ID, URL, about text, categories, like count | `pageInfo.page.name`, `pageInfo.page.id`, `pageInfo.page.url`, `pageInfo.page.about`, `snapshot.pageCategories`, `snapshot.pageLikeCount` |
| Transparency data (political/issue ads only) | reach estimate, spend range, currency, impressions bucket | `reachEstimate`, `spend`, `currency`, `impressionsWithIndex` |

#### Need more Facebook data?

Pair this with **Facebook Page Posts Scraper** if you also want a brand's organic content — text, media previews, and engagement signals — alongside its paid activity. If you need the actual image assets a page has posted rather than its ads, **Facebook Photos Scraper** pulls direct photo URLs, permalinks, and Facebook's own accessibility captions.

### How does Facebook Ads Library Scraper differ from the official Facebook API?

Meta operates the Ad Library API as the official, public route into this same ad-transparency data. It requires a Meta developer account and app review, plus identity verification before Meta grants access to political and issue ad data; once approved, it returns a documented set of fields that you page through yourself. Facebook Ads Library Scraper requires none of that setup — paste a source URL and run.

| Feature | Meta Ad Library API | Facebook Ads Library Scraper |
| --- | --- | --- |
| Access requirement | Meta developer account, app review, identity verification for political/issue ads | No Facebook login or developer account needed |
| Setup time | App registration and review before your first call | Paste a source URL and start the run |
| Entity coverage | Ads only, via the endpoints Meta documents | Ads, ad creative/media, and advertiser page context in one dataset row |
| Political/issue ad fields | Spend, reach, and impressions available where Meta discloses them | Same Meta-side restriction — `spend`, `reachEstimate`, and `impressionsWithIndex` are populated only for political/issue ads, `null` otherwise |
| Output handling | Raw API JSON; pagination and field mapping are your responsibility | Auto-paginated dataset, ready for JSON, CSV, or Excel export |
| Volume control | Governed by Meta's API access terms | Controlled by your own `resultsLimit` and Apify plan |

Use the Meta Ad Library API directly if you're building inside Meta's own developer ecosystem and can clear its review process. Use Facebook Ads Library Scraper when you want the same public ad data without an app-review cycle, already normalized into one row per ad.

### Why do developers and teams scrape Facebook Ads Library?

#### For marketers and brand teams

Ad-strategy and brand teams use Facebook Ads Library Scraper to see exactly what a competitor is running right now — which creatives, on which platforms (`publisherPlatform`), for how long (`totalActiveTime`), and how many variants (`collationCount`). Point the Actor at a competitor's Page URL, pull every active and inactive ad, and compare messaging, CTAs (`snapshot.ctaText`), and creative formats over a chosen `period`. Because the data comes back as one normalized row per ad, teams can drop it straight into a spreadsheet or dashboard instead of manually paging through the public Ad Library screen by screen.

#### For AI engineers and agent builders

AI and agent teams use the Actor to feed ad creative text and metadata into RAG pipelines and creative-analysis agents. Each ad arrives as typed JSON — `snapshot.body`, `snapshot.title`, `snapshot.cards`, `adArchiveID` — with no HTML to strip and no selectors to maintain, so it can be embedded, indexed, or passed straight into an LLM context window. A common workflow: run the Actor against a set of advertiser Pages on a schedule, chunk `snapshot.body` and `snapshot.caption` text per ad, and index it into a vector store for a competitive-intelligence chat agent.

#### For researchers and analysts

Academic and policy researchers use the public Ad Library to study political and issue-ad spend, targeting, and messaging. Facebook Ads Library Scraper collects only what Meta already publishes for transparency — `spend`, `reachEstimate`, `targetedOrReachedCountries`, and `regionalRegulationData` where Meta discloses them for political/issue ads — and returns it as structured rows instead of one-by-one manual archive lookups. That makes it practical to build a dataset across many advertiser pages or a country/keyword search, rather than reading the Ad Library UI one entity at a time.

#### For developers building data products

Developers build monitoring dashboards, alerting tools, and ad-intelligence products on top of scheduled Actor runs: track a list of advertiser Pages, diff new `adArchiveID` values against a stored dataset, and surface newly launched creatives to a client-facing product. Because a single run accepts both Page URLs and Ad Library search links in the same `startUrls` list, one scheduled job can cover keyword-based discovery and named-competitor tracking together, with `resultsLimit` keeping each run's volume predictable for cost and storage planning.

### How to scrape Facebook (step by step)

1. Open **Facebook Ads Library Scraper** on its Apify Store listing (Actor ID `facebook-ads-library-scraper-pay-per-events`).
2. Add one or more sources to `startUrls` — a Facebook Page URL (all of that advertiser's ads) or an Ad Library search link (keyword/country query).
3. Set `countryCode`, `activeStatus`, and `period` to scope the run, and `resultsLimit` to cap the total number of ads returned.
4. Start the run — no login, cookies, or session setup are required.
5. Open the run's dataset and export the results as JSON, CSV, or Excel, or pull them through the Apify API.

#### What to do when Facebook changes its structure

Facebook Ads Library Scraper is maintained, and its output schema is designed to stay stable — the same field names and types keep working in your integration even when Meta changes the Ad Library's underlying internals. No action is required on your end when that happens.

### ⬇️ Input

Configure the run in the Apify Console UI or pass an `INPUT.json`. No field is required — an empty input still runs against the prefilled example sources.

| Parameter | Required | Type | Description | Example Value |
| --- | --- | --- | --- | --- |
| `startUrls` | No | array | Facebook Page URLs or Ad Library links, one source per entry. Plain strings, or objects with a `url` field (and optional `label`, `limit`, `period`). | `["https://www.facebook.com/SHEINOFFICIAL"]` |
| `resultsLimit` | No | integer | Upper bound on ads returned across **all** sources in the run. Min `1`, max `50000`. Default `10`. | `20` |
| `onlyTotal` | No | boolean | Instead of one row per ad, output one summary row per source with a total count. Default `false`. | `false` |
| `includeAboutPage` | No | boolean | For Facebook Page sources, attach a lightweight public title/description "about" snippet. Default `false`. | `true` |
| `isDetailsPerAd` | No | boolean | Run an additional per-ad lookup for richer metadata (more complete rows, slower run). Default `true`. | `true` |
| `countryCode` | No | string (enum) | Default country for Page sources (`ALL` or an ISO code such as `US`, `GB`, `DE`). Ad Library links usually carry their own country. Default `ALL`. | `"US"` |
| `period` | No | string | Optional time window when the source URL doesn't specify one. Absolute date (`YYYY-MM-DD`) or relative span (`7 days`, `1 month`, `1 year`). Empty follows the library's own default. | `"30 days"` |
| `activeStatus` | No | string (enum) | Filter for Page sources, or when a search link leaves it unspecified: `all`, `active`, `inactive`. Default `all`. | `"active"` |
| `proxyConfiguration` | No | object | Optional Apify Proxy. When enabled, the whole run uses **residential** endpoints only. Requires proxy access on your Apify plan. | `{"useApifyProxy": true}` |

```json
{
  "startUrls": [
    "https://www.facebook.com/SHEINOFFICIAL",
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&search_type=keyword_unordered&q=shoes"
  ],
  "resultsLimit": 20,
  "onlyTotal": false,
  "includeAboutPage": true,
  "isDetailsPerAd": true,
  "countryCode": "US",
  "period": "30 days",
  "activeStatus": "active",
  "proxyConfiguration": { "useApifyProxy": true }
}
```

`resultsLimit` caps ads across **all** sources combined, not per source — to cap one source individually, set a `limit` (and optionally its own `period`) on that entry's object inside `startUrls` instead of relying on the global default.

### ⬆️ Output

Every ad is written to the run's default dataset as one typed JSON object — no HTML, no re-parsing. Export it as JSON, CSV, or Excel from the Apify Console, or read it through the Apify API. This Actor is priced pay-per-result: you're charged per ad row actually written to the dataset.

#### Scraped ad

```json
{
  "inputUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&is_targeted_country=false&media_type=all&search_type=page&sort_data[direction]=desc&sort_data[mode]=total_impressions&view_all_page_id=15087023444",
  "pageID": "15087023444",
  "pageId": "15087023444",
  "adArchiveID": "1234567890123456",
  "adArchiveId": "1234567890123456",
  "adId": null,
  "startDate": 1748736000,
  "endDate": 1751328000,
  "startDateFormatted": "2025-06-01T00:00:00.000Z",
  "endDateFormatted": "2025-07-01T00:00:00.000Z",
  "isActive": true,
  "totalActiveTime": 2592000,
  "publisherPlatform": ["FACEBOOK", "INSTAGRAM"],
  "collationCount": 3,
  "collationId": "9876543210",
  "categories": [],
  "gatedType": null,
  "hideDataStatus": null,
  "isAaaEligible": false,
  "containsSensitiveContent": false,
  "containsDigitalCreatedMedia": false,
  "hasUserReported": false,
  "reportCount": null,
  "menuItems": [],
  "stateMediaRunLabel": null,
  "pageIsDeleted": false,
  "pageName": "SHEIN Official",
  "reachEstimate": null,
  "spend": null,
  "currency": "",
  "impressionsWithIndex": { "impressionsText": null, "impressionsIndex": -1 },
  "targetedOrReachedCountries": [],
  "regionalRegulationData": {},
  "fevInfo": null,
  "snapshot": {
    "pageId": "15087023444",
    "pageName": "SHEIN Official",
    "title": "SHEIN Official",
    "body": { "text": "Up to 70% off summer styles — shop the new drop." },
    "caption": "shein.com",
    "ctaText": "Shop Now",
    "ctaType": "SHOP_NOW",
    "linkUrl": "https://shein.com/campaign/summer",
    "linkDescription": "Free shipping on orders over $49",
    "displayFormat": "IMAGE",
    "images": [{ "url": "https://scontent.xx.fbcdn.net/v/creative_123.jpg" }],
    "videos": [],
    "cards": [],
    "pageCategories": ["Clothing (Brand)"],
    "pageLikeCount": 28500000,
    "countryIsoCode": "US"
  },
  "pageInfo": {
    "page": {
      "name": "SHEIN Official",
      "id": "15087023444",
      "url": "https://www.facebook.com/SHEINOFFICIAL",
      "about": { "text": "Global online fashion retailer." }
    },
    "adLibraryPageInfo": {
      "pageInfo": { "hasBlankAds": false, "hiddenAds": 0, "pageIsDeleted": false }
    }
  }
}
```

#### Total-only summary row

When `onlyTotal` is enabled, each source produces one row like this instead of one row per ad:

```json
{
  "sourceUrl": "https://www.facebook.com/SHEINOFFICIAL",
  "label": "Source 1",
  "totalAdsCount": 842,
  "aboutPage": { "url": "https://www.facebook.com/SHEINOFFICIAL", "title": "SHEIN Official", "description": "Global online fashion retailer." }
}
```

`aboutPage` only appears when `includeAboutPage` is also enabled.

### How many results can you scrape with Facebook Ads Library Scraper?

There is no absolute cap beyond what you configure: `resultsLimit` accepts up to 50,000 ads per run (default `10`), applied across all sources combined, and each source can also set its own per-entry `limit`. Pagination is automatic through the Ad Library's cursor-based results — the Actor requests pages sized up to 30 ads at a time and keeps following the cursor until it runs out of results or hits your limit. When a `period` time window is set, the Actor caps scanning at 40 listing pages per source as a safety valve for filters that match almost nothing. No benchmark run time is published, since actual duration depends on your limit, filters, and whether `isDetailsPerAd` enrichment is on.

### Integrate Facebook Ads Library Scraper and automate your workflow

Facebook Ads Library Scraper works with any language or tool that can send an HTTP request.

#### REST API integration

```python
import requests

ACTOR_ID = "facebook-ads-library-scraper-pay-per-events"
TOKEN = "<YOUR_APIFY_TOKEN>"

run_input = {
    "startUrls": ["https://www.facebook.com/SHEINOFFICIAL"],
    "resultsLimit": 20,
}

resp = requests.post(
    f"https://api.apify.com/v2/acts/%7BACTOR_ID%7D/run-sync-get-dataset-items",
    params={"token": TOKEN},
    json=run_input,
)
ads = resp.json()
print(f"Collected {len(ads)} ads")
```

Works in Python, Node.js, Go, Ruby, cURL.

#### Automation platforms (n8n, Make)

Both n8n and Make offer a general-purpose Apify integration (a "Run an Actor and get dataset items" node/module) that calls any Actor by its ID. Point it at `facebook-ads-library-scraper-pay-per-events`, pass the same `startUrls`, `resultsLimit`, and filter fields as JSON input, and route the returned ad rows straight into a spreadsheet, database, or Slack alert — no custom code required.

### Is it legal to scrape Facebook?

Yes — scraping Meta's Ad Library is legal when you collect only the public data Meta already publishes for transparency, and Facebook Ads Library Scraper does exactly that: it does not log in, does not access private accounts, and returns only what the public Ad Library page shows. Most of what it collects is business/advertiser data — page names, ad creatives, spend and reach disclosures — which sits under Meta's Terms of Service rather than personal-data law. Some fields, such as an individual's name on a personal-brand or political advertiser page, can constitute personal data under GDPR or CCPA, so you need a lawful basis before storing or reusing that data in bulk. Consult legal counsel for commercial use cases involving bulk personal data.

### Frequently asked questions

#### Does Facebook Ads Library Scraper work without a Facebook account?

Yes. The Actor runs fully logged out against the public Ad Library — no Facebook account, password, or session cookie is required.

#### How often is the scraped data updated?

Every run fetches live data directly from the Ad Library at the time it runs; nothing is served from a cache.

#### What happens if a Page can't be found or a search returns no ads?

If a Page URL can't be resolved to a page ID, the Actor logs an error for that source and continues with the others rather than failing the whole run. If a source matches zero ads, it simply contributes no rows to the dataset.

#### Can I scrape non-public or restricted Facebook Ad Library content?

No. The Actor only returns what Meta's public Ad Library page already shows for a given Page or search. Ads that Meta has fully removed from its archive, or content that sits behind a logged-in personal profile, are not accessible.

#### Does Facebook Ads Library Scraper work for AI agent workflows and LLM pipelines?

Yes. It's callable as an HTTP endpoint from any agent framework. Every response is typed JSON with stable field names — no parsing step before passing it to an LLM.

#### How does Facebook Ads Library Scraper handle Facebook's anti-bot system?

It presents a real Chrome TLS/JA3 fingerprint (via `curl_cffi` Chrome impersonation) to seed guest cookies, automatically solves Meta's JS bot-challenge when served, and escalates from a direct connection to Apify residential proxy if the Ad Library blocks the request — all without you managing any of it.

#### Does Facebook Ads Library Scraper return data in a format LLMs can use directly?

Yes. Typed, normalized JSON with stable field names — no HTML, no selectors. Pass it directly into an LLM context window, index it into a vector store, or route it through an agent tool.

#### Can I use Facebook Ads Library Scraper without managing proxies?

Yes. By default the Actor connects directly and only escalates to proxy routing on its own if Facebook blocks the request. Turning on `proxyConfiguration` opts into residential-only routing from the first request, which requires proxy access on your Apify plan.

#### Why are `spend` and `reachEstimate` sometimes empty?

Because Meta itself only discloses spend, reach, and impressions data for political and issue ads. On ordinary commercial ads, the Actor returns `null`/empty values for these fields rather than fabricating them.

#### Can I search by keyword and country, or scrape one specific advertiser?

Both, in the same run. Paste a Facebook Page URL to pull one advertiser's ads, or an Ad Library search link (with `q=`, `country=`, and other query parameters) to run a keyword/country search — mix both types in the same `startUrls` list.

#### What happens when Facebook changes its structure or blocks the scraper?

Facebook Ads Library Scraper is maintained, and its output schema is designed to stay stable — field names and types don't change on your end when Meta updates the Ad Library internally.

### Your feedback

Found a bug or missing a field? We want to know. Report it through the Actor's Issues tab on Apify Console, or reach out via API-Empire's Apify Store support channel — active maintenance is how this Actor stays reliable as Meta's Ad Library evolves.

# Actor input Schema

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

📋 One entry per line. You can paste plain URLs, or use objects with a `url` field (optional `label`, `limit`, or `period` per item).

## `resultsLimit` (type: `integer`):

📈 Upper bound on ads returned **across all sources** in this run. ⏱️ Lower = faster and lighter; 📚 higher = broader coverage.

## `onlyTotal` (type: `boolean`):

📉 Instead of one row per ad, output **one summary row per source** with a total count—handy for quick audits.

## `includeAboutPage` (type: `boolean`):

📄 For **Facebook page** sources, attach lightweight public title/description text when available.

## `isDetailsPerAd` (type: `boolean`):

🔍 Runs an additional lookup per ad for richer metadata (more complete rows; ⏳ slower runs). Turn off for a lighter listing-only export.

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

📍 Region used for **Facebook page** sources. Library URLs usually carry their own country in the link.

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

⏳ Optional window when your URL does not already specify one. **Leave empty** to follow the library’s own default. Pick a calendar date or a relative span (e.g. 7 days)—values are passed through as you provide them.

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

🎛️ Filter for **page** sources, or when your Ad Library link leaves this unspecified.

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

🏠 Leave off for a standard run. If you enable Apify Proxy here, **only residential** proxy traffic is used for the whole run. Requires proxy access on your Apify plan.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.facebook.com/SHEINOFFICIAL",
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&media_type=all&search_type=keyword_unordered"
  ],
  "resultsLimit": 10,
  "onlyTotal": false,
  "includeAboutPage": false,
  "isDetailsPerAd": true,
  "countryCode": "ALL",
  "period": "",
  "activeStatus": "all",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

All scraped items in the Actor's default dataset.

# 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": [
        "https://www.facebook.com/SHEINOFFICIAL",
        "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&media_type=all&search_type=keyword_unordered"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-empire/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 = {
    "startUrls": [
        "https://www.facebook.com/SHEINOFFICIAL",
        "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&media_type=all&search_type=keyword_unordered",
    ],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("api-empire/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 '{
  "startUrls": [
    "https://www.facebook.com/SHEINOFFICIAL",
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&media_type=all&search_type=keyword_unordered"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call api-empire/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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