Facebook Ad Library search API
Search the Meta Ad Library by keyword.
- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
- Status
- Betashape may still gain fields
region is the one country to search (ALL for every country). Also available as POST with a JSON body, for cursors too long for a URL.
You send query.
Request
Send your key in the x-api-key header.
curl -G "https://api.socialscrape.io/v1/facebook/ad-library/search" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode 'query=nike' \
--data-urlencode 'region=US'import os
import requests
params = {
"query": "nike",
"region": "US",
}
res = requests.get(
"https://api.socialscrape.io/v1/facebook/ad-library/search",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
timeout=60,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])const url = new URL("https://api.socialscrape.io/v1/facebook/ad-library/search");
url.search = new URLSearchParams({
query: "nike",
region: "US",
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}{
"nodes": [
{
"name": "SocialScrape Facebook Ad Library search",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/facebook/ad-library/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "query",
"value": "nike"
},
{
"name": "region",
"value": "US"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
query | string | yes | Keyword to search for. Also accepted as keyword, q. |
sort | string | Order of results: `impressions` is most impressions first, `newest` is most recent. Changing it restarts the cursor chain. Also accepted as sort_by, sortBy, order. | |
match | string | Match any of the words, or the exact phrase. Also accepted as search_type. | |
ad_type | string | All ads, or only political and issue ads. | |
language | string | Only ads in this language, a 2-letter code (EN, ES, FR). Also accepted as lang. | |
status | string | Ad status. Also accepted as active_status. | |
media_type | string | Creative type. `meme` is Meta's word for text on an image. | |
start_date | string | Impressions window start, YYYY-MM-DD. | |
end_date | string | Impressions window end, YYYY-MM-DD. | |
cursor | string | Opaque cursor from the previous page; pass it back unchanged. Also accepted as continuationToken, continuation_token, next_max_id, max_id, max_cursor, min_time, after, page_token, pageToken, paginationToken, next_page_id, page. | |
region | string | Two-letter country code (ISO 3166-1) for results that vary by country. Also accepted as country, geo. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are public data, not yours.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_1c930ec02ef98c78765ee5ca",
"data": {
"object": "list",
"items": [
{
"object": "ad",
"platform": "facebook",
"id": "973479965072202",
"url": "https://www.facebook.com/ads/library/?id=973479965072202",
"advertiser": {
"object": "advertiser",
"platform": "facebook",
"id": "89516513179",
"name": "Nordstrom Rack",
"url": "https://facebook.com/NordstromRack",
"page_id": "89516513179",
"country": null,
"verified": null,
"ad_count": null,
"extra": {
"categories": [
"Clothing (Brand)"
],
"image_url": "https://scontent-dfw6-2.xx.fbcdn.net/v/t39.35426-6/833185494_1464281759086790_9129409129755097293_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=109&ccb=1-7&_nc_sid=c5...",
"likes": 2525531
}
},
"status": "active",
"started_at": "2026-10-13T07:00:00Z",
"ended_at": null,
"title": "New Store Now Open",
"body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
"cta_text": "Learn more",
"landing_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
"format": "dynamic_creative",
"media": {
"thumbnail_url": "https://scontent-dfw6-1.xx.fbcdn.net/v/t39.35426-6/831400177_1961884945208401_164340649689964929_n.jpg?_nc_cat=103&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=d05_Ue5xjOs...",
"video_url": "https://video-dfw5-2.xx.fbcdn.net/o1/v/t2/f2/m366/AQNbPuRfRnMJxZwlsUoGoTiDFJi_85yWBtS1JPDprS5HhDaVy3PRzjKT3XyL-4h1SdprPPSY0tu_LoAx1oUdaKzjNP9AFWNMy0_WnXvLZoJ...",
"audio_url": null,
"image_urls": null,
"width": null,
"height": null
},
"regions": null,
"publisher_platforms": [
"facebook",
"instagram",
"messenger"
],
"impressions": null,
"spend": null,
"extra": {
"caption": "stores.nordstromrack.com",
"cards": [
{
"body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
"cta_text": "Learn More",
"link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
"title": "New Store Now Open",
"video_url": "https://video-dfw5-2.xx.fbcdn.net/o1/v/t2/f2/m366/AQNbPuRfRnMJxZwlsUoGoTiDFJi_85yWBtS1JPDprS5HhDaVy3PRzjKT3XyL-4h1SdprPPSY0tu_LoAx1oUdaKzjNP9AFWNMy0_WnXvLZoJ..."
},
{
"body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
"cta_text": "Learn More",
"link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
"title": "New Store Now Open",
"video_url": "https://video-dfw6-1.xx.fbcdn.net/o1/v/t2/f2/m366/AQOBUHlgC8XroLiSMqh3TFcq_I50ot-Iol5lysxpsK49HoXgJejHwHUhXom8UfALl4A8B8w8WFi8NnAl6SDu_vyqmvvKUsD25naT6VjJaFG..."
}
],
"categories": [
"UNKNOWN"
],
"collation_count": 1,
"collation_id": "1640782090763040",
"contains_digital_created_media": false
}
},
{
"object": "ad",
"platform": "facebook",
"id": "2632171547233842",
"url": "https://www.facebook.com/ads/library/?id=2632171547233842",
"advertiser": {
"object": "advertiser",
"platform": "facebook",
"id": "89516513179",
"name": "Nordstrom Rack",
"url": "https://facebook.com/NordstromRack",
"page_id": "89516513179",
"country": null,
"verified": null,
"ad_count": null,
"extra": {
"categories": [
"Clothing (Brand)"
],
"image_url": "https://scontent-dfw5-2.xx.fbcdn.net/v/t39.35426-6/829508304_2144737292789183_7307609477957867889_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=100&ccb=1-7&_nc_sid=c5...",
"likes": 2525531
}
},
"status": "active",
"started_at": "2026-10-13T07:00:00Z",
"ended_at": null,
"title": "New Store Now Open",
"body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
"cta_text": "Learn more",
"landing_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
"format": "dynamic_creative",
"media": {
"thumbnail_url": null,
"video_url": null,
"audio_url": null,
"image_urls": [
"https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/832476920_1088853536866855_6658459435692721343_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=1daYToDOn7...",
"https://scontent-dfw6-1.xx.fbcdn.net/v/t39.35426-6/829528978_2487390421754807_5464572652003104855_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=hcUVI0oNGt..."
],
"width": null,
"height": null
},
"regions": null,
"publisher_platforms": [
"facebook",
"instagram",
"messenger"
],
"impressions": null,
"spend": null,
"extra": {
"caption": "stores.nordstromrack.com",
"cards": [
{
"body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
"cta_text": "Learn More",
"image_url": "https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/832476920_1088853536866855_6658459435692721343_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=1daYToDOn7...",
"link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
"title": "New Store Now Open"
},
{
"body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
"cta_text": "Learn More",
"image_url": "https://scontent-dfw6-1.xx.fbcdn.net/v/t39.35426-6/829528978_2487390421754807_5464572652003104855_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=hcUVI0oNGt...",
"link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
"title": "New Store Now Open"
}
],
"categories": [
"UNKNOWN"
],
"collation_count": 1,
"collation_id": "1098100212980732",
"contains_digital_created_media": false
}
}
],
"cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",
"has_more": true,
"parent": null
},
"cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",
"has_more": true
}Fields
A page of results. Each entry in items is a Ad. cursor and has_more page through the rest.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "ad" | ||
platform | Platform | yes | the ad library's platform |
id | string | yes | |
url | string or null | ||
advertiser | Advertiser or null | ||
status | "active" or "inactive" or "unknown" | ||
started_at | string (ISO 8601 date-time) or null | ||
ended_at | string (ISO 8601 date-time) or null | ||
title | string or null | ||
body | string or null | ||
cta_text | string or null | ||
landing_url | string or null | ||
format | string or null | "image" | "video" | "carousel" | "text" | platform-specific | |
media | Media |
Show the other 5 fields
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), not_found (do not retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
How do I get more than one page?
Send the same request with cursor set to the cursor you received, until has_more is false. Each page costs its own price. See pagination.
Is there an SDK call for it?
The preview Python client has client.facebook.ad_library_search(...) and the TypeScript client client.facebook.adLibrarySearch(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.
Can an AI agent call it?
Yes. The MCP server reaches every built endpoint, with the same prices.