The Facebook Ads Library API for Meta ad research
Search the Meta Ads Library for any keyword or page. Get each ad’s text, link and status as JSON.
Facebook Ads API at a glance
This API searches the public Meta Ads Library for ads. Send a POST request with a query or a page_id, then read each ad from the ads array. Run the example below to see the exact shape.
- Endpoint
POST /v1/data/facebook-ads/search- Authentication
- API key as
Authorization: Bearer wh_… - Stage
- Stable
- Output
- An ads array with ad_archive_id, page_name, body, title, cta_text, link_url, is_active, media counts, platforms and dates
- Search inputs
- A query, a page_id, a library url or a batch in urls
- Filters
- Country, active_status, media_type, start_date, end_date and publisher_platforms
- Results per request
- 1 to 50 with limit. The default is 10.
- Paging
- A cursor and a has_next_page flag in each response
- Data scope
- Public library records only, with no campaign management or private performance metrics
- Credit weight
- 1. See the pricing page for current rates.
One request, structured JSON.
This request lists active US ads for the Nike page. The response below shows two of the three ads returned. Copy the request to try it yourself.
curl -X POST "https://api.datablue.dev/v1/data/facebook-ads/search" \
-H "Authorization: Bearer wh_..." \
-H "Content-Type: application/json" \
-d '{
"page_id": "15087023444",
"country": "US",
"active_status": "active",
"limit": 3
}'{
"success": true,
"source": "facebook_ads_library",
"operation": "search",
"page_id": "15087023444",
"country": "US",
"total_results": 3,
"time_taken": 1.36,
"ads": [
{
"position": 2,
"ad_archive_id": "1013608031781929",
"is_active": true,
"page_id": "15087023444",
"page_name": "Nike",
"body": "For all the ways they show up. Gift Nike Studio Fleece and Nike Zoom Vomero 5.",
"title": "Gifts at Nike",
"caption": "nike.com",
"cta_text": "အခု ဝယ်ရန်",
"display_format": "DCO",
"link_url": "https://www.nike.com/w/shop-the-look-5-75ryi",
"image_count": 0,
"video_count": 0,
"publisher_platforms": ["INSTAGRAM"],
"start_date": "2026-11-11T08:00:00+00:00",
"end_date": "2026-11-21T08:00:00+00:00",
"ad_library_url": "https://www.facebook.com/ads/library/?id=1013608031781929"
},
{
"position": 3,
"ad_archive_id": "1809816760328522",
"is_active": true,
"page_id": "15087023444",
"page_name": "Nike",
"body": "Gift effortless style for their everyday with Nike Zoom Vomero 5 and Studio Fleece.",
"title": "Gifts at Nike",
"caption": "nike.com",
"cta_text": "အခု ဝယ်ရန်",
"display_format": "DCO",
"link_url": "https://www.nike.com/w/shop-the-look-5-75ryi",
"image_count": 0,
"video_count": 0,
"publisher_platforms": ["INSTAGRAM"],
"start_date": "2026-11-11T08:00:00+00:00",
"end_date": "2026-11-21T08:00:00+00:00",
"ad_library_url": "https://www.facebook.com/ads/library/?id=1809816760328522"
}
],
"cursor": "AQHT7S6Pj5bgyHanK0JXdum7m6t3o2_QfzhibuEiN3g1CmjiIJ1vI5RYEJKKKM_GOZmy",
"has_next_page": true
}What a Facebook ad returns.
Each ad arrives as one object with named fields.
Identity
Every ad has an ad_archive_id and a page_id, and the page_name field holds the page that ran it. Use the ad_archive_id as your key for each ad.
Creative text
The body field holds the ad text. The title field holds a headline, while caption showed a domain like nike.com in our rows. Our rows carried headlines such as Gifts at Nike.
Call to action and link
The cta_text field holds the button label. It came back as Burmese text in our US run. The link_url field holds the landing page address. Group ads by link_url to count ads per destination.
Status and dates
The is_active flag marks whether an ad is live. The start_date and end_date fields are ISO timestamps. One row in our run showed is_active true next to an end_date in 2025, so check both fields.
Format and media
The display_format field returned DPA or DCO in our run. The image_count and video_count fields held 0 on every row. We left scrape_ad_details off, so treat those counts as unconfirmed.
Platforms
The publisher_platforms array names the platforms for each ad. Our rows held FACEBOOK and INSTAGRAM values. Filter on it to split ads by platform.
Library link and paging
The ad_library_url field links each ad to its library page. The response also holds a cursor and a has_next_page flag. Check has_next_page before you ask for more.
Options that shape your search.
Send a query or a page_id to start a search. Add filters when you need tighter results.
Search query
Set query to any keyword you want to find. Our nike query also returned ads from Depop. Use page_id when you want ads from one brand.
Library URLs
Pass a direct Ads Library address in url. Pass a list of addresses in urls for a batch. Without them, send a query or a page_id instead.
Page ID
Set page_id to the Facebook page ID of one brand. Our page_id run for 15087023444 returned only Nike ads, so use it to follow one brand.
Country
Country takes a two-letter code and defaults to IN, so send US for American ads. Keep the same country across runs to compare results.
Status
The default is all, so set active_status to active or inactive to narrow the results.
Media and platform filters
The media_type filter defaults to all, so leave it out unless you need one type. Set publisher_platforms to a list such as facebook or instagram. We did not test these two filters live. Check each response before you depend on the filter.
Dates
Set start_date and end_date to limit the ad window. Use a date such as 2026-01-01 for each value. We did not test the date filters live, so check the response against your window.
Limit and paging
Set limit from 1 to 50 ads per request. The default is 10 when you send nothing, and count or limitPerSource works as an alias. Send the cursor from one response back in the cursor field for the next page.
Ad details
Set scrape_ad_details to true to request the full snapshot media and detail fields where the data is available. We did not test that option live, since our runs left it at the default of false.
Timeout
Set timeout_ms between 5000 and 90000 milliseconds when a search needs more time, with 30000 as the default. Check the timeout first when a search fails.
What teams build with it.
Library results show what a brand runs on Meta.
Competitor ad monitoring
Pass a rival’s page_id with active_status set to active. Compare the body and link_url of new ads each week.
Messaging research
Search a keyword to collect ad text for one topic. Count the phrases that brands repeat across ads.
Landing page mapping
Group ads by link_url to see each destination. Count the ads that point to each landing page.
Launch tracking
Read start_date to spot ads that began this month. Run the search daily to catch each new ad_archive_id.
Why call an API instead of scraping the Ads Library.
This API reads the public Meta Ads Library only, so it does not manage campaigns or return private performance metrics. Our sample rows hold no spend or reach fields.
Our rows carried the DPA and DCO labels in display_format. Their image_count and video_count fields read 0 on every row. Test media counts on a few of your own target pages before you rely on them in a report.
Meta ads and Google ads sit in separate APIs. This one covers the Meta Ads Library. Google Ads Advertisers and Google Ads Creatives cover the Google side of public ad data. Start with a page_id search, then widen to keywords.
Your first Facebook Ads search in a minute.
Sign up, grab a key and run one search.
Create an account
Sign up to get your API key.
Send a search
POST a query or a page_id to /v1/data/facebook-ads/search. Add your Bearer key as the Authorization header.
Read the ads
Loop over the ads array in the response. Use has_next_page to decide whether to fetch more.
Facebook Ads Library API questions.
Short answers about data and billing before you start.
It turns a Meta Ads Library search into structured JSON. Each ad is one object in the ads array.
Still have a question?Ask us anything
Send a POST request to /v1/data/facebook-ads/search with your Bearer token and a query or a page_id. Add a country such as US to target a market.
Each ad has a page, text and an is_active flag. Dates, a link and platforms come with each ad. Compare a row with the sample response above.
Set limit from 1 to 50 ads per request, and the default is 10 when you send nothing. Use cursor to read the next page.
Set page_id to follow one Facebook page. Send url or urls for direct library links. Send at least one of those fields or a query.
Set active_status to active or inactive to narrow the results. The default is all, and every row carries an is_active flag for you to read.
It returns image_count and video_count fields, though both read 0 on every one of our live rows. We did not test scrape_ad_details live, so check your own pages before you rely on media data.
This API reads the public Meta Ads Library only. It does not manage campaigns or expose private metrics.
The two Google Ads APIs read Google Ads Transparency data and return advertiser or creative records. This API reads the Meta Ads Library and returns ads with page and link fields.
This API is marked stable in our catalogue today. Build against the documented fields, then check the changelog before each upgrade you ship to production.
This API has a credit weight of 1. Check the pricing page for current rates.
Search the Meta Ads Library in a minute.
Create an account to get your key. Then run the example request with your own page_id.
Start free
