vΓΈiddo guidesAll Actors on Apify

Facebook Ad Library scraper: how to get ads as JSON/CSV (API, Python, no code)

Collect public ads from the Meta Ad Library by keyword, advertiser Page ID or Ad Library link: ad text, headline, landing page, button, images and videos, dates, platforms and version count, plus spend and reach ranges where Meta publishes them. This guide shows the output fields, a working input, and Python, JavaScript and cURL code for the Actor v0iddo/facebook-ads-library-scraper on Apify.

Open Facebook Ad Library scraper on Apify

What data you get

One row per result. Every row can be downloaded as JSON, CSV, Excel or HTML, or read through the API.

FieldLabelTypeExample
adArchiveIdAd IDtext1550534860016399
pageNameAdvertisertextPerfect themes
isActiveActivetrue/falsetrue
startDateStarteddate2026-05-19
endDateEndeddate
platformsPlatformslist["facebook", "instagram", "audience_network"]
bodyAd texttext
titleHeadlinetextπ•Šπ•¦π•‘π•–π•£ 𝕙𝕠π•₯ π•¨π•šπ••π•˜π•–π•₯𝕀 𝕒𝕑𝕑 !
ctaTextButtontextInstall now
linkUrlLanding pageURLhttp://play.google.com/store/apps/details?id=com.iconchanger.widget...
displayFormatFormattextIMAGE
imageUrlsImageslist["https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/700927950_9333...
adLibraryUrlAd Library linkURLhttps://www.facebook.com/ads/library/?id=1550534860016399
pageIdtext115939511520844
pageCategorieslist["Topic"]
pageLikeCountnumber18620
searchedFortextnike
searchCountrytextUS

Input example

This is the input that is pre-filled on the Actor page. Change the values for your own run.

{
  "searchTerms": [
    "nike"
  ],
  "country": "US",
  "activeStatus": "active",
  "maxItems": 20
}
Input fieldTypeWhat it does
searchTermsarrayWords to search the Ad Library for, for example a brand or product name.
pageIdsarrayNumeric Facebook Page IDs of advertisers whose ads you want, one per line.
adLibraryUrlsarrayOptional search links copied from the browser, such as https://www.facebook.com/ads/library/?activestatus=active&adtype=all&country=US&q=nike&searchtype=keywordunordered.
countrystringWhere the ads were shown: a two-letter country code such as US, GB or DE, or ALL for every country.
activeStatusstringWhich ads to return: ads that are running now, ads that stopped, or both.
adTypestringAd category in the Ad Library.
mediaTypestringOnly ads that contain this kind of media.
startDateMinstringOptional. Only ads that started running on or after this date, as YYYY-MM-DD.
startDateMaxstringOptional. Only ads that started running on or before this date, as YYYY-MM-DD.
maxAdsPerSearchintegerThe most ads to read for each search term, Page ID or link.
maxItemsintegerThe run stops after this many result rows.

Output sample

Real rows from a run of the Actor. Fields that name people are left out of the sample.

[
  {
    "adArchiveId": "1550534860016399",
    "adLibraryUrl": "https://www.facebook.com/ads/library/?id=1550534860016399",
    "pageId": "115939511520844",
    "pageName": "Perfect themes",
    "pageCategories": [
      "Topic"
    ],
    "pageLikeCount": 18620,
    "isActive": true,
    "startDate": "2026-05-19",
    "platforms": [
      "facebook",
      "instagram",
      "audience_network"
    ],
    "title": "π•Šπ•¦π•‘π•–π•£ 𝕙𝕠π•₯ π•¨π•šπ••π•˜π•–π•₯𝕀 𝕒𝕑𝕑 !",
    "linkUrl": "http://play.google.com/store/apps/details?id=com.iconchanger.widget.theme.shortcut",
    "ctaText": "Install now",
    "displayFormat": "IMAGE",
    "imageUrls": [
      "https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/700927950_933331229664450_6487763311056032772_n.jpg?_nc_cat=111&ccb=1-7&_nc_sid=c53f8f..."
    ],
    "searchedFor": "nike",
    "searchCountry": "US"
  },
  {
    "adArchiveId": "962050096457659",
    "adLibraryUrl": "https://www.facebook.com/ads/library/?id=962050096457659",
    "pageId": "156405867784232",
    "pageName": "Depop",
    "pageCategories": [
      "Shopping"
    ],
    "pageLikeCount": 98483,
    "isActive": true,
    "startDate": "2026-05-22",
    "platforms": [
      "facebook",
      "instagram",
      "messenger"
    ],
    "title": "LOFT Women's Blouse",
    "linkUrl": "http://itunes.apple.com/app/id518684914",
    "linkDescription": "Download Depop - Buy & Sell Clothes by Depop Ltd on the App Store. See screenshots, ratings and reviews, user tips, and more apps like De...",
    "ctaText": "Download",
    "displayFormat": "DPA",
    "imageUrls": [
      "https://scontent-lga3-2.xx.fbcdn.net/v/t39.35426-6/706277483_2044031086227797_898989708800947064_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=c53f8f...",
      "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/706317255_2037222576909248_2490268264375552452_n.jpg?_nc_cat=106&ccb=1-7&_nc_sid=c53f8...",
      "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/706277043_1509973367377594_8218495971134332071_n.jpg?_nc_cat=106&ccb=1-7&_nc_sid=c53f8..."
    ],
    "searchedFor": "nike",
    "searchCountry": "US"
  }
]

Code: Python, JavaScript and cURL

Get your API token in Apify Console under Settings, then Integrations. The Actor id is v0iddo/facebook-ads-library-scraper.

Python (apify-client)

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run_input = {'searchTerms': ['nike'], 'country': 'US', 'activeStatus': 'active', 'maxItems': 20}

run = client.actor("v0iddo/facebook-ads-library-scraper").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

JavaScript (apify-client)

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const input = {
  "searchTerms": [
    "nike"
  ],
  "country": "US",
  "activeStatus": "active",
  "maxItems": 20
};

const run = await client.actor('v0iddo/facebook-ads-library-scraper').call(input);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

cURL

curl -X POST "https://api.apify.com/v2/acts/v0iddo~facebook-ads-library-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchTerms": ["nike"], "country": "US", "activeStatus": "active", "maxItems": 20}'

