---
title: "Facebook Ad Library API without the token hassle"
description: "Search Facebook and Instagram ads by keyword or advertiser as JSON, then the Google and LinkedIn ad libraries, with Python, JavaScript and curl code."
url: https://scrapecrate.com/blog/facebook-ad-library-api
markdown: https://scrapecrate.com/blog/facebook-ad-library-api.md
---

# The Facebook Ad Library API, plus Google and LinkedIn ads

Search Facebook and Instagram ads by keyword or advertiser as JSON, then the Google and LinkedIn ad libraries, with Python, JavaScript and curl code.

Published November 24, 2026 · 7 min read

Your competitors publish their marketing plan every day. Every ad that runs on Facebook and Instagram is listed in the Meta Ad Library, every Google ad in the Google Ads Transparency Center, and every LinkedIn sponsored post in the LinkedIn Ad Library. The copy, the creative, the landing page, the start date: it is all public, because regulators asked for it.

The catch is reading it at scale. The Meta Ad Library website is built for browsing one advertiser at a time, and Meta's own Ad Library API asks for identity verification and an access token, and outside the EU and UK it mostly returns political and issue ads. If you want "every running shoe ad active in Germany this month" as a spreadsheet, you need something else.

This guide shows how to search all three ad libraries with plain HTTP calls that return JSON, with code in curl, Python and JavaScript.

## Searching Facebook and Instagram ads

