META ADS LYBRRYA SRAPPER (Cost-Optimized)
Pricing
Pay per usage
META ADS LYBRRYA SRAPPER (Cost-Optimized)
Low-cost Meta Ads Library scraper for competitor research. Uses the official Meta Ads Archive API first with no proxy, exports public ad links, page names, ad copy, dates, platforms, spend and impression fields, and supports n8n or spreadsheet workflows.
Pricing
Pay per usage
Rating
0.0
(0)
Developer
MOHAMED CHAREUF
Maintained by CommunityActor stats
0
Bookmarked
4
Total users
1
Monthly active users
2 days ago
Last modified
Categories
Share
Meta Ads Library Scraper - Low-Cost API
Search public Meta Ads Archive data for competitor research and export clean ad records to an Apify dataset. This Actor is built for cost-sensitive research workflows, n8n automations, and spreadsheet analysis.
The default path uses the official Meta Ads Archive Graph API without Apify Proxy. Browser mode is kept only as an optional fallback/debug path.
This Actor is unofficial and is not affiliated with Meta, Facebook, Instagram, or Apify. It uses public Meta Ad Library / Ads Archive data only. It does not automate login, solve CAPTCHA, bypass access restrictions, or collect private user data.
What you can do
- Search public ad archive records by keyword.
- Filter by reached countries, active status, launch date window, ad language, media type, and optional CTA text.
- Export ad IDs, public ad links, advertiser page, ad copy, headline, launch date, platform, spend and impression fields when Meta returns them.
- Run API-only mode for zero proxy usage.
- Integrate with n8n, Make, Zapier, Google Sheets, or the Apify API.
Lowest-cost mode
Use:
{"forceMode": "api","maxResults": 1000,"apiPageSize": 100}
API mode uses no Apify Proxy. The main cost is Apify compute time. Small test runs always have startup overhead, so measure price on larger batches such as 500 to 1000 results.
Snapshot enrichment
Turn on enableSnapshotEnrichment only when you need cleaner CTA, headline, media type, carousel count, or destination URL from each public ad_snapshot_url.
Cost controls:
- The Actor filters and deduplicates API results first, then enriches only rows that will be saved.
- One shared Playwright browser is reused for the run.
- Snapshot concurrency is capped at
3. maxSnapshotEnrichmentslimits how many saved ads are opened in Playwright.
Example:
{"enableSnapshotEnrichment": true,"snapshotConcurrency": 3,"maxSnapshotEnrichments": 100}
For the absolute lowest cost, keep enableSnapshotEnrichment off.
Requirements
You need a Meta Ads Library API access token with Ads Archive access. Temporary Graph API Explorer user tokens can work for testing but expire. For production, use a long-lived Business token after Meta approval.
For private runs, save the token as a secret environment variable:
META_TOKEN
For public users, paste the token into the Meta access token input field. The field is marked as secret in the Apify input UI.
Input
Example:
{"searchTerms": "SHOP NOW","countries": ["DZ", "FR"],"maxResults": 1000,"activeOnly": true,"activeLastDays": 60,"apiPageSize": 100,"maxApiPages": 25,"searchType": "KEYWORD_UNORDERED","ctaFilter": "SHOP NOW","language": "ar","mediaType": "VIDEO","requireCtaMatch": true,"maxStrictCtaNoMatchPages": 3,"enableSnapshotEnrichment": false,"forceMode": "api","metaAccessToken": "YOUR_META_ADS_LIBRARY_API_TOKEN"}
Main fields
searchTerms- Keyword or phrase to search.countries- Country codes such asDZ,FR,MA,US, orALL.maxResults- Maximum ads to save.activeOnly- Requests currently active ads from Meta.activeLastDays- Filters launch date by the last N days.adDeliveryDateMin/adDeliveryDateMax- Exact date window inYYYY-MM-DD.apiPageSize/maxApiPages- Batch size and safety cap for API pagination. LowermaxApiPageswhen strict filters return no rows.ctaFilter- Optional CTA hints such asSHOP NOW, ORDER NOWorSHOP NOW AND ORDER NOW.language/languages- Optional Meta language filter. Usearor["ar"]for Arabic,enfor English,frfor French. Leave empty to keep all languages.mediaType- Optional Meta APImedia_typesearch filter. UseALL,IMAGE,VIDEO,MEME, orNONE. This is applied before pagination and can reduce compute for video/image-only research.requireCtaMatch- Keep on when you need only the selected CTA. The Actor checks returned CTA fields first, then exact creative text fallback when Meta does not expose the CTA field.maxStrictCtaNoMatchPages- Stops early when strict CTA matching sees no matching CTA for several consecutive API pages.enableSnapshotEnrichment- Opens saved public snapshot pages with Playwright to extract cleanerheadline,cta_text,media_type,carousel_count, anddestination_url.maxSnapshotEnrichments- Caps snapshot parsing so test runs do not become expensive.forceMode- Useapifor lowest cost,autofor API then browser fallback,browseronly for debugging.metaAccessToken- Optional secret input token. If omitted, the Actor usesMETA_TOKEN.
Output
The default dataset includes the public fields returned by Meta plus helpful normalized links:
idadLibraryUrlad_snapshot_urlpage_idpage_namead_creative_bodiesad_creative_link_titlesad_creative_link_descriptionsheadlinecta_textmedia_typecarousel_countdestination_urlsnapshot_enrichmentad_delivery_start_timead_delivery_stop_timepublisher_platformslanguagesimpressionsspendcurrencysearchTermsUsedrelaxedSearch
The Output tab uses an overview table for the most useful spreadsheet columns. Full JSON is still available for export.
n8n API example
Use the synchronous endpoint when you want n8n to receive dataset items directly:
POST https://api.apify.com/v2/acts/defensible_jadeite~meta-ads-library-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN&maxTotalChargeUsd=1
Public API actor ID:
defensible_jadeite~meta-ads-library-scraper
The public Store URL uses a slash:
https://apify.com/defensible_jadeite/meta-ads-library-scraper
Do not paste defensible_jadeite/meta-ads-library-scraper into the /acts/... API path. Apify API actor identifiers must use either the raw Actor ID or the tilde form. The slash form returns 404 Actor wasn't found.
Correct n8n expression:
https://api.apify.com/v2/acts/{{ $('YOUR KEYS').item.json.APIFY_ACTOR_ID }}/run-sync-get-dataset-items?token={{ $('YOUR KEYS').item.json.APIFY_API_KEY }}&maxTotalChargeUsd=1
Set the keys node values to:
{"APIFY_ACTOR_ID": "defensible_jadeite~meta-ads-library-scraper","APIFY_API_KEY": "YOUR_APIFY_API_TOKEN","META_ACCESS_TOKEN": "YOUR_META_ADS_LIBRARY_API_TOKEN"}
Headers:
{"Content-Type": "application/json"}
Body:
{"searchTerms": "SHOP NOW","countries": ["DZ"],"maxResults": 1000,"forceMode": "api","activeOnly": true,"activeLastDays": 60,"apiPageSize": 100,"maxApiPages": 25,"language": "ar","languages": ["ar"],"mediaType": "VIDEO","ctaFilter": "SHOP NOW","requireCtaMatch": true,"maxStrictCtaNoMatchPages": 3,"enableSnapshotEnrichment": false,"failOnNoResults": true,"metaAccessToken": "{{ $('YOUR KEYS').item.json.META_ACCESS_TOKEN }}"}
For a small n8n test, set maxResults to 5. If the HTTP Request node returns Actor wasn't found, the APIFY_ACTOR_ID value is wrong. If it returns 401 or 403, the Apify API token is wrong. If the Meta API returns a permission error, update the Meta Ads Library API token.
If a run finishes with no ads, open the run key-value store and inspect RUN_SUMMARY. It explains whether the Actor saw a Meta API/token error, strict filters, or a real no-result search. By default, API errors and empty results fail the run so n8n does not continue with an empty sheet by mistake.
Important limitations
- Meta can limit which commercial ads are available through the official API by region and policy category.
- If the official API returns zero records for a keyword, try a broader keyword, more countries, or
activeOnly: false. languageuses Meta's officiallanguagessearch parameter. For Arabic, the Actor also checks for Arabic script when Meta does not return a language field.mediaTypeuses Meta's officialmedia_typesearch parameter. Supported values areALL,IMAGE,VIDEO,MEME, andNONE.ctaFilteris strict whenrequireCtaMatchis true. Separate multiple CTAs with commas orAND, for exampleSHOP NOW, ORDER NOWorSHOP NOW AND ORDER NOW.- Meta does not expose a CTA field for every ad. When the CTA field is missing, the Actor uses exact creative text fallback and records
ctaFilterMatchSourceso you can see how the row matched. - Snapshot enrichment can extract CTA from the public snapshot page, but it costs extra compute because it opens pages in Playwright.
- If strict CTA matching returns no rows, the Actor stops after
maxStrictCtaNoMatchPagesno-match pages instead of scanning the full result set. - Browser fallback costs more because it uses Playwright and Apify Proxy.
Troubleshooting
Missing META_TOKEN
Add a Meta token in metaAccessToken or set the META_TOKEN secret environment variable.
Invalid Meta token input: received an Apify ENCRYPTED_VALUE placeholder
Do not copy the hidden token value from an old Apify run input. Paste a fresh Meta Ads Library API token into metaAccessToken, or save it as the META_TOKEN Actor secret.
Application does not have permission for this action
Your token has not been approved for Ads Archive API access yet. Complete the official Meta flow at:
https://www.facebook.com/ads/library/api/
Zero results but no error
The keyword, date, country, language, or active-only filter may be too strict. Start with activeOnly: false, remove ctaFilter, clear language, test a broad keyword, and check the RUN_SUMMARY key-value-store record.
High cost
Use forceMode: "api" and keep enableSnapshotEnrichment: false for the cheapest runs. Avoid auto or browser unless you explicitly want browser fallback. If snapshot enrichment is needed, lower maxSnapshotEnrichments.