Skip to content
Blog6 min read

Meta Ad Library API: get your competitors' commercial Facebook and Instagram ads as JSON

Guide
What Meta's Ad Library API returns (social issue, election and political ads, and ads delivered to the UK and EU) beside a querying.ai meta_ad_library search for a US advertiser's running ads, with libraryId, activeDays, format and landingDomain, at 0.5 credits per 30 ads

Meta's Ad Library API returns ads about social issues, elections and politics, and ads delivered to the UK and EU. Read every running Facebook and Instagram ad of a competitor in any country as JSON, with run days, format and landing page, with request examples, response fields and the cost per 10,000 ads.

What Meta's Ad Library API returns

Meta's Ad Library API searches the Ad Library for ads about social issues, elections or politics delivered anywhere in the world during the past 7 years, and for ads delivered to the UK and the EU. Source: Ad Library API.

The ad_reached_countries parameter of the ads_archive endpoint says it plainly: ads that reached no location in the EU return only when they are about social issues, elections or politics. Spend, impressions and demographic distribution are filled for political and issue ads, and payer and beneficiary for ads delivered to the EU. Source: Graph API ads_archive reference.

Access starts with the same check Meta uses for political advertisers: confirm your identity and location at facebook.com/ID, which takes a few days, then create a Meta developer app and generate an access token. Source: Ad Library API.

Competitor research asks a different question: which ads is this brand running in my market right now, since when, in which format and to which page. For a US, Korean or Japanese market, those ads live on the Ad Library website. The rest of this guide reads them as JSON.

Meta's Ad Library API and querying.ai meta_ad_library, November 2026
Meta Ad Library APIquerying.ai meta_ad_library
Commercial ads in the US, Korea, JapanPolitical and issue ads onlyEvery running ad, every country
Ads delivered to the UK and EUYes, with EU reach and payerYes, with EU reach and payer on ad
Political and issue adsPast 7 years, with spend rangesPast 7 years, with spend ranges
AccessIdentity check at facebook.com/ID and a developer appAn API key from querying.ai
Run days, landing domain, summaryStart and stop timesactiveDays, landingDomain, summary

Get a competitor's running ads as JSON

Two requests cover one competitor. advertisers turns a name into the advertiser's Facebook page ID, and search with that pageId lists its running ads in the country you pick, 30 by default and up to 500. Both answer with the result in the same call. Reference: Meta Ad Library.

curl -X POST https://api.querying.ai/v1/ads/meta-ad-library/advertisers \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "soundcore", "country": "US" }'
curl -X POST https://api.querying.ai/v1/ads/meta-ad-library/search \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "pageId": "266556540473351", "country": "US", "limit": 500 }'

The response lists the ads with the library's own count of matching ads and a summary of the ads returned:

{
  "platform": "meta_ad_library",
  "country": "US",
  "activeStatus": "active",
  "totalCount": 971,
  "returnedCount": 30,
  "nextCursor": "eyJ2IjoxLCJo...",
  "ads": [
    {
      "libraryId": "2033461067351971",
      "pageName": "soundcore",
      "isActive": true,
      "startDate": "2026-11-14",
      "activeDays": 9,
      "platforms": ["FACEBOOK", "INSTAGRAM"],
      "format": "DCO",
      "title": "AeroClip 2 Open-Ear",
      "linkUrl": "https://www.soundcore.com/aeroclip-2-...",
      "landingDomain": "soundcore.com",
      "ctaType": "SHOP_NOW"
    }
  ],
  "summary": { "formats": { "DCO": 20, "VIDEO": 10 }, "medianActiveDays": 6, "...": "..." }
}
meta_ad_library search response fields, November 2026
FieldWhat it holds
totalCount, returnedCountThe library's count of matching ads, and the ads in this response
nextCursorSend it as cursor with the same search to read the next ads
ads[].libraryId, libraryUrlThe ad's Library ID and its page in the Ad Library
ads[].startDate, endDate, activeDaysThe first and last day the library saw the ad, and the days between, both counted
ads[].format, platforms, versionsIMAGE, VIDEO, CAROUSEL, DCO and others, where it ran, and how many ads share the creative
ads[].body, title, ctaTypeThe ad text, the headline and the call to action
ads[].linkUrl, landingDomain, utmWhere the ad lands, its host, and the utm_ parameters with the campaign name
summaryAds per advertiser, formats, platforms, landing domains, launches by week, the 5 longest running ads and the median activeDays

