# Meta Ad Library API: Facebook Ads Library (`deepmine/meta-ad-library`) Actor

Search the Meta (Facebook and Instagram) Ad Library by keyword, advertiser or Ad Library URL, in any country. Ad text, images, videos, landing pages, dates and platforms, plus optional advertiser details and EU reach. Monitor advertisers for new ads. No login.

- **URL**: https://apify.com/deepmine/meta-ad-library.md
- **Developed by:** [DeepMine](https://apify.com/deepmine) (community)
- **Categories:** Marketing, Social media
- **Stats:** 2 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

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

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

## How to integrate an Actor?

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

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

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

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

# README

## Meta Ad Library

Type a keyword, an advertiser or an Ad Library link and get one clean row per ad from the **Meta Ad Library** (Facebook, Instagram, Messenger, Threads): the creative, ad text, headline, button, landing page, format, platforms and dates. No login.

| Advertiser | Ad text | Headline | Button | Format | Started | Days active |
|---|---|---|---|---|---|---|
| Huel | Huel was never meant to replace real food. It’s fo… | For Your Inconvenient Meals. | Shop now | Video | 2026-08-04 | 54 |
| 1st Phorm | After a grueling shift or a heavy workout, you nee… | Protein Should Not Taste Like Chalk | Shop now | Dynamic creative | 2026-06-18 | 100 |
| Unjury- Medical Quality Protein | Discover the best in nutritional support with our… | High Quality Protein Powder | Shop now | Video | 2024-12-12 | 654 |

<sub>Collected 2026-09-27 from the prefilled run (`protein powder`, US, most impressions first). Every row also has the creative's picture, the video file, the landing page and the ad's Ad Library link.</sub>

**$0.60 per 1,000 ads** on Starter ($0.75 Free, $0.50 Scale, $0.40 Business); with ad details $1.25 per 1,000 ($1.40 Free, $1.15 Scale, $1.05 Business). The prefilled run (100 ads) costs about $0.06.

Add **ad details** for the advertiser's verification and Instagram account and, for ads shown in the EU or UK, **reach by country**, targeted ages and gender, payer and beneficiary. Turn on **Only new ads** and schedule it to **monitor competitors' ads**. No Facebook account, no cookies.

Switching from apify/facebook-ads-scraper? Every row also carries that Actor's fields under the same names (`adArchiveID`, `snapshot`, `publisherPlatform`, ...), after the clean fields, so your pipeline keeps working with no setting to change ([details below](#facebook-ads-scraper-fields)).

### What you can do with it

- **Ad research / ad spy**: see every active ad for "protein powder", "running shoes" or any product, most impressions first.
- **Competitor monitoring**: add your competitors' Facebook pages, schedule a daily run with *Only new ads*, and get just the ads they started since the last run, however many ads they already run.
- **Creative inspiration**: collect video and image URLs, hooks, headlines and CTAs by niche and country. Long-running ads (*Days active*) are usually the ones that work.
- **Market and lead research**: find the brands advertising in a niche, their Facebook pages and likes, and (with ad details) their Instagram accounts and followers.
- **EU reach data**: for ads shown in the EU or UK, get Meta's reach per country plus the targeted age range and gender (Meta's `ad_details` object in the row also has reach by age and gender).

### Input

| Field | What it does |
|---|---|
| **Search terms** | Keywords, as in the Ad Library search box. One search per line. |
| **Advertisers** | A Facebook page link (`facebook.com/nike`), a page id (`15087023444`), an advertiser's Ad Library link, or the page name exactly as it appears on its ads. |
| **Country** | Two-letter code where the ads ran (`US`, `GB`, `DE`, ...) or `ALL` (US in the form, `ALL` if left out). |
| **Max ads per search** | Stop each search after this many ads (100 in the form, 200 if left out, up to 10,000). You pay per ad. Searches read about 1,000 ads in 3 minutes. |
| **Include ad details** | Adds the advertiser's profile and EU/UK reach data to each ad, at the with-details price (one more request per ad, so slower). |
| **Only new ads (monitor)** | Return only ads started since the last run that this Actor hasn't returned before for the same search. *Max ads per search* then limits the new ads per run. You pay only for the new ads. |

Under **Filters and Ad Library URLs**:

| Field | What it does |
|---|---|
| **Ad Library URLs** | Searches copied from [facebook.com/ads/library](https://www.facebook.com/ads/library/). The link's own filters are used. |
| **Ad status** | Active (default), inactive, or both. |
| **Media type** | All, images, videos, memes, images and memes, or no media. |
| **Ad category** | All ads, or only ads about social issues, elections or politics (these carry spend, impressions and reach). |
| **Exact phrase** | Match the search terms as an exact phrase. |
| **Shown on or after / before** | The Ad Library's date filter: ads that were shown in that period, whatever day they started. |

Give at least one search term, advertiser or Ad Library URL; a run with none fails with a message. Example:

```json
{
  "searchQueries": ["protein powder"],
  "advertisers": ["https://www.facebook.com/sephora/", "15087023444"],
  "country": "US",
  "maxAdsPerQuery": 100,
  "includeAdDetails": false
}
```

### Output

One row per ad, in Meta's order (most impressions first; with *Only new ads*, most recent first). An ad found by several searches appears once, under the first search that found it.

Each row has two parts:

1. **The clean fields first** (below): flat, readable values for spreadsheets and the Console tables. Every row has them in the same order; a value Meta doesn't give is `null`.
2. **Then the apify/facebook-ads-scraper fields**, under that Actor's names: Meta's full ad record ([below](#facebook-ads-scraper-fields)). They're what makes a row about 15 KB; skip them if you only need the clean part.

The Console tables show only the clean fields. A real row from a `protein powder` search in all countries (2026-09-27), clean part (media links cut):

```json
{
  "image": "https://scontent-iad6-1.xx.fbcdn.net/v/t39.35426-6/724869954...",
  "pageName": "True Protein",
  "adText": "Trust issues aren't just for relationships.\n\nIn a market full of hidden ingredients, ...",
  "adTextSnippet": "Trust issues aren't just for relationships. In a m…",
  "headline": "India's Most Transparent Protein",
  "adLibraryUrl": "https://www.facebook.com/ads/library/?id=27328738403483472",
  "landingUrl": "https://gettrueprotein.com/products/true-protein-chocolate",
  "ctaText": "Shop now",
  "format": "Dynamic creative",
  "platforms": ["Facebook", "Instagram", "Audience Network", "Messenger", "WhatsApp", "Threads"],
  "isActive": true,
  "pageLikes": 66,
  "collationCount": 1,
  "daysActive": 103,
  "startedAt": "2026-06-16",
  "lastShownAt": "2026-09-27",
  "rank": 8,
  "videoUrl": "https://video-iad6-1.xx.fbcdn.net/o1/v/t2/f2/m412/AQOdfCcxPL...",
  "pageUrl": "https://www.facebook.com/61591095411022/",
  "adArchiveId": "27328738403483472",
  "pageId": "1190327834158821",
  "searchInput": "protein powder",
  "scrapedAt": "2026-09-27T19:51:50Z"
}
```

Clean fields, in row order:

- `image`: the creative's picture: its first image, the video's preview frame, or the first card's image.
- `pageName`: the advertiser (its Facebook page).
- `adText`, `adTextSnippet`: the ad's primary text in full, and its first 50 characters on one line.
- `headline`: the headline under the creative.
- `adLibraryUrl`: the ad in the Meta Ad Library.
- `landingUrl`: where the ad's button leads.
- `ctaText`: the button text, e.g. *Shop now*.
- `format`: Image, Video, Carousel, Dynamic creative, Catalog, ...
- `platforms`: Facebook, Instagram, Messenger, Threads, Audience Network, WhatsApp.
- `isActive`: still running when the run read it.
- `pageLikes`: likes of the advertiser's Facebook page.
- `collationCount`: how many ads use this creative and text. Meta says it on one ad of each group, so it's often `null`.
- `daysActive`: days from `startedAt` to `lastShownAt`.
- `startedAt`: the day the ad started (YYYY-MM-DD).
- `lastShownAt`: the last day it ran: the day it stopped, or the run's day for active ads.
- `rank`: the ad's place in its search (1 = most impressions).
- `videoUrl`: the ad's video file (standard definition), for video ads.
- `pageUrl`: the advertiser's Facebook page.
- `adArchiveId`, `pageId`: the ad's Library ID and the advertiser's page id.
- `searchInput`: the search term, advertiser or Ad Library URL that found the ad.
- `scrapedAt`: when the run started (UTC).

Dynamic and catalog ads keep placeholders like `{{product.name}}` in their top text; the clean fields take the text, headline and picture of the ad's first card instead, as the Ad Library shows it.

**Images and videos expire.** `image`, `videoUrl` and the media links in `snapshot` are Meta's signed CDN links (fbcdn.net). They stop working about 5 days after the run, so download what you want to keep.

When a search is for **Issues, elections or politics** (*Ad category*, or `ad_type=political_and_issue_ads` in an Ad Library URL), the clean part also has these fields after `isActive`. Meta publishes them for those ads only:

- `spend`: Meta's spend range as shown, e.g. `$45K - $50K`.
- `spendMin`, `spendMax`: the same range as numbers in `currency` (`spendMax` is `null` for an open range like `>$1M`).
- `currency`: e.g. `USD`.
- `impressions`, `reachEstimate`: Meta's impressions range (e.g. `>1M`) and estimated audience size (e.g. `100K - 500K`).
- `paidFor`: the *Paid for by* disclaimer.

With **Include ad details**, these fields come in after `pageUrl` (details are fetched per ad; a row whose details are missing is charged as a plain ad):

- `detailsStatus`: OK, Not available (Meta has none for this ad) or Failed.
- `isPageVerified`: the advertiser's page has Meta's verified badge.
- `instagramUrl`, `instagramFollowers`: the advertiser's Instagram account and its followers.
- `euReach`, `ukReach`: people reached in the EU and in the UK (ads shown there only).
- `targetAges`, `targetGender`: the targeted age range (e.g. `18-65+`) and gender.
- `reachByCountry`: people reached per country, most first (e.g. `DE: 14,914`).
- `payer`, `beneficiary`: who paid for the ad and who it benefits.

In the Console, the dataset has these tables: **📊 Overview** (creative, advertiser, text, headline, links, button, format, platforms, active, started, days active, search), **📈 Stats** (rank, days active, page likes, same-creative count, dates), **🎨 Creatives** (picture, text, headline, button, video, landing page), **🏛️ Political** (spend, impressions and reach; fills on political searches) and **📋 Details** (fills with *Include ad details*). *All fields* shows the whole row, the facebook-ads-scraper part included.

#### facebook-ads-scraper fields

After `scrapedAt`, every row has the same fields as apify/facebook-ads-scraper, under the same names: Meta's raw ad record with camelCase keys, plus `inputUrl`, `pageID` / `adArchiveID` and `startDateFormatted` / `endDateFormatted`. Pipelines built on that Actor keep working when you switch. This part is nested (`snapshot` holds the creative), uses Meta's constants (`FACEBOOK`, `VIDEO`), and has every image and video variant (HD and SD). With *Include ad details*, Meta's `ad_details` object comes as is, including reach by age and gender.

A field that is in both parts appears once, in the clean part, with the same value: `pageName`, `isActive`, `pageId`, `adArchiveId`, `collationCount` and, on political searches, `spend`, `currency` and `reachEstimate`. Meta's own `adId` (usually `null`) is a different id from `adArchiveId`. The same row as above, facebook-ads-scraper part (shortened, media links cut):

```json
{
  "inputUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&...&q=protein%20powder&...",
  "pageID": "1190327834158821",
  "adArchiveID": "27328738403483472",
  "startDateFormatted": "2026-06-16T07:00:00.000Z",
  "endDateFormatted": "2026-09-27T07:00:00.000Z",
  "collationId": "25785517554480236",
  "pageIsDeleted": false,
  "snapshot": {
    "pageName": "True Protein",
    "pageProfileUri": "https://www.facebook.com/61591095411022/",
    "pageProfilePictureUrl": "https://scontent-iad3-2.xx.fbcdn.net/v/t39.35426-6/...",
    "ctaText": "Shop now",
    "displayFormat": "DCO",
    "cards": [
      { "body": "Trust issues aren't just for relationships.\n\nIn a market full of hidden ingredients, ...",
        "title": "India's Most Transparent Protein", "ctaType": "SHOP_NOW",
        "linkUrl": "https://gettrueprotein.com/products/true-protein-chocolate",
        "originalImageUrl": "https://scontent-iad6-1.xx.fbcdn.net/v/t39.35426-6/...", "videoSdUrl": null },
      { "title": "India's Most Transparent Protein", "videoHdUrl": "https://video-iad3-2.xx.fbcdn.net/...",
        "videoSdUrl": "https://video-iad6-1.xx.fbcdn.net/..." }
    ],
    "videos": []
  },
  "impressionsWithIndex": { "impressionsText": null, "impressionsIndex": -1 },
  "gatedType": "ELIGIBLE",
  "categories": ["UNKNOWN"],
  "isAaaEligible": false,
  "reachEstimate": null,
  "currency": "",
  "spend": null,
  "endDate": 1790492400,
  "publisherPlatform": ["FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK", "MESSENGER", "WHATSAPP", "THREADS"],
  "startDate": 1781593200,
  "adId": null,
  "targetedOrReachedCountries": []
}
```

Main fields of this part:

- `adArchiveID`, `pageID`: the ad's Library ID and the advertiser's page id (the same as `adArchiveId` and `pageId`).
- `snapshot`: the creative. It holds `body.text`, `title`, `caption`, `ctaText`, `linkUrl`, `displayFormat` (IMAGE, VIDEO, CAROUSEL, DCO, DPA), `images`, `videos`, `cards` (carousel and dynamic-ad variants, each with its own text and media), and the page's likes, categories and picture.
- `startDateFormatted` / `endDateFormatted` (also `startDate` / `endDate` in unix seconds), `publisherPlatform`.
- `ad_details` (with *Include ad details*): the advertiser profile and, when `isAaaEligible` is true (the ad was shown in the EU/UK), reach and audience data. `detailsStatus` in the clean part says whether they came.
- `spend`, `impressionsWithIndex`, `reachEstimate`, `currency`: Meta fills these **only for political and issue ads** (choose *Issues, elections or politics* under *Ad category*). They're empty for commercial ads in every Ad Library tool, because Meta doesn't publish them.

#### Run summary

The run's **OUTPUT** record lists every search with Meta's result count (`metaCount`), the ads read, the ads delivered and why it stopped: `complete`, `maxAds`, `chargeLimit`, `caughtUp` (a monitor reached the ads of its last run), `readCap` (a monitor couldn't read back to its last run; see `warning`), `duplicate` (the same search was given twice), or a failure: `blocked`, `error`, `incomplete`.

### Monitoring advertisers

1. Put the competitors' pages in **Advertisers** (or keywords in **Search terms**).
2. Turn on **Only new ads**.
3. Save it as a task and schedule it daily.

How it works:

- Monitoring reads the Ad Library's **Most recent** order. The first run returns the newest ads, up to *Max ads per search*.
- Later runs go back to about two days before the previous run, so ads that appear in the Library a little late aren't missed. They return every ad started since then that wasn't returned before, even if the advertiser runs thousands of ads (up to the read limit below).
- Meta orders ads by the month they started, but not exactly by day inside a month. So a run reads the current month's ads (and the previous month's early in a month), not just the top few, and a daily run on a big advertiser can read a few hundred ads to find two new ones. You pay only for the new ads.
- If more new ads started than *Max ads per search*, the run returns that many and the next run continues where it stopped.
- A run reads at most 1,000 ads past *Max ads per search*. If a search has more ads this month than that, the run can't read back to the previous run: it returns the new ads it found, and its status message and OUTPUT `warning` say that new ads further down Meta's list were skipped. The next run starts from this one, so the monitor keeps working, but running more often doesn't help: the month's ads are still in the way. To check deeper, raise *Max ads per search* or narrow the search (country, media type).
- The history is kept per search in your account, in the `meta-ad-library-monitor` key-value store. A search is the same search when its words or advertiser and all its filters are the same.

### Reliability

- Uses Apify **residential proxies** by default. Meta refuses most datacenter IPs after the first page of results, so datacenter proxies aren't recommended.
- A refused or failed request is retried on a new IP.
- If Meta still refuses a search, the ads already collected are kept and the run **fails with the reason**. It doesn't report success on an incomplete search.
- Each search is checked against the result count Meta reports. A search whose results end well short of that count (under 80% of the count, or of *Max ads per search* if that's lower) fails the run.
- With *Include ad details*, failed details get a second try on new IPs. If details are still missing for more than half the ads, the run fails with the reason (the ads are kept, and charged as plain ads).
- Each ad appears once per run, even when several searches find it.

### Pricing

Pay per ad, by your Apify plan. No start fee, no monthly fee.

| Per 1,000 ads | Free | Starter | Scale | Business |
|---|---|---|---|---|
| Ad | $0.75 | $0.60 | $0.50 | $0.40 |
| Ad with details | $1.40 | $1.25 | $1.15 | $1.05 |

- The with-details price is the ad price plus a flat $0.65 per 1,000 for the details, the same on every plan.
- An ad is charged the with-details price only when its details came; an ad whose details failed is charged as a plain ad.
- With *Only new ads* you pay only for the new ads, not for the ads the run reads to find them.
- Set a maximum cost per run in the run options: the run stops before it would go past it and keeps what it collected (`OUTPUT.chargeLimitReached` is then `true`).

### Limitations

- Advertiser names are matched against the names on their ads. If a name isn't found, use the page link or page id; the run's OUTPUT lists names it couldn't find.
- Links to a single ad (`?id=...`) aren't supported as input yet. Search its advertiser instead.
- Spend and impressions exist only for political and issue ads (Meta's rule, see above).
- Page transparency (the confirmed page owner, address, name history) isn't included yet.

### FAQ

**Do I need a Facebook account?** No. Everything comes from the public Ad Library, without logging in.

**Which countries work?** Every country in the Ad Library, or `ALL`.

**How many ads can I get?** Set *Max ads per search* up to 10,000. A search reads about 1,000 ads in 3 minutes, so 10,000 take about half an hour; several searches run in parallel. Very large searches (tens of thousands of ads) are easier to split by country, media type or date.

### Feedback

Found a bug or missing a field? Open an issue on the **Issues** tab and we'll look at it within 48 hours. Happy with the data? A short review on the Store helps others find this Actor.

# Actor input Schema

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

Keywords to search ads for, as you'd type them in the Ad Library search box. One search per line.

## `advertisers` (type: `array`):

Advertisers whose ads you want: a Facebook page link (facebook.com/nike), a page id, an Ad Library link of the advertiser, or the page name exactly as it shows on its ads.

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

Two-letter country code where the ads ran (US, GB, DE, ...), or ALL for every country.

## `maxAdsPerQuery` (type: `integer`):

Stop each search, advertiser or URL after this many ads. You pay per ad, so this caps the cost of each search. Ads come most impressions first (with Only new ads, most recent first, and this limits the new ads per run). About 3 minutes per 1,000 ads.

## `includeAdDetails` (type: `boolean`):

Also fetch each ad's details: the advertiser's verification and Instagram account and followers and, for ads shown in the EU or UK, the reach, reach by country, targeted ages and gender, plus the payer and beneficiary (Meta's full details, with reach by age and gender, are in ad\_details). An ad with details costs more than a plain ad (see Pricing), and each needs one more request, so runs are slower. An ad whose details fail is charged as a plain ad.

## `onlyNewAds` (type: `boolean`):

Return only ads started since the last run that this Actor hasn't returned before for the same search, reading up to 1,000 ads past Max ads per search to find them. You pay only for the new ads. Schedule the run (e.g. daily) to monitor advertisers or keywords. The first run returns the newest ads, up to Max ads per search.

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

Searches copied from facebook.com/ads/library in your browser. The filters in the link (country, active status, media type, dates) are used.

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

Only active ads, only ads that stopped, or both.

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

Only ads with this kind of media.

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

All ads, or only ads about social issues, elections or politics (these carry spend and impressions ranges).

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

Match the search terms as an exact phrase instead of any order.

## `dateFrom` (type: `string`):

Only ads that were shown on or after this date (YYYY-MM-DD), whatever day they started. This is the Ad Library's own date filter.

## `dateTo` (type: `string`):

Only ads that were shown on or before this date (YYYY-MM-DD).

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

Residential proxies are the default and recommended: Meta refuses most datacenter IPs past the first page of results.

## Actor input object example

```json
{
  "searchQueries": [
    "protein powder"
  ],
  "country": "US",
  "maxAdsPerQuery": 100,
  "includeAdDetails": false,
  "onlyNewAds": false,
  "activeStatus": "active",
  "mediaType": "all",
  "adType": "all",
  "exactPhrase": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

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

No description

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

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

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

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQueries": [
        "protein powder"
    ],
    "country": "US",
    "maxAdsPerQuery": 100,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("deepmine/meta-ad-library").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQueries": ["protein powder"],
    "country": "US",
    "maxAdsPerQuery": 100,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("deepmine/meta-ad-library").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "protein powder"
  ],
  "country": "US",
  "maxAdsPerQuery": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call deepmine/meta-ad-library --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,deepmine/meta-ad-library"
        }
    }
}
```

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/wzZZyjZ3cBiGxpCix/builds/ZSRHhv7d4WX6JHgd5/openapi.json
