Facebook Ads Library API & Instagram Ads Scraper avatar

Facebook Ads Library API & Instagram Ads Scraper

Pricing

from $2.50 / 1,000 ads

Go to Apify Store
Facebook Ads Library API & Instagram Ads Scraper

Facebook Ads Library API & Instagram Ads Scraper

Facebook Ads Library API for developers and AI agents. Search Facebook and Instagram ads by keyword, Page ID or Ad Library URL and get ad copy, images, videos, CTAs, landing pages and dates as JSON in seconds. No Meta token, login or proxy setup. Exact ad limits. MCP-ready.

Pricing

from $2.50 / 1,000 ads

Rating

0.0

(0)

Developer

Anas Nadeem

Anas Nadeem

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

2

Monthly active users

19 hours ago

Last modified

Features

Limited permissions

Share

Facebook Ads Library API for developers and AI agents. Search the Meta Ad Library for Facebook and Instagram ads by keyword, advertiser Page ID or a pasted Ad Library URL, and get every ad back as clean JSON. Each ad comes with its copy, headline, call to action, landing page, image and video URLs, advertiser and dates.

βœ… No Meta access token Β Β·Β  βœ… No Facebook login Β Β·Β  βœ… No proxy setup Β Β·Β  βœ… Exact ad limits Β Β·Β  βœ… JSON, CSV or Excel

Send one keyword and get ads back in seconds. Call it from Python, JavaScript or any HTTP client, give it to Claude or another AI agent through MCP, or run it from Apify Console with no code.

What can this Facebook Ads Library API do?

  • ⚑ Returns ads in seconds. In our November 2026 cloud tests, searches for 10 to 50 ads finished in 4.5 to 9.5 seconds, and 150 ads took under a minute. It reads Meta's search data directly, with no browser and no page scrolling.
  • πŸ›‘οΈ Works out of the box. Residential proxies are built in and included in the price. There is nothing to configure: no proxy, no cookies, no Meta developer app.
  • πŸ”Ž Searches three ways. Use a keyword, an advertiser's Facebook Page ID, or any Ad Library search URL copied from your browser, with its filters kept.
  • πŸ–ΌοΈ Captures every creative. You get images, videos with preview images, and every card and version of carousel, dynamic creative and catalog ads.
  • πŸ“Έ Covers Instagram too. Every ad lists where it ran: Facebook, Instagram, Messenger, Threads, WhatsApp or Audience Network. You can also limit a search to Instagram.
  • 🀝 Labels partnership ads. Branded-content ads name the creator separately from the brand that paid for them, which is useful for influencer research.
  • πŸ“… Filters by date, country and status. Search active, inactive or all ads in any country, and choose image or video creatives and a date range.
  • 🎯 Stops exactly at your limit. maxAds: 100 returns at most 100 unique ads, one row per ad, so you never pay for more than you asked for.
  • πŸ€– Is ready for AI agents. One required field, flat JSON, a cost you can work out before the call, and a run summary that says what happened.

Facebook Ads Library API vs Meta's official Ad Library API

This Actor is an independent, unofficial Ad Library API run on Apify. It reads the same public Ad Library that anyone can open in a browser.

This ActorMeta's official Ad Library API
SetupAn Apify account or API tokenA Meta developer account, identity verification and an access token
Commercial ads (brands, ecommerce, apps)All countries in the Ad LibraryOnly ads delivered in the EU; elsewhere, only political and issue ads
CreativesDirect image and video URLs, with video preview imagesA snapshot link for each ad
OutputJSON, CSV or Excel, an API, or MCP for AI agentsJSON from the Graph API

What data can you extract from the Facebook Ad Library?

DataFields
Ad identitylibraryID, adLibraryUrl
AdvertiserpageId, brand, brandLogo
Partnership (branded content)collaboratorName, collaboratorPageId, collaboratorLogo
Copy and headlinebody, linkTitle, linkDescription
Call to action and landing pagectaText, ctaUrl, linkUrl
Creativesimages, videos (with poster preview images and duration), cards, format
Status and placementsactive, platforms, totalPlatforms
DatesstartDate, endDate, runningTAT (days running), scrapeDate
More contextsimilarAdCount, multipleVersions, sourceUrl

How to scrape Facebook ads in 3 steps

  1. Enter a search keyword, a Facebook Page ID, or an Ad Library search URL.
  2. Set Maximum ads, and optionally choose the country, ad status, media type and dates.
  3. Click Start, then view the ads or export them as JSON, CSV or Excel.

To follow several brands, save one task per brand and schedule it daily or weekly.

Input examples

Search Facebook ads by keyword

{
"searchQuery": "protein powder",
"country": "US",
"maxAds": 100
}

