Scraper APIMeta Ad Library
meta_ads.search
Ads in the Meta Ad Library for a keyword or an advertiser's Page: the advertiser, dates, text, link, button, media and platforms, and for political and issue ads who paid, spend and impressions.
- Id
meta_ads.search- Version
- 1
- Billed per
- record — 1 unit for each record of a charged run
- Runs
- within one request
Start it with POST /v1/scrapers/meta_ads.search/runs. How runs work is in Running a scraper; what a run costs is in Usage and units.
Inputs
The fields of input. A field that is not listed here is refused.
| Field | Type | Description |
|---|---|---|
query | string | Words to search the ads for. Give this or page_id.Limit: at least 1 characters, at most 200 characters. |
page_id | string | The id of an advertiser's Facebook Page: every ad of that Page is listed. It is page_id in this scraper's records and view_all_page_id in the address of the Page's view in the Ad Library. Give this or query.Limit: matches ^\d{5,20}$. |
exact_phrase | boolean | With query: only ads that contain the words as one phrase.Default: false. |
country | string | Where the ads run: a two-letter country code such as US or DE, or ALL for every country.Limit: matches ^(ALL|[A-Za-z]{2})$. Default: "ALL". |
status | "active" | "inactive" | "all" | Ads that are running now (active), that have stopped (inactive), or both (all).Default: "active". |
ad_type | "all" | "political_and_issue" | "housing" | "employment" | "financial" | The library's category: all ads, or only ads about social issues, elections or politics (political_and_issue: these carry spend and impressions), housing, employment, or financial products and services.Default: "all". |
media_type | "all" | "image" | "video" | "meme" | "none" | Only ads with this kind of media: images, videos, memes, or none for ads without any.Default: "all". |
platforms | array of "facebook" | "instagram" | "messenger" | "audience_network" | "threads" | "whatsapp" | Only ads that run on these platforms. Leave empty for every platform. |
ran_from | string | Only ads that ran on or after this day (YYYY-MM-DD).Limit: matches ^\d{4}-\d{2}-\d{2}$. |
ran_to | string | Only ads that ran on or before this day (YYYY-MM-DD).Limit: matches ^\d{4}-\d{2}-\d{2}$. |
max_results | integer | The most ads to return. They load about 30 first and then 10 at a time, so a larger number takes longer; fewer come back when the library has no more.Limit: 1 to 150. Default: 30. |
- Give
queryfor a keyword search, orpage_idfor every ad of one advertiser's Facebook Page.page_idis in every record, and it isview_all_page_idin the address of the Page's view in the Ad Library. - The filters are the library's own:
country(a two-letter code, orALL),status,ad_type,media_type,platforms, andran_from/ran_tofor the days an ad ran. - Ads about social issues, elections or politics (
ad_typepolitical_and_issue) carry who paid for them, the amount spent and the impressions, as the ranges the library shows and as numbers. Every other ad has those fieldsnull. - The addresses in
images,videosandcardsare signed by Meta and stop working after a while. Fetch the media soon after the run if you need it. - A search nothing matches ends
okwith zero records. When the library stops answering part-way through a long list, the run endspartialwith the ads read so far — see the reasons of this family.
Record fields
Every record of a run has these fields. A value that is not known is null — never an empty string and never 0.
| Field | Type | Notes |
|---|---|---|
position | integer or null | The ad's place in the results, from 1. Null for an ad asked for by its id. |
ad_id | string | The ad's Library ID. |
url | string | The ad's page in the Ad Library. |
page_id | string or null | The id of the Facebook Page that runs the ad. |
page_name | string or null | The name of the Page that runs the ad. |
page_url | string or null | The Page's address on Facebook. |
page_profile_picture | string or null | The Page's profile picture. |
page_categories | array of string | What the Page says it is, e.g. Clothing (Brand). |
page_likes | integer or null | How many people like the Page. |
active | boolean or null | Whether the ad is running now. |
started_on | string (date) or null | The day the ad started running. |
ended_on | string (date) or null | The last day the ad ran. Null while it is still running. |
format | string or null | The kind of creative, in Meta's own words in lower case: image, video, carousel, dco (several versions put together from the advertiser's texts and media), dpa (filled from a product catalogue), multi_images or text. |
platforms | array of string | Where the ad runs: facebook, instagram, messenger, audience_network, threads, whatsapp. |
content_removed | boolean | True when Meta removed the ad's content (it did not follow the advertising standards, or its disclaimer did not follow the policy for political ads). The library then shows no text or media, and none is returned.Default: false. |
text | string or null | The ad's main text. An ad filled from a product catalogue shows the catalogue's placeholders in place of a product's name. |
title | string or null | The headline beside the button. |
caption | string or null | The line above the headline, usually the site the ad links to, e.g. nike.com. |
link_url | string or null | Where the ad leads. |
link_description | string or null | The description under the headline. |
cta_text | string or null | The button's label, e.g. Shop now. |
cta_type | string or null | Meta's code for the button, e.g. SHOP_NOW, LEARN_MORE, INSTALL_MOBILE_APP. |
images | array of string | The ad's images. The addresses are signed and stop working after a while. |
videos | array of object | The ad's videos. |
url (in videos[]) | string | The video file, in the best quality the library offers. The address is signed and stops working after a while. |
preview_image (in videos[]) | string or null | The still image shown before the video plays. |
cards | array of object | The cards of a carousel, or the versions of an ad that has several, in order. |
title (in cards[]) | string or null | The card's headline. |
text (in cards[]) | string or null | The card's own text. |
caption (in cards[]) | string or null | The line under the headline, usually the site the card links to, e.g. nike.com. |
link_url (in cards[]) | string or null | Where the card leads. |
link_description (in cards[]) | string or null | The description under the headline, e.g. a price. |
cta_text (in cards[]) | string or null | The button's label, e.g. Shop now. |
image (in cards[]) | string or null | The card's image. |
video (in cards[]) | string or null | The card's video file, when it has one. |
video_preview_image (in cards[]) | string or null | The still image shown before the card's video plays. |
versions | integer or null | How many ads use this creative and text, where the library groups them. |
categories | array of string | The special categories the ad is filed under, in lower case, political, housing, employment, credit. Empty for an ordinary ad. |
paid_for_by | string or null | Who paid for the ad, as its disclaimer says. Ads about social issues, elections or politics carry one. |
currency | string or null | The currency of the amount spent, e.g. USD. Stated for ads about social issues, elections or politics. |
spend | string or null | The amount spent, as the range the library shows, e.g. $35K - $40K. Stated for ads about social issues, elections or politics. |
spend_min | integer or null | The lower end of the amount spent, in currency. Null when the library states only an upper end. |
spend_max | integer or null | The upper end of the amount spent. Null when the library states only a lower end, e.g. >$1M. |
impressions | string or null | How often the ad was shown, as the range the library shows, e.g. 500K - 600K or >1M. Stated for ads about social issues, elections or politics. |
impressions_min | integer or null | The lower end of the impressions. Null when the library states only an upper end. |
impressions_max | integer or null | The upper end of the impressions. Null when the library states only a lower end. |
estimated_audience | string or null | The estimated audience size, as the range the library shows, e.g. 500K - 1M. |
contains_ai_media | boolean or null | True when the advertiser disclosed that the ad contains digitally created or altered media. |
fetched_at | string (date-time) | When the library was read, in UTC. |
Example request
# Start a run and wait up to 60 seconds for it to finish
curl -X POST "https://api.enrichednow.com/v1/scrapers/meta_ads.search/runs?wait=60" \
-H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input":{"query":"trail running","country":"GB","media_type":"video","max_results":5}}'
# Read its records, with the id the first call answered
curl "https://api.enrichednow.com/v1/runs/$RUN_ID/records?limit=100" \
-H "Authorization: Bearer $ENRICHEDNOW_API_KEY"from enrichednow import EnrichedNow
client = EnrichedNow() # reads ENRICHEDNOW_API_KEY
# Start a run, wait for it to end, and get its records
result = client.scrape("meta_ads.search", {
"query": "trail running",
"country": "GB",
"media_type": "video",
"max_results": 5,
})
print(result.run.id, result.run.status, result.run.record_count)
# Read its records: pages are fetched as you go
for record in result.records:
print(record)Install it with pip install enrichednow, then save as run.py and run python3 run.py
import EnrichedNow from "enrichednow";
const client = new EnrichedNow(); // reads ENRICHEDNOW_API_KEY
// Start a run, wait for it to end, and get its records
const { run, records } = await client.scrape("meta_ads.search", {
query: "trail running",
country: "GB",
media_type: "video",
max_results: 5,
});
console.log(run.id, run.status, run.record_count);
// Read its records: pages are fetched as you go
for await (const record of records) console.log(record);Install it with npm install enrichednow, then save as run.mjs and run node run.mjs
package main
import (
"context"
"fmt"
"log"
"time"
enrichednow "github.com/enrichednow/enrichednow-go"
)
func main() {
client, err := enrichednow.NewClient() // reads ENRICHEDNOW_API_KEY
if err != nil {
log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
// Start a run, wait for it to end, and get its records
run, records, err := client.Scrape(ctx, "meta_ads.search", map[string]any{"query": "trail running", "country": "GB", "media_type": "video", "max_results": 5})
if err != nil {
log.Fatal(err)
}
fmt.Println(run.ID, run.Status, run.RecordCount)
// Read its records: pages are fetched as you go
for records.Next() {
fmt.Println(string(records.Current()))
}
if err := records.Err(); err != nil {
log.Fatal(err)
}
}Install it with go get github.com/enrichednow/enrichednow-go@latest, then save as run.go and run go run run.go
import com.enrichednow.EnrichedNowClient;
import com.enrichednow.ScrapeResult;
import java.util.Map;
public class Run {
public static void main(String[] args) {
EnrichedNowClient client = EnrichedNowClient.fromEnv(); // reads ENRICHEDNOW_API_KEY
// Start a run, wait for it to end, and get its records
ScrapeResult result = client.scrape("meta_ads.search", Map.of("query", "trail running", "country", "GB", "media_type", "video", "max_results", 5));
System.out.println(result.run().id() + " " + result.run().status() + " " + result.run().recordCount());
// Read its records: pages are fetched as you go
for (Map<String, Object> record : result.records()) {
System.out.println(record);
}
}
}Add com.enrichednow:enrichednow-java:0.4.0 to your Maven or Gradle build, then save as Run.java
enrichednow run meta_ads.search --input 'query=trail running' --input country=GB --input media_type=video --input max_results=5Install it with curl -fsSL https://raw.githubusercontent.com/enrichednow/enrichednow-cli/main/install.sh | sh
It starts a run with this scraper’s example input, waits for it to finish and reads its records a page at a time. The key is read from ENRICHEDNOW_API_KEY.
The body on its own:
{
"input": {
"query": "trail running",
"country": "GB",
"media_type": "video",
"max_results": 5
}
}Example response
The run, once it has ended. A run that has not ended within wait comes back with 202 and the status queued or running.
{
"id": "run_841742f37553189ff9c27ba1",
"scraper_id": "meta_ads.search",
"scraper_version": 1,
"status": "ok",
"reason": null,
"input": {
"query": "trail running",
"country": "GB",
"media_type": "video",
"max_results": 5
},
"record_count": 1,
"units": 1,
"units_per_request": null,
"units_per_record": 1,
"units_per_page": null,
"diagnostics": {
"requests": 1,
"bytes": 259214,
"wall_ms": 885,
"facts": {}
},
"created_at": "2026-11-16T22:37:50.170950Z",
"started_at": "2026-11-16T22:37:50.178331Z",
"finished_at": "2026-11-16T22:37:51.066313Z"
}Its records, from GET /v1/runs/{id}/records. The record is a real one: this scraper's own parser read it from a page recorded from the site.
{
"records": [
{
"position": 1,
"ad_id": "1131615619314178",
"url": "https://www.facebook.com/ads/library/?id=1131615619314178",
"page_id": "240202269366256",
"page_name": "i-Run",
"page_url": "https://facebook.com/i.run.running.trail",
"page_profile_picture": "https://scontent-hou1-1.xx.fbcdn.net/v/t39.35426-6/853760481_2294926784575469_8829169459759243307_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=109&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=lAMJdKmCkwYQ7kNvwGM48m-&_nc_oc=AdpEFi45zcPjfQGT9ZxnqUKtVEk16CV_J3oLCYqG9saXE05IN8zkcvN8dxE1Ws7L2Y0&_nc_zt=14&_nc_ht=scontent-hou1-1.xx&_nc_gid=sjS4RkEK5ujaT4zfS9dOGA&_nc_ss=79180&oh=00_AQS8uqVu2zLnC6xXtLTgk1MJPp0ZNtqZjIpcpwbpEvS61A&oe=6B03FA8E",
"page_categories": [
"Sporting Goods"
],
"page_likes": 175571,
"active": true,
"started_on": "2026-10-16",
"ended_on": null,
"format": "dco",
"platforms": [
"facebook",
"instagram"
],
"content_removed": false,
"text": "Soyez #Runstoppable avec i-Run ! N°1 de vente en ligne d'équipement Running.",
"title": "i-run.fr",
"caption": "i-run.fr",
"link_url": "http://i-run.fr/",
"link_description": "Official shop",
"cta_text": "Learn more",
"cta_type": "LEARN_MORE",
"images": [],
"videos": [],
"cards": [
{
"title": "i-run.fr",
"text": "Soyez #Runstoppable avec i-Run ! N°1 de vente en ligne d'équipement Running.",
"caption": "i-run.fr",
"link_url": "http://i-run.fr/",
"link_description": "Official shop",
"cta_text": "Learn More",
"image": null,
"video": "https://video-hou1-1.xx.fbcdn.net/o1/v/t2/f2/m366/AQNMb6KJld5O9Jn6vFIwoBBA148virPiQtp8YZkEWy5AnLrFYPsWlXVWCehZOIBRn_9GvCPP9xpqDpvnQRJhzRj5LHXID4mXlV8gNQBgFzbdYA.mp4?_nc_cat=108&_nc_sid=b66105&_nc_ht=video-hou1-1.xx.fbcdn.net&_nc_ohc=NERwZLV_40MQ7kNvwFjwr_U&efg=eyJ2ZW5jb2RlX3RhZyI6Inhwdl9wcm9ncmVzc2l2ZS5WSV9VU0VDQVNFX1BST0RVQ1RfVFlQRS4uQzMuNzIwLmRhc2hfaDI2NC1iYXNpYy1nZW4yXzcyMHAiLCJ4cHZfYXNzZXRfaWQiOjE0NzI4MTE2MDQ3MDk3NTAsImFzc2V0X2FnZV9kYXlzIjozNCwidmlfdXNlY2FzZV9pZCI6MTAxMzksImR1cmF0aW9uX3MiOjI1LCJ1cmxnZW5fc291cmNlIjoid3d3In0%3D&ccb=17-1&vs=84438e5739047437&_nc_vs=HBksFQIYRWZiX2VwaGVtZXJhbC9GMkRGMTlCQzc3NDg0MjE2QUExRkE5NTJFNDc3OEVGNV9tdF8xX3ZpZGVvX2Rhc2hpbml0Lm1wNBUAAsgBEgAVAhhAZmJfcGVybWFuZW50L0ExNkQ3QzA0NTYwODQyQjlBOTYxQ0VDOTE0MTI2MkM3X2F1ZGlvX2Rhc2hpbml0Lm1wNBUCAsgBEgAoABgAGwOIB3VzZV9vaWwBMRJwcm9ncmVzc2l2ZV9yZWNpcGUBMRJjb3B5X3NhbXBsZV9ncm91cHMBMRUAACbsxajI9eCdBRUCKAJDMywXQDkqfvnbItEYGWRhc2hfaDI2NC1iYXNpYy1nZW4yXzcyMHARAHUAZbaeAQA&_nc_gid=sjS4RkEK5ujaT4zfS9dOGA&_nc_ss=79180&_nc_map=urlgen_bucketless&_nc_zt=28&_nc_enc=Ui_khRxnEm5A7xsDf010iOyESliC7ClXsdb90NHVZPsEJRyrQeWEMqQledcKKPFRvW93MWD24M7tIw_IomLstQA2SNok6FepnuPBcBHUDPCNO_QOLwoYQ0tbbl8&oh=00_AQT012hZTjbNXYy8bsYYsBk_NmyQ-3AERqReimCoVG1kHQ&oe=6B03FB10",
"video_preview_image": "https://scontent-hou1-1.xx.fbcdn.net/v/t39.35426-6/853374087_1123626296916593_8296056637409549530_n.jpg?_nc_cat=109&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=UlnAMC03_a0Q7kNvwEEQdvL&_nc_oc=Adomg0Kk1G5oq1pqr_nZNOMCdgxtvh6XIJTZVNt_lawrHw0LT7N8qkguL3joJf2Q7E0&_nc_zt=14&_nc_ht=scontent-hou1-1.xx&_nc_gid=sjS4RkEK5ujaT4zfS9dOGA&_nc_ss=79180&oh=00_AQTPLKKz--vRv-yRm5oF5Y9uMRWsMpOe8UkhnszCTE3WdQ&oe=6B041A01"
},
{
"title": "i-run.fr",
"text": "Soyez #Runstoppable avec i-Run ! N°1 de vente en ligne d'équipement Running.",
"caption": "i-run.fr",
"link_url": "http://i-run.fr/",
"link_description": "Official shop",
"cta_text": "Learn More",
"image": null,
"video": "https://video-hou1-1.xx.fbcdn.net/o1/v/t2/f2/m366/AQNMb6KJld5O9Jn6vFIwoBBA148virPiQtp8YZkEWy5AnLrFYPsWlXVWCehZOIBRn_9GvCPP9xpqDpvnQRJhzRj5LHXID4mXlV8gNQBgFzbdYA.mp4?_nc_cat=108&_nc_sid=b66105&_nc_ht=video-hou1-1.xx.fbcdn.net&_nc_ohc=NERwZLV_40MQ7kNvwFjwr_U&efg=eyJ2ZW5jb2RlX3RhZyI6Inhwdl9wcm9ncmVzc2l2ZS5WSV9VU0VDQVNFX1BST0RVQ1RfVFlQRS4uQzMuNzIwLmRhc2hfaDI2NC1iYXNpYy1nZW4yXzcyMHAiLCJ4cHZfYXNzZXRfaWQiOjE0NzI4MTE2MDQ3MDk3NTAsImFzc2V0X2FnZV9kYXlzIjozNCwidmlfdXNlY2FzZV9pZCI6MTAxMzksImR1cmF0aW9uX3MiOjI1LCJ1cmxnZW5fc291cmNlIjoid3d3In0%3D&ccb=17-1&vs=84438e5739047437&_nc_vs=HBksFQIYRWZiX2VwaGVtZXJhbC9GMkRGMTlCQzc3NDg0MjE2QUExRkE5NTJFNDc3OEVGNV9tdF8xX3ZpZGVvX2Rhc2hpbml0Lm1wNBUAAsgBEgAVAhhAZmJfcGVybWFuZW50L0ExNkQ3QzA0NTYwODQyQjlBOTYxQ0VDOTE0MTI2MkM3X2F1ZGlvX2Rhc2hpbml0Lm1wNBUCAsgBEgAoABgAGwOIB3VzZV9vaWwBMRJwcm9ncmVzc2l2ZV9yZWNpcGUBMRJjb3B5X3NhbXBsZV9ncm91cHMBMRUAACbsxajI9eCdBRUCKAJDMywXQDkqfvnbItEYGWRhc2hfaDI2NC1iYXNpYy1nZW4yXzcyMHARAHUAZbaeAQA&_nc_gid=sjS4RkEK5ujaT4zfS9dOGA&_nc_ss=79180&_nc_map=urlgen_bucketless&_nc_zt=28&_nc_enc=UuzJwmpu7fKdSlc5XU7plx82ukSA8ggCUdxcAez6iOZ_gP-Pn6juHCrk63O5NJBpCck-ujng8O7S_nyItO_7yo3iqv7hsaglmGsz2ILAskwWzvRFxuGx9RoIwUE&oh=00_AQT012hZTjbNXYy8bsYYsBk_NmyQ-3AERqReimCoVG1kHQ&oe=6B03FB10",
"video_preview_image": "https://scontent-hou1-1.xx.fbcdn.net/v/t39.35426-6/853374087_1123626296916593_8296056637409549530_n.jpg?_nc_cat=109&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=UlnAMC03_a0Q7kNvwEEQdvL&_nc_oc=Adomg0Kk1G5oq1pqr_nZNOMCdgxtvh6XIJTZVNt_lawrHw0LT7N8qkguL3joJf2Q7E0&_nc_zt=14&_nc_ht=scontent-hou1-1.xx&_nc_gid=sjS4RkEK5ujaT4zfS9dOGA&_nc_ss=79180&oh=00_AQTPLKKz--vRv-yRm5oF5Y9uMRWsMpOe8UkhnszCTE3WdQ&oe=6B041A01"
}
],
"versions": 1,
"categories": [],
"paid_for_by": null,
"currency": null,
"spend": null,
"spend_min": null,
"spend_max": null,
"impressions": null,
"impressions_min": null,
"impressions_max": null,
"estimated_audience": null,
"contains_ai_media": false,
"fetched_at": "2026-11-19T18:07:40.993436Z"
}
],
"next_cursor": null
}What was done to the record for this page, and nothing else — the API returns every value whole. A text that was cut ends with … [truncated].
- Shortened:
cards: 5 items, the first 2 shown.
A run does not always end ok. Results and statuses lists every status and the reasons every scraper shares; the reasons of the Meta Ad Library scrapers are in their own section there.