Apify example task · whoareyouanas/meta-ad-scraper

Export Meta Ad Library ads by Facebook Page ID

Export up to 10 active Meta Ad Library ads from one advertiser Page ID. Review ad copy, media links, CTA, dates, and platforms in the dataset, then download CSV or JSON.

Actor
Meta (Facebook) Ad Library Scraper - Fast & Reliable
Result limit
10 (maxAds)
Estimated cost
Up to $0.06
Run options
1 GB memory · 180 s timeout

Example updated 2026-11-23 · actor build 0.3.2 · runs in your own Apify account

From public source to spreadsheet

Use the advertiser’s Facebook Page ID, country, and status to pull a bounded sample from Meta Ad Library. Open the Apify dataset and export CSV for a spreadsheet or JSON to retain nested media fields.

  1. Confirm the advertiser in Meta Ad Library. Enter its Page ID and select the country and status for this snapshot.
  2. Keep maxAds at 10 for the first run. Compare a few returned ads against the Library with the same filters.
  3. Export the dataset. Keep the Library IDs as text and record the capture date and filters. Reuse those filters when you compare next week’s export.

The overview includes libraryID, brand, body, ctaText, linkUrl, startDate, images, and videos when available. Creative URLs may expire. The filters and public source coverage determine what appears in the export.

01 / About the actor

Meta (Facebook) Ad Library Scraper - Fast & Reliable

Export public Facebook and Instagram ads from Meta Ad Library by advertiser Page ID, keyword, or saved search URL. Download CSV or JSON with ad copy, creative links, CTAs, platforms, and dates.

Two ways to start

Paste a saved Ads Library search URL, or set a country and search by Page ID or keyword.

Creative research

Keep copy, advertiser identity, destination links, images, videos, and format together.

Search controls

Choose status, media type, language, and sorting through the deployed input fields.

02 / Input

The exact input this example runs.

A direct targetUrl takes precedence over the search parameters. For a keyword or Page ID search, set country and start with maxAds set to 10. Review the returned rows before increasing the cap.

input.json · meta-facebook-page-ad-inventory
{
  "maxConcurrency": 1,
  "requestHandlerTimeoutSecs": 120,
  "pageId": "108047081396228",
  "country": "US",
  "activeStatus": "active",
  "sortMode": "start_date",
  "maxAds": 10
}
Input fields used by this example, their values and what they control
FieldValue in this exampleWhat it controls
maxConcurrency1Number of browser tabs to run in parallel. Keep at 1 for stability. Increase to 2-3 only if you need faster scraping and have sufficient memory. Higher values increase memory usage.
requestHandlerTimeoutSecs120Maximum time to wait for a page to load and scrape all ads. Pages with 200+ ads need 600-900 seconds. Default of 900 seconds (15 minutes) handles large datasets.
pageIdChange this"108047081396228"Numeric Facebook Page ID to view all ads from a specific page (e.g. 108047081396228). You can find this in the URL when viewing a page's ads.
countryChange this"US"ISO 3166-1 alpha-2 country code for ad targeting (e.g. US, IN, IT, GB). Required when not using a direct URL.
activeStatus"active"Filter by ad campaign status.
sortMode"start_date"Sort metric for results.
maxAdsChange this10Stop after this many ads. Defaults to 100. Raise it (up to 10,000) to collect more; each ad is a billed result.
Other inputs you can add (8)
Deployed actor input fields, types, defaults, and descriptions
FieldType / requiredDefaultPurpose
targetUrlstringNot specifiedPaste the full Facebook Ad Library URL directly. If provided, all parameter fields below are ignored. Leave empty to build the URL from parameters instead.
searchQuerystringNot specifiedKeyword search query (e.g. 'nike', 'adidas shoes'). This searches across all ads by keyword.
adIdstringNot specifiedNumeric ID of a specific ad to look up (e.g. 1191898553123641).
adTypestring"all"Filter by type of ads.

Options: all, political_and_issue_ads, housing, employment, credit

mediaTypestring"all"Filter by media format.

Options: all, image, video, meme