Export a competitor's Facebook and Instagram ads

Use the advertiser's Page ID, the number after view_all_page_id= in its Ad Library URL. Our Facebook Page ID Finder turns a brand name into a Page ID. This example collects Burger King's active US ads:

{
"pageId": "134615383218473",
"country": "US",
"activeStatus": "active",
"maxAds": 100
}

Find ads that ran in a date range

dateFrom and dateTo use Meta's own Ad Library date filter. It matches every ad that ran at some point in the range:

{
"pageId": "134615383218473",
"dateFrom": "2026-11-01",
"dateTo": "2026-11-10",
"maxAds": 100
}

Scrape Instagram ads

Paste an Ad Library URL filtered to Instagram placements. Any filter from the Ad Library website works the same way:

{
"targetUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&publisher_platforms[0]=instagram&q=skincare&search_type=keyword_unordered",
"maxAds": 50
}

Download Facebook ad videos

Set mediaType to video to get direct MP4 links, preview images and durations:

{
"searchQuery": "running shoes",
"mediaType": "video",
"maxAds": 20
}

Output example

One ad from the Burger King search above, as returned on November 20, 2026. Long media links are shortened here.

{
"libraryID": "2426205064851511",
"adLibraryUrl": "https://www.facebook.com/ads/library/?id=2426205064851511",
"pageId": "134615383218473",
"brand": "Burger King",
"brandLogo": "https://scontent-lax3-1.xx.fbcdn.net/v/t39.35426-6/…",
"collaboratorName": null,
"collaboratorPageId": null,
"collaboratorLogo": null,
"active": true,
"body": "We're giving BK a glow up!",
"linkTitle": "Meet the new Burger King",
"linkDescription": "",
"linkUrl": "https://burgerking.app.link/wtlXQwl6O7b",
"ctaText": "Order now",
"ctaUrl": "https://burgerking.app.link/wtlXQwl6O7b",
"platforms": ["FACEBOOK", "INSTAGRAM"],
"totalPlatforms": 2,
"similarAdCount": 2,
"multipleVersions": false,
"images": [],
"videos": [
{
"url": "https://video-lax3-2.xx.fbcdn.net/o1/v/t2/f2/m366/…",
"duration": null,
"poster": "https://scontent-lax3-2.xx.fbcdn.net/v/t39.35426-6/…"
}
],
"cards": [],
"startDate": "2026-11-16T08:00:00.000Z",
"endDate": null,
"runningTAT": 3,
"format": "video",
"sourceUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&search_type=page&view_all_page_id=134615383218473",
"scrapeDate": "2026-11-20T00:30:42.954Z"
}

How much does the Facebook Ads Library API cost?

You pay only for ads delivered to your dataset, and the price drops on every paid Apify plan. These are the prices at the time of writing; check the Pricing tab for the current rates.

Apify planPer 1,000 ads100 ads10,000 ads
Free$4.00$0.40$40
Starter$3.50$0.35$35
Scale$3.00$0.30$30
Business$2.50$0.25$25
  • Nothing else to pay: no start fee, no proxy bill, no extra charge for creatives or advertiser fields.
  • Below Apify's own Facebook Ads Library Scraper on every standard plan: it charged $5.80, $5.00, $4.20 and $3.40 per 1,000 ads in November 2026.
  • Free to try: Apify's free plan includes $5 of usage every month, enough for up to 1,250 ads.
  • Enterprise plans pay the Business price.
  • Budget control: maxAds and the run's maximum charge both stop the run exactly at your limit, and duplicate ads are never charged.

Facebook Ads Library API for AI agents (MCP)

Give Claude, Cursor, Codex or any other MCP client access to the Ad Library through the hosted Apify MCP server:

https://mcp.apify.com?tools=whoareyouanas/facebook-ads-library-api

For a client that accepts an mcpServers configuration:

{
"mcpServers": {
"apify-facebook-ads-library": {
"url": "https://mcp.apify.com?tools=whoareyouanas/facebook-ads-library-api"
}
}
}

Sign in with Apify OAuth when prompted. For a token-based client, add "headers": {"Authorization": "Bearer YOUR_APIFY_TOKEN"} to the server entry. The Apify MCP configurator has the setup for each client. An agent with no Apify account can buy a prepaid, spend-capped token and pay per run.

Example prompts:

Find 20 active Nike ads in the US with whoareyouanas/facebook-ads-library-api and summarize their hooks, offers and calls to action, with links to each ad.

Pull the last 30 days of ads from Facebook Page 134615383218473 and group them by format and landing page.