Compare competitors and open one ad

pageIds takes up to 10 page IDs with a query, and searches the keyword across those advertisers' ads in one request. The summary counts the ads of each advertiser, so one response shows who runs the most ads on the keyword.

curl -X POST https://api.querying.ai/v1/ads/meta-ad-library/search \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "earbuds", "pageIds": ["266556540473351", "<competitor pageId>"], "country": "US" }'
  • Sort the ads by activeDays to find the creatives a competitor keeps paying for. summary.longestRunning lists the top 5 of every response.
  • Group the ads by landingDomain and utm.campaign to see which pages and campaigns get the most ads.
  • Read summary.launchesByWeek from a daily search to see when a competitor starts a new push.
  • Open one ad with ad and its libraryId to read its variants, who paid for it and, for ads shown in the EU, the UK or Brazil, its reach by country, age and gender.

Cost per 10,000 ads

Cost of 10,000 Meta ads, list prices on November 25, 2026
PlanPrice and creditsPer 10,000 adsAds a month
querying.ai Basic$20 / 8,000 credits$0.42470,500
querying.ai Pro$200 / 170,000 credits$0.2010,000,000
querying.ai Scale$500 / 480,000 credits$0.1828,235,000
querying.ai Max$1,000 / 1,000,000 credits$0.1758,823,500

A search is charged 0.5 credits for every 30 ads it returns, at least 0.5 credits, so a search of 500 ads costs 8.5 credits and 10,000 ads cost 170 credits. Prices are each plan's monthly price divided by its credits. advertisers, ad and advertiser cost 0.5 credits each, and only completed requests are charged. A new account starts with 500 free credits, enough for 30,000 ads before you pick a plan.

Limits to plan for

  • Running ads come back for every advertiser and every country. Stopped commercial ads stay in the library for about one year when they were delivered in the EU or the UK, so keep a market's history by searching active ads every day and storing them.
  • Media URLs are Meta CDN links that expire after a few days. Save the images and videos you need when you first read the ad.
  • A nextCursor works with the search that returned it, and grows to about 14 KB after 1,000 ads. Store it as text without a length limit.
  • Catalog ads (DPA, DCO) keep the library's placeholders, such as {{product.name}}, in their text.
  • The other ad libraries (Google, LinkedIn, TikTok) use the same core fields. Compare them in Ad libraries compared.

Frequently asked questions

Does Meta's Ad Library API return commercial ads?

It returns commercial ads delivered to the UK and the EU, and ads about social issues, elections or politics from every country. Commercial ads that ran only outside the EU stay on the Ad Library website.

What do I need to use Meta's Ad Library API?

Meta asks you to confirm your identity and location at facebook.com/ID, which takes a few days, then to create a developer app and generate an access token.

How do I get a competitor's Facebook and Instagram ads as JSON?

Find the competitor's page ID with POST /v1/ads/meta-ad-library/advertisers, then send it as pageId with a country to POST /v1/ads/meta-ad-library/search. Each ad comes back with its run days, format, text and landing page.

How much does a Meta ad search cost on querying.ai?

0.5 credits for every 30 ads a search returns, which is $0.42 per 10,000 ads on Basic and $0.17 on Max.

How many ads can one request return?

Up to 500 with limit: 500. Send the response's nextCursor as cursor with the same search to read the next 500.

Which countries can I search?

Any two letter country code in country, or ALL for every country. Running ads come back for every country.

  • Ad Library API for Competitor Ads

    Search the Meta, Google, LinkedIn and TikTok ad libraries by keyword or by advertiser and get your competitors' ads as JSON through one async API. Ads from Facebook, Instagram, Google Search, YouTube, Display, Maps, LinkedIn and TikTok arrive with their creative, format, advertiser and landing page, and with the run dates and impressions the library publishes.

Start free

500 free credits when you sign up. Collect your first answers in minutes.

Start free

More from the blog