Ready-to-run example scripts: example repository on GitHub.

Price

$0.50 per 1,000 results. You pay per result row. There is no separate charge per run. Higher Apify plans pay less per result, down to $0.35 per 1,000. See the pricing tab for your plan. A new Apify account gets $5 of platform credit every month.

Good to know

FAQ

What data does the Facebook Ad Library scraper return?

Each result is one row in an Apify dataset. Fields include adArchiveId, pageName, isActive, startDate, endDate, platforms, body, title, and more. The table above shows every field with an example value.

How do I use the Facebook Ad Library scraper from Python?

Install the apify-client package, create a client with your Apify API token, call the Actor v0iddo/facebook-ads-library-scraper with an input like the one above, and read the rows from the run's dataset. The Python snippet above does exactly that.

Can I use it without writing code?

Yes. Open the Actor page on Apify, fill in the input form (an example is already filled in), press Start, and download the results as JSON, CSV, Excel or HTML. You can also schedule runs there.

How much does it cost?

$0.50 per 1,000 results. You pay per result row. There is no separate charge per run. Higher Apify plans pay less per result, down to $0.35 per 1,000. A new Apify account gets $5 of platform credit every month.

How do I limit the number of results?

Set the maxItems input field to the number of results you need; the run stops there, so it also caps the cost of one run. You can also set a maximum cost for a run in the run options on Apify, and the run stops when it is reached.

Can I send the results to Google Sheets, Make, Zapier or n8n?

Yes. Apify datasets connect to Google Sheets, Slack, Make, Zapier and n8n, and a webhook can call your own service when a run finishes. You can also export the dataset as JSON, CSV or Excel.

Open Facebook Ad Library scraper on Apify

Related guides