Notes for AI agents

  • Minimum input: one of searchQuery, pageId or targetUrl, plus maxAds. For example, {"searchQuery": "nike", "maxAds": 20}. Everything else has a default.
  • No setup: don't send proxy, cookie or token settings. Residential proxies are built in.
  • Cost before the call: at most maxAds Γ— $0.004 on Apify's free plan, and $0.0025-0.0035 per ad on paid plans (see pricing). 20 ads cost at most $0.08, with no start fee.
  • Clear errors: an invalid input fails at once, before any charge. The message names the field and lists the supported ones.
  • Reading the result: the dataset holds the ads. RUN_SUMMARY says how many were delivered and why the run stopped (see Run summary), and the run's status message says the same in one sentence.
  • Synchronous calls: searches of up to 150 ads finish well within the 300-second limit of synchronous API runs.

Use the Facebook Ads Library API from Python, JavaScript or cURL

You need an Apify API token, not a Meta token. One synchronous request starts the run and returns the ads:

curl --request POST \
'https://api.apify.com/v2/acts/whoareyouanas~facebook-ads-library-api/run-sync-get-dataset-items' \
--header "Authorization: Bearer ${APIFY_TOKEN}" \
--header 'Content-Type: application/json' \
--data '{"searchQuery":"protein powder","country":"US","maxAds":20}'

Python, with the apify-client package:

import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("whoareyouanas/facebook-ads-library-api").call(
run_input={"pageId": "134615383218473", "country": "US", "maxAds": 500}
)
items = client.dataset(run["defaultDatasetId"]).list_items().items

