Facebook Ad Library search API
Search the Meta Ad Library by keyword.
GET /v1/facebook/ad-library/search
GET /v1/facebook/ad-library/search
Search the Meta Ad Library by keyword. 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.
- Cost: 1 credit
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
query | string | yes | Keyword to search for. Also accepted as keyword, q. |
sort | string | no | Order of results: impressions is most impressions first (ScrapeCreators' default), newest is most recent. Changing it restarts the cursor chain. One of relevance, impressions, newest. Also accepted as sort_by, sortBy, order. Also accepted values: total_impressions for impressions, relevancy_monthly_grouped for newest. |
match | string | no | Match any of the words, or the exact phrase. One of any_words, exact_phrase. Default any_words. Also accepted as search_type. Also accepted values: keyword_unordered for any_words, keyword_exact_phrase for exact_phrase. |
ad_type | string | no | All ads, or only political and issue ads. One of all, political. Default all. Also accepted values: political_and_issue_ads for political. |
language | string | no | Only ads in this language, a 2-letter code (EN, ES, FR). Also accepted as lang. |
status | string | no | Ad status. One of active, inactive, all. Default active. Also accepted as active_status. Also accepted values: ACTIVE for active, INACTIVE for inactive, ALL for all. |
media_type | string | no | Creative type. meme is Meta's word for text on an image. One of all, image, video, meme, image_and_meme, none. Also accepted values: ALL for all, IMAGE for image, VIDEO for video, MEME for meme, IMAGE_AND_MEME for image_and_meme, NONE for none. |
start_date | string | no | Impressions window start, YYYY-MM-DD. |
end_date | string | no | Impressions window end, YYYY-MM-DD. |
Every request also accepts:
cursor: the cursor from the previous page (Pagination).region: two-letter country code for results that vary by country. Changing it restarts the cursor chain.trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).
Example request#
Set your key in the environment first (see Authentication).
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" \5 --data-urlencode "cursor=eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ"1import os2import requests34params = {5 "query": "nike",6 "region": "US",7 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ",8}9res = requests.get(10 "https://api.socialscrape.dev/v1/facebook/ad-library/search",11 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},12 params=params,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 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ"6}).toString();7const res = await fetch(url, {8 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },9});10const body = await res.json();1112if (body.ok) {13 console.log(body.data);14} else {15 console.error(body.error.code, body.error.message);16}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 "name": "cursor",27 "value": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ"28 }29 ]30 },31 "sendHeaders": true,32 "headerParameters": {33 "parameters": [34 {35 "name": "x-api-key",36 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"37 }38 ]39 }40 }41 }42 ],43 "connections": {}44}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
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=c53f8f&_nc_ohc=PU1O_QOeAYwQ7kNvwEWC_bk&_nc_oc=Adqr-3NcZSoLz_wD5M2r3NIbYmXvnyXUJI8iiPL...",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_Ue5xjOsQ7kNvwHHS1tw&_nc_oc=AdrMIpVjCUgGK_1qve82tCXM3CGBJGL8Qzsb4AJLXOiOZDEBQqi088ZGiVx6rh1...",44 "video_url": "https://video-dfw5-2.xx.fbcdn.net/o1/v/t2/f2/m366/AQNbPuRfRnMJxZwlsUoGoTiDFJi_85yWBtS1JPDprS5HhDaVy3PRzjKT3XyL-4h1SdprPPSY0tu_LoAx1oUdaKzjNP9AFWNMy0_WnXvLZoJFxw.mp4?_nc_cat=100&_nc_sid=b66105&_nc_ht=video-dfw5-2.xx.fbcdn.net&_nc_ohc=1BNY8fL...",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_WnXvLZoJFxw.mp4?_nc_cat=100&_nc_sid=b66105&_nc_ht=video-dfw5-2.xx.fbcdn.net&_nc_ohc=1BNY8fL..."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_vyqmvvKUsD25naT6VjJaFGd5g.mp4?_nc_cat=101&_nc_sid=b66105&_nc_ht=video-dfw6-1.xx.fbcdn.net&_nc_ohc=XgxV3nX..."74 }75 ],76 "categories": [77 "UNKNOWN"78 ],79 "collation_count": 1,80 "collation_id": "1640782090763040",81 "contains_digital_created_media": false,82 "contains_sensitive_content": false,83 "gated_type": "ELIGIBLE",84 "hide_data_status": "NONE",85 "is_aaa_eligible": false,86 "link_description": "Great Brands. Great Prices.",87 "media_expires_at": "2026-11-03T12:21:56Z",88 "regional_regulation_data": {89 "finserv": {90 "is_deemed_finserv": false,91 "is_limited_delivery": false92 },93 "tw_anti_scam": {94 "is_limited_delivery": false95 }96 },97 "video_urls": [98 "https://video-dfw5-2.xx.fbcdn.net/o1/v/t2/f2/m366/AQNbPuRfRnMJxZwlsUoGoTiDFJi_85yWBtS1JPDprS5HhDaVy3PRzjKT3XyL-4h1SdprPPSY0tu_LoAx1oUdaKzjNP9AFWNMy0_WnXvLZoJFxw.mp4?_nc_cat=100&_nc_sid=b66105&_nc_ht=video-dfw5-2.xx.fbcdn.net&_nc_ohc=1BNY8fL...",99 "https://video-dfw6-1.xx.fbcdn.net/o1/v/t2/f2/m366/AQOBUHlgC8XroLiSMqh3TFcq_I50ot-Iol5lysxpsK49HoXgJejHwHUhXom8UfALl4A8B8w8WFi8NnAl6SDu_vyqmvvKUsD25naT6VjJaFGd5g.mp4?_nc_cat=101&_nc_sid=b66105&_nc_ht=video-dfw6-1.xx.fbcdn.net&_nc_ohc=XgxV3nX..."100 ]101 }102 },103 {104 "object": "ad",105 "platform": "facebook",106 "id": "2632171547233842",107 "url": "https://www.facebook.com/ads/library/?id=2632171547233842",108 "advertiser": {109 "object": "advertiser",110 "platform": "facebook",111 "id": "89516513179",112 "name": "Nordstrom Rack",113 "url": "https://facebook.com/NordstromRack",114 "page_id": "89516513179",115 "country": null,116 "verified": null,117 "ad_count": null,118 "extra": {119 "categories": [120 "Clothing (Brand)"121 ],122 "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=c53f8f&_nc_ohc=tL5jbqqgmd0Q7kNvwFjEh9Z&_nc_oc=Adp4Pjp3T5YZsFvDUsf_VVqcwfHFwFht5792MAR...",123 "likes": 2525531124 }125 },126 "status": "active",127 "started_at": "2026-10-13T07:00:00Z",128 "ended_at": null,129 "title": "New Store Now Open",130 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",131 "cta_text": "Learn more",132 "landing_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",133 "format": "dynamic_creative",134 "media": {135 "thumbnail_url": null,136 "video_url": null,137 "audio_url": null,138 "image_urls": [139 "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=1daYToDOn7MQ7kNvwGhNlvX&_nc_oc=AdpFo-oa97yqb5vMEW0GkWJRicdVgWJNKO_HOVAAzrY8VQ1x36u3xeMmbsacCP...",140 "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=hcUVI0oNGtsQ7kNvwHGrf0c&_nc_oc=Ado01XP3a0MDCOfxPwjw4Je5ZuKKcoRgj0DysP79eMe0YKDmHDd5XD8xvTon8I..."141 ],142 "width": null,143 "height": null144 },145 "regions": null,146 "publisher_platforms": [147 "facebook",148 "instagram",149 "messenger"150 ],151 "impressions": null,152 "spend": null,153 "extra": {154 "caption": "stores.nordstromrack.com",155 "cards": [156 {157 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",158 "cta_text": "Learn More",159 "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=1daYToDOn7MQ7kNvwGhNlvX&_nc_oc=AdpFo-oa97yqb5vMEW0GkWJRicdVgWJNKO_HOVAAzrY8VQ1x36u3xeMmbsacCP...",160 "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",161 "title": "New Store Now Open"162 },163 {164 "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",165 "cta_text": "Learn More",166 "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=hcUVI0oNGtsQ7kNvwHGrf0c&_nc_oc=Ado01XP3a0MDCOfxPwjw4Je5ZuKKcoRgj0DysP79eMe0YKDmHDd5XD8xvTon8I...",167 "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",168 "title": "New Store Now Open"169 }170 ],171 "categories": [172 "UNKNOWN"173 ],174 "collation_count": 1,175 "collation_id": "1098100212980732",176 "contains_digital_created_media": false,177 "contains_sensitive_content": false,178 "gated_type": "ELIGIBLE",179 "hide_data_status": "NONE",180 "is_aaa_eligible": false,181 "link_description": "Great Brands. Great Prices.",182 "media_expires_at": "2026-11-03T13:06:34Z",183 "regional_regulation_data": {184 "finserv": {185 "is_deemed_finserv": false,186 "is_limited_delivery": false187 },188 "tw_anti_scam": {189 "is_limited_delivery": false190 }191 }192 }193 }194 ],195 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",196 "has_more": true,197 "parent": null198 },199 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",200 "has_more": true201}Response#
A list of Ad objects in data.items, with data.cursor and data.has_more.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
not_found | 404 | no | The platform says this profile, post or item does not exist. |
Every request can also fail with the account and platform errors listed on the Errors page.
Also served at#
These paths answer the same request, so code written for other APIs keeps working: /v1/facebook/adLibrary/search/ads. See Switching from ScrapeCreators.
Related endpoints#
- Facebook Ad Library search (POST body) (
POST /v1/facebook/ad-library/search) - Facebook Ad Library ads by page (
GET /v1/facebook/ad-library/company/ads) - Facebook Ad Library ads by page (POST body) (
POST /v1/facebook/ad-library/company/ads) - Facebook Ad Library ad details (
GET /v1/facebook/ad-library/ad) - Facebook Ad Library ad transcript (
GET /v1/facebook/ad-library/ad/transcript) - Facebook Ad Library advertiser search (
GET /v1/facebook/ad-library/search/companies) - Facebook profile or page (
GET /v1/facebook/profile) - Facebook profile posts (
GET /v1/facebook/profile/posts)