isTargetedCountrybooleanfalseIf true, only show ads specifically targeting the selected country.
contentLanguagesarrayNot specifiedFilter by content language codes (ISO 639-1, e.g. 'en', 'it', 'hi'). Leave empty for all languages.
sortDirectionstring"desc"Sort order for results.

Options: desc, asc

03 / Make it yours

Change these fields for your own research.

  1. 01 · pageId

    Facebook Page ID

    Numeric Facebook Page ID to view all ads from a specific page (e.g. 108047081396228). You can find this in the URL when viewing a page's ads.

    Example: "108047081396228"

  2. 02 · country

    Country

    ISO 3166-1 alpha-2 country code for ad targeting (e.g. US, IN, IT, GB). Required when not using a direct URL.

    Example: "US"

  3. 03 · maxAds

    Max Ads

    Stop after this many ads. Defaults to 100. Raise it (up to 10,000) to collect more; each ad is a billed result.

    Example: 10

Run it in three steps

  1. Open the example on Apify and select Try for free to copy it into your Apify account.
  2. Replace the sample values above with your own target and keep the limit small.
  3. Start the run, then export the dataset as JSON, CSV or Excel.

04 / Output

What the results table shows.

Columns in the “Overview” view

libraryID

Library ID

brand

Brand

industry

Industry

active

Active

platforms

Platforms

totalPlatforms

Total Platforms

similarAdCount

Similar Ad Count

multipleVersions

Multiple Versions

body

Body

linkTitle

Link Title

linkUrl

Link URL

linkDescription

Link Description

ctaText

CTA Text

ctaUrl

CTA URL

images

Images

videos

Videos

startDate

Start Date

endDate

End Date

format

Format

A view selects columns for the table. The full JSON export keeps every field, including nested arrays and objects.

05 / Cost

What this example costs to run.

At most about $0.06: up to 10 results at $0.006 each (ad). Fewer results cost less. The live Pricing tab on Apify is authoritative.

Prices checked 2026-11-24. Set a run spending limit in Apify when you widen the input.

06 / API

Run the same input from your code.

This call starts a billable run of Meta (Facebook) Ad Library Scraper - Fast & Reliable with this example's input and returns the dataset items when it finishes. Synchronous calls wait up to five minutes; for longer runs, POST to /runs instead and read the run's default dataset when it succeeds. Keep the token in an environment variable.

cURL · run and return the results
curl --request POST \
  'https://api.apify.com/v2/acts/whoareyouanas~meta-ad-scraper/run-sync-get-dataset-items?format=json' \
  --header "Authorization: Bearer $APIFY_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{"maxConcurrency":1,"requestHandlerTimeoutSecs":120,"pageId":"108047081396228","country":"US","activeStatus":"active","sortMode":"start_date","maxAds":10}'

Coverage & interpretation

Check the result before relying on it.

Questions

About this example.

What does the "Export Meta Ad Library ads by Facebook Page ID" example collect?

Export up to 10 active Meta Ad Library ads from one advertiser Page ID. Review ad copy, media links, CTA, dates, and platforms in the dataset, then download CSV or JSON. It runs Meta (Facebook) Ad Library Scraper - Fast & Reliable, published by whoareyouanas on Apify.

Which input does this example use?

Facebook Page ID (pageId) set to "108047081396228"; Country (country) set to "US"; Max Ads (maxAds) set to 10. The full JSON input is shown on this page.

How much does it cost to run this example?

At most about $0.06: up to 10 results at $0.006 each (ad). Fewer results cost less. The live Pricing tab on Apify is authoritative.

How do I change it for my own research?

Open the example on Apify and select Try for free to copy it into your account, then edit Facebook Page ID, Country, Max Ads. Keep the result limit small for the first run and check the output before scaling up.

Can I run it from the API or on a schedule?

Yes. Send the same JSON input to the Meta (Facebook) Ad Library Scraper - Fast & Reliable run endpoint with your Apify API token, or save the copied task in your Apify account and add a schedule. Results land in the run's default dataset as JSON, CSV or Excel.

More examples

Related tasks you can copy.

Guides

Read more about this workflow.