The [Meta Ad Library API](https://scrapecrate.com/meta-ad-library-api.md) of ScrapeCrate starts with one search endpoint:

```text
GET https://api.scrapecrate.com/v1/ads/search
```

Give it a keyword (`q`) or an advertiser page (`page_id`), and filter by `country` (a two-letter code, or `ALL`, the default), `status` (`active`, the default, `inactive` or `all`), `media_type` (`image`, `video`, `meme`, `none` or `all`), `platforms`, `languages` and dates.

```bash
curl "https://api.scrapecrate.com/v1/ads/search?q=running%20shoes&country=DE&status=active&media_type=video" \
  -H "X-API-Key: YOUR_API_KEY"
```

```python
# pip install scrapecrate
from scrapecrate import ScrapeCrate

client = ScrapeCrate(api_key="YOUR_API_KEY")
page = client.ads.ads_search(q="running shoes", country="DE", status="active", media_type="video")
for ad in page.data:
    print(ad["started_at"], ad["page"]["name"], ad["body"][:80])
print(page.credits_used, page.has_more)
```

```javascript
// npm install scrapecrate
import { ScrapeCrate } from 'scrapecrate';

const client = new ScrapeCrate({ apiKey: 'YOUR_API_KEY' });
const page = await client.ads.adsSearch({ q: 'running shoes', country: 'DE', status: 'active', media_type: 'video' });
for (const ad of page.data) console.log(ad.started_at, ad.page.name, ad.body);
console.log(page.creditsUsed, page.hasMore);
```

Each ad in `data` has these fields:

| Field | What it is |
| --- | --- |
| `id`, `url` | The Ad Library ID and the link to the ad in the library |
| `page` | The advertiser page, `id` and `name` |
| `status` | `active` or `inactive` |
| `started_at`, `days_active` | When it started and how long it has been running |
| `winning_score` | A 0-100 score, longevity first (see below) |
| `platforms` | Where it runs: `facebook`, `instagram`, `messenger`, `audience_network` |
| `format` | The creative type |
| `body`, `title`, `link_url`, `cta` | The ad copy, headline, landing page and call to action |
| `images` | The creatives, each with `type` and `url` |

`match=exact` searches the phrase as written instead of any of its words, which matters for brand names made of common words. `ad_type=political` keeps only political and issue ads.

## Finding the ads that work

The library does not show spend or conversions, but advertisers do not keep paying for ads that lose money. An ad that has been running for three months is almost always a winner. Two parameters use that:

- `sort=longevity` puts the longest-running ads of the page first (`impressions` and `relevance` are the other orders);
- `min_days_active=30` drops the ads younger than 30 days.

Every ad also carries `winning_score`, from 0 to 100: longevity weighs 70 points, the number of creative variants 15 and, when the library publishes it, the EU reach 15. A missing reach never lowers the score.

```python
winners = client.ads.ads_search(q="protein powder", country="US", sort="longevity", min_days_active=60)
for ad in winners.data:
    print(ad["winning_score"], ad["days_active"], ad["link_url"])
```

Look at the landing pages of the top ten: you will see which offers, angles and page layouts the market has validated, before spending your own budget.

## Everything one advertiser runs

To follow a specific competitor, find its page first, then list its ads:

```bash
curl "https://api.scrapecrate.com/v1/ads/pages/search?q=example%20shoes" -H "X-API-Key: YOUR_API_KEY"
curl "https://api.scrapecrate.com/v1/ads/pages/102030405060708/ads?status=all&sort=longevity" -H "X-API-Key: YOUR_API_KEY"
```

```python
pages = client.ads.pages_search(q="example shoes")
page_id = pages.data[0]["id"]
info = client.ads.page(page_id=page_id)
print(info.data["name"], info.data["active_ads_estimate"])
for ad in client.ads.iterate("page_ads", page_id=page_id, status="all"):
    print(ad["status"], ad["started_at"], ad["body"][:60])
```

```javascript
const pages = await client.ads.pagesSearch({ q: 'example shoes' });
const pageId = pages.data[0].id;
for await (const ad of client.ads.iterate('pageAds', { page_id: pageId, status: 'all' })) {
  console.log(ad.status, ad.started_at, ad.body);
}
```

The advertiser endpoint adds the page `category`, `like_count`, the linked `instagram` account and `active_ads_estimate`. One ad by ID (`/v1/ads/{ad_id}`) adds `payers` (who paid and who benefits) and, for ads shown in the EU, `transparency` with reach and age range.

Run the page ads call every week with `status=all` and store the IDs: a diff between two runs tells you which ads a competitor launched and which ones it stopped.

## Google ads: the Transparency Center

The same API reads the Google Ads Transparency Center, which covers ads on Search, YouTube, Display and Shopping. Google identifies advertisers by an ID that starts with `AR`; find it by name, then search the ads by advertiser or directly by the domain the ads point to:

```bash
curl "https://api.scrapecrate.com/v1/ads/google/ads/search?domain=example.com&region=US&format=image" \
  -H "X-API-Key: YOUR_API_KEY"
```

```python
advertisers = client.ads.google_advertisers_search(q="example retail")
ads = client.ads.google_ads_search(advertiser_id=advertisers.data[0]["id"], region="US", format="video")
for ad in ads.data:
    print(ad["format"], ad["started_at"], ad["ended_at"], ad["preview_url"])
```

```javascript
const ads = await client.ads.googleAdsSearch({ domain: 'example.com', region: 'US', format: 'image' });
for (const ad of ads.data) console.log(ad.format, ad.started_at, ad.ended_at, ad.preview_url);
```

Each Google ad has `advertiser`, `format` (`text`, `image` or `video`), `started_at` and `ended_at` (first and last shown), `images`, `videos`, a `preview_url` that renders the ad, `domain` and `variants_count`. The single ad endpoint, `/v1/ads/google/ads/{creative_id}?advertiser_id=...`, adds the `topic` and the `regions` where it ran, each with dates and an impressions range when Google publishes one.

## LinkedIn ads for B2B research

For B2B, LinkedIn is where the budgets go. Search the LinkedIn Ad Library by keyword (`q`) or by `advertiser` name, with `country`, `date_range` (`last_30_days`, `current_month`, `current_year`, `last_year` or `all`) and `sort` (`newest` or `oldest`):

```bash
curl "https://api.scrapecrate.com/v1/ads/linkedin/ads/search?q=crm&country=DE&date_range=last_30_days" \
  -H "X-API-Key: YOUR_API_KEY"
```

```python
ads = client.ads.linkedin_ads_search(q="crm", country="DE", date_range="last_30_days")
for ad in ads.data:
    print(ad["advertiser"]["name"], ad["format"], ad["body"][:80])
detail = client.ads.linkedin_ad(ad_id=ads.data[0]["id"])
print(detail.data["impressions"], detail.data["targeting"])
```

```javascript
const ads = await client.ads.linkedinAdsSearch({ q: 'crm', country: 'DE', date_range: 'last_30_days' });
const detail = await client.ads.linkedinAd({ ad_id: ads.data[0].id });
console.log(detail.data.payer, detail.data.impressions, detail.data.targeting);
```

The detail of one LinkedIn ad holds the gem: for ads shown in the EU, the `targeting` the advertiser chose (locations, and the other criteria LinkedIn discloses), `impressions` and the share of impressions by country.

## What it costs

Every ads endpoint, Meta, Google or LinkedIn, costs **5 credits per successful call**, $0.005 at the list price, whatever the number of ads it returns. A full page of 30 Meta ads is the same price as a page of one. Errors are not billed, and the monthly 100 free credits cover 20 calls. Subscriptions lower the price per credit; see the [pricing page](https://scrapecrate.com/pricing.md).

A weekly watch of 20 competitors on Meta, one call each, costs 100 credits a week, about 40 cents a month.

## Ideas for what to build

1. **A swipe file.** Search your category every Monday with `sort=longevity`, save the creatives and copy of the top ads in a shared folder for your designers.
2. **Launch alerts.** Diff the active ads of each competitor page between two days and post the new ones in Slack.
3. **Offer and pricing research.** Collect `link_url` of the long-running ads and fetch the landing pages as Markdown with the [Web Page to Markdown API](https://scrapecrate.com/url-to-markdown-api.md); an LLM can then extract the offers, prices and guarantees.
4. **Lead lists for agencies.** Advertisers that run ads have budget. Combine advertiser pages with local businesses from Google Maps, as in our [lead generation pipeline guide](https://scrapecrate.com/blog/lead-generation-scraper.md).
5. **Search and social side by side.** Compare what a brand says in its paid social ads with the queries it buys on Google, using the [Google Search API guide](https://scrapecrate.com/blog/google-search-api) for the organic and paid results.

## Things to keep in mind

- Ad libraries change what they show by country. `country=ALL` is the widest search, but EU and UK ads carry more transparency data.
- `min_days_active` and `sort=longevity` work on the returned page, at the same price. For a full ranking, read a few pages and sort them yourself.
- Ads contain brand assets and copy owned by the advertiser. Research is fine; republishing them as your own is not. Our guide on [whether web scraping is legal](https://scrapecrate.com/blog/is-web-scraping-legal.md) covers the details.

Ready to look at your market? [Create a free account](https://scrapecrate.com/auth/sign-up), copy your API key and run the first search above, or read every parameter in the [ads API reference](https://scrapecrate.com/docs/api/ads.md).

## Frequently asked questions

**Does Meta have an official Ad Library API?**

Yes, but it needs a verified identity, a developer app and an access token, and outside the EU and UK it mainly covers political and issue ads. The API in this guide reads the public Ad Library, so commercial ads in every country come back too, with a single API key.

**How many ads can I get per call?**

Up to 30 Facebook and Instagram ads, 40 Google ads or 25 LinkedIn ads per call, one page of each source. Follow pagination.next_cursor for the next page; every page is a new call at 5 credits.

**Can I find the ads that are working for a competitor?**

The Ad Library does not publish spend or results, but longevity is a strong signal. Every Meta ad has days_active and a 0-100 winning_score; sort=longevity and min_days_active keep the ads an advertiser has been paying for the longest.

**Can I download the images and videos of an ad?**

The images list carries the creative URLs as the library serves them. Download what you need soon after the call, because the library's media links can expire.

**What does it cost?**

Every ads endpoint, Meta, Google or LinkedIn, costs 5 credits per successful call, so about half a cent at the list price. Failed calls are free and the first 100 credits of each month are on us.

## Try it with free credits every month

One API key for every source in this guide. No card needed, and only successful calls are billed.

[Create a free account](https://scrapecrate.com/auth/sign-up) [Read the docs](https://scrapecrate.com/docs.md)

## Related guides

- [Build a lead generation scraper with Google Maps, websites and reviews A lead generation scraper in Python and JavaScript, from Google Maps search to each business's website and reviews, with costs per 1,000 leads.](https://scrapecrate.com/blog/lead-generation-scraper.md)
- [How to choose the best web scraping API What makes a web scraping API good in 2026, how per-request, credit, bandwidth and compute pricing compare, and when one API for every source wins.](https://scrapecrate.com/blog/best-web-scraping-api.md)

[← All guides](https://scrapecrate.com/blog.md)
