The short answer
The best-known Facebook Ad Library API GitHub repo is Meta's own Ad-Library-API-Script-Repository (349 stars, last commit February 2025, hardcoded to Graph API v14.0). The rest split into official-API clients that inherit its EU-only rule for commercial ads, scrapers that use internal Meta endpoints and break when they change, and MCP servers that wrap one or the other. None returns spend, a winner signal or transcripts; the Ad Radar Data API does, over REST and MCP.
In this article8 sections
The short answer
Search "facebook ad library api github" and you land on a few dozen repos that do one of three things: call Meta's official ads_archive API, scrape the public web Library, or wrap either one in an MCP server for Claude and other agents. We opened the ones that matter in November 2026 and recorded their stars, their last push, what they do and where they break.
The pattern is consistent. Official-API clients are stable but inherit Meta's coverage rule, so they return nothing for US-only commercial ads. Scrapers cover those ads but depend on internal endpoints that change without notice. And every repo, whatever its method, returns raw ads: no spend for commercial ads, no winner signal, no transcripts, no tags. At the end there is a ready-made alternative with a short code example.
349
stars on Meta's official script repo
Feb 2025
its last commit
v14.0
the Graph API version its client defaults to
2,761
ranked winning Meta ads in the Ad Radar Data API
Facebook Ad Library API GitHub repos, at a glance
Stars and last push are from the GitHub API on November 19, 2026.
| Repo | Stars | Last push | Method | What it does |
|---|---|---|---|---|
| facebookresearch/ | 349 | Feb 2025 | Official API | Meta's Python scripts and CLI for ads_archive |
| facebookresearch/ | 73 | Jan 2024, archived | Official API | R package for the Ad Library API |
| minimaxir/ | 147 | Nov 2019 | Official API | Python script for political ads to three clean CSVs |
| Paularossi/ | 37 | Jul 2026 | Official API | Python package and CLI that downloads ads and their media |
| promisingcoder/ | 112 | Nov 2026 | Internal web endpoints | pip package, CLI and MCP server, no API key |
| athm793/ | 65 | Aug 2026 | Headless browser | Self-hosted research tool with a SQLite swipe file |
| proxy-intell/ | 331 | Nov 2026 | ScrapeCreators API | MCP server with Gemini video analysis |
| RamsesAguirre777/ | 302 | Aug 2026 | Headless browser | Two-tool MCP server that parses Library cards |
| thenavidm/ | 14 | Nov 2026 | MCP and CLI | Ad Library tools for Claude Code and Codex |
Stars measure attention, not reliability. Two of the four most-starred official-API repos haven't been touched in years.
Official API clients
These repos call https://graph.facebook.com/<version>/ads_archive with your access token. You need a confirmed identity and a Meta developer app first; the setup is in our Meta Ad Library API guide.
facebookresearch/Ad-Library-API-Script-Repository
This is Meta's own repo, and the one most tutorials point to. It is a set of Python scripts plus a CLI. The README's example:
python fb_ads_library_api_cli.py -t {access_token} \
-f 'page_id,ad_snapshot_url,funding_entity,ad_delivery_start_time' \
-c 'CA' -s '.' -v count
The CLI has four actions: count, save, save_to_csv and start_time_trending, with flags for fields, country, search term, Page IDs, active status, start date, batch size and retries.
Where it breaks:
- Stale version. The client class sets
default_api_version = "v14.0", a Graph API version from 2022, and the CLI has no flag to change it. To use a current version you edit the source. - Slow maintenance. The last commit is from February 2025, and 22 issues are open, including "Meta Ad Library API does not return any ad for some page and also not return same data as it shows on ads library" (May 2024) and "Ads do not show with link provided by ad_snapshot_url" (January 2025).
- The coverage rule. Meta's ads_archive reference says: "Ads that did not reach any location in the EU will only return if they are about social issues, elections or politics." No code change fixes that.
Read it to learn the API. For production code, the 60-line client in our Facebook Ad Library API with Python tutorial is easier to keep current.
Radlibrary and minimaxir/facebook-ad-library-scraper
Radlibrary is Meta's R package for the same API, archived since January 2024. minimaxir/facebook-ad-library-scraper, by Max Woolf, is a clean Python script that writes fb_ads.csv plus demographic and region breakdowns, built for political ads; its last push was in 2019. Both are good references for how the data is shaped. Neither is something to build on in 2026.
Paularossi/AdDownloader
AdDownloader is the most complete official-API package still maintained: a Python library and CLI that queries the API, downloads each ad's images and videos, and adds analysis on top, with an accompanying paper in SoftwareX. Its issue history shows the weak spot of any media pipeline built on the Library: "Missing images & videos" (November 2024) and "No media were downloaded for every ad in the search" (January 2026), each followed by a fix release. Media extraction breaks whenever Meta changes how the ad snapshot renders.
Scrapers of the web Library
Scrapers exist because of the coverage rule: the web Library shows US commercial ads that the API won't return. The price is fragility.
promisingcoder/MetaAdsCollector is the most active, with a PyPI package (meta-ads-collector), a CLI that writes CSV, JSON or JSONL, and an MCP extra with background jobs. Its README is direct about the risk: "MetaAdsCollector uses internal Meta endpoints. Meta can change or restrict access, so network, proxy, verification, or rate-limit failures can occur. An empty query result does not establish that no matching ads exist."
athm793/meta-ads-scraper drives a headless Playwright browser against the public Library and stores everything in a local SQLite file, with keyword and advertiser search, filters and a swipe file. It is a full local app, which means it is also a full local app to keep running.
That last sentence from MetaAdsCollector is the honest summary of every scraper: when it returns nothing, you can't tell whether there were no ads or the scraper broke.
MCP servers
MCP servers let Claude, ChatGPT or Cursor query the Library directly. They wrap one of the two methods above, so they inherit its limits.
- proxy-intell/facebook-ads-library-mcp, MIT licensed, has tools such as
get_meta_platform_id,get_meta_ads,analyze_ad_imageandanalyze_ad_video. It doesn't scrape on its own: you bring a ScrapeCreators key, which its README prices at "about $1.88 per 1,000 calls," and a Gemini key for video analysis. The README also discloses an anonymous usage ping on each tool call (turn it off withPROXY_TELEMETRY=0) and periodic tips promoting the maintainers' hosted version. - RamsesAguirre777/facebook-ads-library-mcp has two tools,
search_ad_libraryandscrape_ad_library_url, and renders the Library page in a headless browser. Its README notes the first paint is "only ~20–26 cards" and more need extra scroll rounds of 2.5 seconds each. - MetaAdsCollector and thenavidm/facebook-ad-library-mcp-cli add MCP on top of their own collectors.
An agent connected to any of these gets raw cards and has to guess which ads matter. Ask it for "the best-performing ads in this niche" and it can only rank by what the Library shows: start dates and ad counts.
Where every GitHub tool breaks
| Failure | Who it hits | What you see |
|---|---|---|
| EU-only rule for commercial ads | Every official-API client | Empty results for US-only brands |
| Internal endpoint or page changes | Every scraper and scraper-based MCP | Empty or half-filled results, with no error |
| Throttling and login checks | Scrapers at volume | Timeouts, login walls, proxy bills |
| Expiring media URLs | Everyone | Video links that stop working, missing media |
| One maintainer | Most repos | Fixes arrive when that person has time, or never |
| No spend, winner signal, transcripts or tags | Every repo | A pile of raw ads you still have to rank |
The last row is the one no pull request will fix. Meta doesn't publish spend for commercial ads, the Library has no notion of a winner, and transcripts and tags have to be produced by your own pipeline: daily snapshots, media storage, speech-to-text, a spend model, a tagging pass. That is months of work, laid out in how to build an ad spy tool, and the history you didn't record can't be recovered later.
A ready-made alternative: the Ad Radar Data API
The Ad Radar Facebook ads API is what these repos would become after that pipeline was built and run every day: the best database of winning Meta ads, over REST and MCP. 2,761 Meta ads with $50k+ estimated spend from 734 brands, Facebook and Instagram, built from the public Meta Ad Library and refreshed daily. US commercial brands included.
Every ad has brand, headline, body, CTA, the full video transcript, spendEstimate (estimated spend in USD, from the ad's public engagement), metrics.score and tier (winner = top 10% by score and live 21+ days, or rising), days running, variants, tags on ten dimensions (hook pattern, hook mechanism, narrative angle, awareness, proof level, production format, video type, landing page type, niche, CTA type) and public poster and video URLs.
The code: 15 lines instead of a repo
import os
import requests
r = requests.get(
"https://app.ad-radar.dev/api/v1/ads/search",
params={"q": "skillet", "tier": "winner", "format": "video",
"sort": "spend", "limit": 20},
headers={"Authorization": f"Bearer {os.environ['AD_RADAR_KEY']}"},
timeout=30,
)
r.raise_for_status()
for ad in r.json()["data"]:
tags = ", ".join(t["label"] for t in ad["tags"][:3])
print(f"${ad['spendEstimate']:,} {ad['brand']} [{tags}]")
print(" ", (ad.get("transcript") or "")[:100])
q searches headline, body, brand and transcript, so you can find ads by what is said in the video. Results are cursor-paginated (pagination.nextCursor), up to 100 per page, and one page is one request. The OpenAPI 3.1 spec is at https://app.ad-radar.dev/api/v1/openapi.json, so you can generate a typed client instead of maintaining one. Every endpoint and parameter is in the API reference.
The MCP server: one command
claude mcp add --transport http ad-radar \
https://app.ad-radar.dev/api/mcp \
--header "Authorization: Bearer $AD_RADAR_KEY"
It is hosted, so there is nothing to clone, no headless browser and no third-party scraping key. The tools are search_ads, get_ad, winning_patterns, advertiser_hooks, get_swipe_prompt and list_taxonomy, and each tool call counts as one request. Setup for Claude Desktop, claude.ai and ChatGPT is on the MCP page.
GitHub repos vs the Data API
| Official API repos | Scraper and MCP repos | Ad Radar Data API | |
|---|---|---|---|
| US commercial ads | No | Yes, while the scraper works | Yes |
| Only ads that are working | No | No | Yes, $50k+ estimated spend |
| Spend | Political ads only | No | Estimated, on every ad |
| Transcripts | No | No, or a paid add-on | Full script, searchable |
| Tags | No | No | Ten dimensions |
| Maintenance | You, on a stale client | You, every time Meta changes | None on your side |
| Plan (billed every 4 weeks) | Price | Requests | What you get |
|---|---|---|---|
| Builder | $299 | 10,000 | REST and MCP, use inside your product and show the data to your users, the web app included |
| Scale | $799 | 50,000 | Everything in Builder, plus /feed for incremental sync and a higher rate limit |
| Reseller | From $2,000 | Custom | Full NDJSON /export, resale and white-label, by request |
Over quota you get a 429 with an upgrade link, never an overage charge. All plans are on the pricing table.
The verdict
The Facebook Ad Library API repos on GitHub are worth reading: Meta's script repository teaches the API, AdDownloader and MetaAdsCollector show what a working collector looks like in 2026. But each one hands you raw ads and a maintenance job. The official clients can't see US commercial ads, the scrapers break when Meta changes its endpoints, and none of them knows which ads are winning.
The Ad Radar Data API gives you the finished result: ranked winners with estimated spend, transcripts and tags, in one REST call or one MCP tool call. Start on Builder at $299 every 4 weeks and step up to Scale for the incremental feed. If you'd rather browse than code, the same winners are in the Ad Radar app. For the broader landscape of scrapers, see our Facebook Ad Library scraper roundup.
Figures marked as estimated spend come from Ad Radar's model of engagement on public Meta Ad Library ads. They are estimates, labeled as such, and are best used to rank ads against each other. How the board is built.