- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
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.
Part of the Facebook Scraper API: 23 Facebook endpoints on one key.
Request
Send your key in the x-api-key header.
1curl -G "https://api.socialscrape.dev/v1/facebook/ad-library/search" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode 'query=nike' \4 --data-urlencode 'region=US'1import os2import requests34params = {5 "query": "nike",6 "region": "US",7}8res = requests.get(9 "https://api.socialscrape.dev/v1/facebook/ad-library/search",10 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},11 params=params,12 timeout=60,13)14body = res.json()1516if body["ok"]:17 print(body["data"])18else:19 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/facebook/ad-library/search");2url.search = new URLSearchParams({3 query: "nike",4 region: "US",5}).toString();6const res = await fetch(url, {7 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },8});9const body = await res.json();1011if (body.ok) {12 console.log(body.data);13} else {14 console.error(body.error.code, body.error.message);15}1{2 "nodes": [3 {4 "name": "SocialScrape Facebook Ad Library search",5 "type": "n8n-nodes-base.httpRequest",6 "typeVersion": 4.2,7 "position": [8 0,9 010 ],11 "parameters": {12 "method": "GET",13 "url": "https://api.socialscrape.dev/v1/facebook/ad-library/search",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "query",19 "value": "nike"20 },21 {22 "name": "region",23 "value": "US"24 }25 ]26 },27 "sendHeaders": true,28 "headerParameters": {29 "parameters": [30 {31 "name": "x-api-key",32 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"33 }34 ]35 }36 }37 }38 ],39 "connections": {}40}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 examples, not your data.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_1c930ec02ef98c78765ee5ca",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "ad",13 "platform": "facebook",14 "id": "973479965072202",15 "url": "https://www.facebook.com/ads/library/?id=973479965072202",16 "advertiser": {17 "object": "advertiser",18 "platform": "facebook",19 "id": "89516513179",20 "name": "Nordstrom Rack",21 "url": "https://facebook.com/NordstromRack",22 "page_id": "89516513179",23 "country": null,24 "verified": null,25 "ad_count": null,26 "extra": {27 "categories": [28 "Clothing (Brand)"29 ],30 "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...",31 "likes": 252553132 }33 },34 "status": "active",35 "started_at": "2026-10-13T07:00:00Z",36 "ended_at": null,37 "title": "New Store Now Open",38 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",39 "cta_text": "Learn more",40 "landing_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",41 "format": "dynamic_creative",42 "media": {43 "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...",44 "video_url": "https://video-dfw5-2.xx.fbcdn.net/o1/v/t2/f2/m366/AQNbPuRfRnMJxZwlsUoGoTiDFJi_85yWBtS1JPDprS5HhDaVy3PRzjKT3XyL-4h1SdprPPSY0tu_LoAx1oUdaKzjNP9AFWNMy0_WnXvLZoJ...",45 "audio_url": null,46 "image_urls": null,47 "width": null,48 "height": null49 },50 "regions": null,51 "publisher_platforms": [52 "facebook",53 "instagram",54 "messenger"55 ],56 "impressions": null,57 "spend": null,58 "extra": {59 "caption": "stores.nordstromrack.com",60 "cards": [61 {62 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",63 "cta_text": "Learn More",64 "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",65 "title": "New Store Now Open",66 "video_url": "https://video-dfw5-2.xx.fbcdn.net/o1/v/t2/f2/m366/AQNbPuRfRnMJxZwlsUoGoTiDFJi_85yWBtS1JPDprS5HhDaVy3PRzjKT3XyL-4h1SdprPPSY0tu_LoAx1oUdaKzjNP9AFWNMy0_WnXvLZoJ..."67 },68 {69 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",70 "cta_text": "Learn More",71 "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",72 "title": "New Store Now Open",73 "video_url": "https://video-dfw6-1.xx.fbcdn.net/o1/v/t2/f2/m366/AQOBUHlgC8XroLiSMqh3TFcq_I50ot-Iol5lysxpsK49HoXgJejHwHUhXom8UfALl4A8B8w8WFi8NnAl6SDu_vyqmvvKUsD25naT6VjJaFG..."74 }75 ],76 "categories": [77 "UNKNOWN"78 ],79 "collation_count": 1,80 "collation_id": "1640782090763040",81 "contains_digital_created_media": false82 }83 },84 {85 "object": "ad",86 "platform": "facebook",87 "id": "2632171547233842",88 "url": "https://www.facebook.com/ads/library/?id=2632171547233842",89 "advertiser": {90 "object": "advertiser",91 "platform": "facebook",92 "id": "89516513179",93 "name": "Nordstrom Rack",94 "url": "https://facebook.com/NordstromRack",95 "page_id": "89516513179",96 "country": null,97 "verified": null,98 "ad_count": null,99 "extra": {100 "categories": [101 "Clothing (Brand)"102 ],103 "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...",104 "likes": 2525531105 }106 },107 "status": "active",108 "started_at": "2026-10-13T07:00:00Z",109 "ended_at": null,110 "title": "New Store Now Open",111 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",112 "cta_text": "Learn more",113 "landing_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",114 "format": "dynamic_creative",115 "media": {116 "thumbnail_url": null,117 "video_url": null,118 "audio_url": null,119 "image_urls": [120 "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...",121 "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..."122 ],123 "width": null,124 "height": null125 },126 "regions": null,127 "publisher_platforms": [128 "facebook",129 "instagram",130 "messenger"131 ],132 "impressions": null,133 "spend": null,134 "extra": {135 "caption": "stores.nordstromrack.com",136 "cards": [137 {138 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",139 "cta_text": "Learn More",140 "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...",141 "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",142 "title": "New Store Now Open"143 },144 {145 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",146 "cta_text": "Learn More",147 "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...",148 "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",149 "title": "New Store Now Open"150 }151 ],152 "categories": [153 "UNKNOWN"154 ],155 "collation_count": 1,156 "collation_id": "1098100212980732",157 "contains_digital_created_media": false158 }159 }160 ],161 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",162 "has_more": true,163 "parent": null164 },165 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",166 "has_more": true167}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 Python client has client.facebook.ad_library_search(...) and the TypeScript client client.facebook.adLibrarySearch(). Both return the same envelope as the HTTP API. Install them from PyPI (socialscrape-sdk) or npm (socialscrape); plain HTTP works in any language.
Can an AI agent call it?
Yes. The MCP server, which you run on your own machine, reaches every built endpoint, with the same prices.