JavaScript, with the apify-client package:

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('whoareyouanas/facebook-ads-library-api').call({
pageId: '134615383218473',
country: 'US',
maxAds: 500,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();

To send ads to Google Sheets, Slack, n8n, Make or Zapier, use Apify's integrations or a webhook. The API tab has examples in more languages.

Use cases

  • Competitor research: see every ad a competitor runs, with its offers, hooks and landing pages.
  • Winning ads and products: long-running active ads (a high runningTAT) are the ones advertisers keep paying for. This is useful for ecommerce and dropshipping research.
  • Creative swipe files: collect videos, images and carousel cards by keyword, industry or brand.
  • Influencer and partnership research: find which creators run branded-content ads for a brand.
  • Agency reporting and monitoring: schedule a task per client or competitor and compare Library IDs between runs to spot new ads.
  • AI research agents: let an agent pull live ads and summarize angles, offers and calls to action.

Example tasks

Open an example, select Try for free to copy it into your account, and swap in your own keyword or Page ID.

Competitor and brand research

Ad examples by type and industry

Filters and exports

Speed and quality

Every release passes a suite of cloud checks before it goes live: exact 1-, 2-, 5-, 31- and 150-ad limits, Page, keyword and URL searches, date ranges, pasted URLs with tracking parameters, empty searches, and budget and runtime stops.

Measured in November 2026AdsTime
Ten public example tasks10-50 each4.5-9.5 seconds
Page, keyword or URL searches, 12 runs31 eachabout 11 seconds typically
Keyword "dinosaur", United States, 2 runs15026 and 51 seconds

Larger runs in September 2026 delivered all 719 of Burger King's US ads and 1,000 "dinosaur" ads, with no duplicate Library IDs. Independent browser checks matched every one of 281 sampled IDs.

Input reference

Provide searchQuery, pageId or targetUrl. If several are filled in, targetUrl wins, then pageId, then searchQuery.

InputDefaultDescription
searchQuery-Keyword search, up to 500 characters.
pageId-Numeric Facebook Page ID, as a string.
targetUrl-Any Ad Library search URL. Its filters take precedence over the form's country, status, media and date settings.
maxAds100 via API; 1 in a fresh formMaximum unique ads to deliver, from 1 to 10,000.
countryUSTwo-letter country code, such as US or IN, or ALL.
activeStatusactiveactive, inactive or all.
mediaTypeallall, image, video, meme or none.
dateFrom-Start of Meta's date range, YYYY-MM-DD.
dateTo-End of the date range, YYYY-MM-DD.

URLs from facebook.com, m.facebook.com and web.facebook.com all work. The URL filters are:

  • country, q, view_all_page_id;
  • active_status, media_type, ad_type, search_type, is_targeted_country;
  • content_languages[n] and publisher_platforms[n];
  • sort_data[mode] and sort_data[direction];
  • start_date[min] and start_date[max].

Tracking parameters such as fbclid or utm_source are removed automatically and listed in the run summary. Older tasks that send proxyConfiguration keep working: proxies are built in, so the field is ignored.

Output fields

Each dataset row is one ad, identified by libraryID, and every row has the same fields. Missing copy is an empty string; other missing values are null.

  • images holds objects with a url. videos holds url, duration and poster, the preview image shown before the video plays.
  • cards holds every card or version of the ad, each with its own copy, link, call to action and media.
  • format is image, video, carousel, dynamic or unknown. dynamic covers dynamic creative and catalog (product) ads; their versions are in cards, and multipleVersions is true.
  • endDate is set when an ad has stopped; running ads have endDate: null. runningTAT is how many days an active ad has been running.
  • On partnership ads, brand and pageId are the advertiser, and the collaborator fields are the creator the ad runs under.

Meta's media links are temporary, so download any images or videos you want to keep soon after the run.

Run summary

Each run saves RUN_SUMMARY to its key-value store, and its status line says the outcome in one sentence.

FieldMeaning
deliveredUnique ads in the dataset.
stopReasonWhy the run stopped: max_ads (your limit), exhausted (no more results), budget, time_limit, interrupted or error.
completetrue when Meta had no more results and every ad was delivered.
metaResultCountMeta's approximate number of results for the search.
skipped, duplicates, ignoredParametersRecords left out, duplicates removed, and URL parameters ignored.

More ad library scrapers

ActorUse it for
Meta (Facebook) Ad Library ScraperOur flagship Facebook ad scraper, including single-ad lookups by ID
Facebook Ad Library Video Downloader & Ad LookupOne ad's video, images and details from its Library ID or link
Facebook Page ID FinderTurn a brand name into a Facebook Page ID
Google Ads Transparency ScraperCompetitor ads from Google's Ads Transparency Center
TikTok Ad Library & Creative ScraperCompetitor ads on TikTok
LinkedIn Ad Library ScraperCompetitor ads on LinkedIn

Turn competitor ads into your next creative test with Seercraft

We also build Seercraft for ongoing Meta ad research. It tracks competitors daily, saves Facebook and Instagram ads to boards, answers questions with links to the source ads, and turns your findings into creative briefs.

Switching from another Facebook ads scraper

Moving from Curious Coder's Facebook Ad Library Scraper or a similar Actor takes a few minutes. Your Ad Library search URLs work as targetUrl.

Your current setupIn this Actor
A list of Ad Library search URLsOne targetUrl per run, or one saved task per URL
A result limit per sourcemaxAds, an exact limit
A Facebook Page URLThe numeric Page ID as pageId
Country and status optionscountry and activeStatus
A date rangedateFrom and dateTo, or start_date[min] and start_date[max] in the URL
A proxy configuration or subscriptionNot needed: proxies are built in
Scripts that read the outputMap to the field names above, especially libraryID, brand, images and videos

FAQ

Is this the official Facebook Ads Library API?

No. It is an independent, unofficial API for the public Ad Library website, run on Apify and not affiliated with Meta. You call it like any API with your Apify token. You don't need a Meta developer account, identity verification or an access token.

Do I need a Meta access token, a Facebook account or a proxy?

No. Public Ad Library data needs no Facebook login, cookies or Meta token, and residential proxies are built in. You only need an Apify account.

How do I find winning Facebook ads?

Search a keyword or a competitor's Page, then sort by runningTAT or startDate. Ads that have been running for weeks are the ones advertisers keep paying for. Check similarAdCount and multipleVersions to see which ones they are scaling and testing.

Can I scrape Instagram ads?

Yes. Every ad lists its placements in platforms. To get only Instagram ads, paste an Ad Library URL with publisher_platforms[0]=instagram, as in the Instagram example.

Can I download Facebook ad videos and images?

Yes. Each ad includes direct video (MP4) and image URLs, plus video preview images. Set mediaType to video to get only video ads.

Can I track a competitor's new ads every day?

Yes. Save a task with the competitor's Page ID and schedule it. Each run creates a new dataset, so comparing libraryIDs between runs shows new and stopped ads.

Can I use it with n8n, Make, Zapier or Google Sheets?

Yes, through Apify's integrations, webhooks and API. The same input works everywhere.

How many ads can I get in one run?

Up to 10,000 per run. For bigger research, run one search per Page or keyword and schedule them.

Why did I get fewer ads than maxAds?

maxAds is an upper limit. When Meta has fewer matching ads, you get all of them, and the run's status line and RUN_SUMMARY show the count.

Meta publishes the Ad Library so that anyone can see the ads running on its platforms. This Actor collects only that public ad data, without logging in. If you are unsure how your use case is regulated where you work, check with a lawyer.

Can I export Facebook ads to CSV or Excel?

Yes. Export the dataset as JSON, CSV or Excel. JSON keeps the nested cards, images and videos; CSV suits flat fields such as brand, copy, Library ID and dates.

Support

Open an issue in the Actor's Issues tab with your run URL and what you expected. Feature requests for new fields or filters are welcome.