Facebook Ad Library search (POST body) API
The same as the GET form, with the parameters in a JSON body.
POST /v1/facebook/ad-library/search
POST /v1/facebook/ad-library/search
The same as the GET form, with the parameters in a JSON body.
- 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 | In |
|---|---|---|---|---|
query | string | yes | Keyword to search for. Also accepted as keyword, q. | body |
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. | body |
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. | body |
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. | body |
language | string | no | Only ads in this language, a 2-letter code (EN, ES, FR). Also accepted as lang. | body |
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. | body |
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. | body |
start_date | string | no | Impressions window start, YYYY-MM-DD. | body |
end_date | string | no | Impressions window end, YYYY-MM-DD. | body |
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 -X POST "https://api.socialscrape.dev/v1/facebook/ad-library/search" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 -H "content-type: application/json" \4 -d '{"query":"nike"}'1import os2import requests34payload = {5 "query": "nike",6}7res = requests.post(8 "https://api.socialscrape.dev/v1/facebook/ad-library/search",9 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},10 json=payload,11)12body = res.json()1314if body["ok"]:15 print(body["data"])16else:17 print(body["error"]["code"], body["error"]["message"])1const res = await fetch("https://api.socialscrape.dev/v1/facebook/ad-library/search", {2 method: "POST",3 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY!, "content-type": "application/json" },4 body: JSON.stringify({"query": "nike"}),5});6const body = await res.json();78if (body.ok) {9 console.log(body.data);10} else {11 console.error(body.error.code, body.error.message);12}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_8e4b94c9048c2313d2aecdbe",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "ad",13 "platform": "facebook",14 "id": "1550534860016399",15 "url": "https://www.facebook.com/ads/library/?id=1550534860016399",16 "advertiser": {17 "object": "advertiser",18 "platform": "facebook",19 "id": "115939511520844",20 "name": "Perfect themes",21 "url": "https://www.facebook.com/100093512920259/",22 "page_id": "115939511520844",23 "country": null,24 "verified": null,25 "ad_count": null,26 "extra": {27 "categories": [28 "Topic"29 ],30 "image_url": "https://scontent-dfw6-1.xx.fbcdn.net/v/t39.35426-6/701421303_1593266515068546_6584706353812290058_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=102&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=tv5rRAEs45MQ7kNvwGMz0Sw&_nc_oc=Ado7DqjLdVVkJoCgvbf9oZwyqtrHlC3CMQeiH6c...",31 "likes": 1859932 }33 },34 "status": "active",35 "started_at": "2026-05-19T07:00:00Z",36 "ended_at": null,37 "title": "๐๐ฆ๐ก๐๐ฃ ๐๐ ๐ฅ ๐จ๐๐๐๐๐ฅ๐ค ๐๐ก๐ก ๏ผ",38 "body": "๐ฅ๐ญThemepack is a FREE and personalized APP๐ various styles of Theme๐ ใWeather๐ใPhoto๐ใClockใCalendar to pick any widget to dress up your home screen๏ผ",39 "cta_text": "Install now",40 "landing_url": "http://play.google.com/store/apps/details?id=com.iconchanger.widget.theme.shortcut",41 "format": "image",42 "media": {43 "thumbnail_url": null,44 "video_url": null,45 "audio_url": null,46 "image_urls": [47 "https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/700927950_933331229664450_6487763311056032772_n.jpg?_nc_cat=111&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=iWNnbcABHX8Q7kNvwEsHUyv&_nc_oc=AdqYlI78KCc0tB1WeuueegWCBzYE9FoqEkSaEMUfj9zzSc-ivzPBV3bPOcO_pvZ..."48 ],49 "width": null,50 "height": null51 },52 "regions": null,53 "publisher_platforms": [54 "facebook",55 "instagram",56 "audience_network"57 ],58 "impressions": null,59 "spend": null,60 "extra": {61 "caption": "play.google.com",62 "categories": [63 "UNKNOWN"64 ],65 "contains_digital_created_media": false,66 "contains_sensitive_content": false,67 "gated_type": "ELIGIBLE",68 "hide_data_status": "NONE",69 "is_aaa_eligible": true,70 "media_expires_at": "2026-11-03T10:42:02Z",71 "regional_regulation_data": {72 "finserv": {73 "is_deemed_finserv": false,74 "is_limited_delivery": false75 },76 "tw_anti_scam": {77 "is_limited_delivery": false78 }79 }80 }81 },82 {83 "object": "ad",84 "platform": "facebook",85 "id": "962050096457659",86 "url": "https://www.facebook.com/ads/library/?id=962050096457659",87 "advertiser": {88 "object": "advertiser",89 "platform": "facebook",90 "id": "156405867784232",91 "name": "Depop",92 "url": "https://www.facebook.com/depop/",93 "page_id": "156405867784232",94 "country": null,95 "verified": null,96 "ad_count": null,97 "extra": {98 "categories": [99 "Shopping"100 ],101 "image_url": "https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/706217505_1282327247074242_6940108535499458481_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=105&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=yTgOgRT-iNUQ7kNvwEAATlO&_nc_oc=Adqb9MR2Z3MzaEZWhdVMM6AOp3fsMofSRAZvw3T...",102 "likes": 98651103 }104 },105 "status": "active",106 "started_at": "2026-05-22T07:00:00Z",107 "ended_at": null,108 "title": "{{product.name}}",109 "body": "Free Depop Shipping just dropped. Go find something you love.",110 "cta_text": "Download",111 "landing_url": "http://itunes.apple.com/app/id518684914",112 "format": "dynamic_product",113 "media": {114 "thumbnail_url": null,115 "video_url": null,116 "audio_url": null,117 "image_urls": [118 "https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/706277043_1509973367377594_8218495971134332071_n.jpg?_nc_cat=106&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=74i6nzprYHoQ7kNvwGCryVF&_nc_oc=AdpKlVLIjbRmhK_AM1D5xuJizXN5zVzX1L3uA_BFc-EihsU_QpoLmC-deXDaYc...",119 "https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/706198623_1758809891778866_1474232210027622534_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=DHXTScSIgbsQ7kNvwFvztFE&_nc_oc=Adpn5ENw1NxU_RHg1aVqTzMzeCOg1lEZjUwRV7R073-XLo2ZbnLGIXJfTAZNxo...",120 "https://scontent-dfw6-1.xx.fbcdn.net/v/t39.35426-6/706277483_2044031086227797_898989708800947064_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=vutTlfJHZoUQ7kNvwESGO8D&_nc_oc=AdoJGf4AO2p5f0Z0PZNcQHWQiU6NkFMS18_02RR6QMBj3mTwqW21xnYB2OiyrEQ..."121 ],122 "width": null,123 "height": null124 },125 "regions": null,126 "publisher_platforms": [127 "facebook",128 "instagram",129 "messenger"130 ],131 "impressions": null,132 "spend": null,133 "extra": {134 "caption": "itunes.apple.com",135 "cards": [136 {137 "body": "Free Depop Shipping just dropped. Go find something you love.",138 "cta_text": "Download",139 "image_url": "https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/706277043_1509973367377594_8218495971134332071_n.jpg?_nc_cat=106&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=74i6nzprYHoQ7kNvwGCryVF&_nc_oc=AdpKlVLIjbRmhK_AM1D5xuJizXN5zVzX1L3uA_BFc-EihsU_QpoLmC-deXDaYc...",140 "link_url": "https://www.depop.com/products/xaznbabyx-striped-wrap-blouse-purchased-to/",141 "title": "LOFT Women's Blouse"142 },143 {144 "body": "Free Depop Shipping just dropped. Go find something you love.",145 "cta_text": "Download",146 "image_url": "https://scontent-dfw5-1.xx.fbcdn.net/v/t39.35426-6/706198623_1758809891778866_1474232210027622534_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=DHXTScSIgbsQ7kNvwFvztFE&_nc_oc=Adpn5ENw1NxU_RHg1aVqTzMzeCOg1lEZjUwRV7R073-XLo2ZbnLGIXJfTAZNxo...",147 "link_url": "https://www.depop.com/products/nwcollectibles-brand-new-with-tags-officially-214/",148 "title": "Nike Women's Jacket"149 },150 {151 "body": "Free Depop Shipping just dropped. Go find something you love.",152 "cta_text": "Download",153 "image_url": "https://scontent-dfw6-1.xx.fbcdn.net/v/t39.35426-6/706277483_2044031086227797_898989708800947064_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=vutTlfJHZoUQ7kNvwESGO8D&_nc_oc=AdoJGf4AO2p5f0Z0PZNcQHWQiU6NkFMS18_02RR6QMBj3mTwqW21xnYB2OiyrEQ...",154 "link_url": "https://www.depop.com/products/xaznbabyx-v-neck-blouse-super-simple-but/",155 "title": "LOFT Women's Blouse"156 }157 ],158 "categories": [159 "UNKNOWN"160 ],161 "contains_digital_created_media": false,162 "contains_sensitive_content": false,163 "gated_type": "ELIGIBLE",164 "hide_data_status": "NONE",165 "is_aaa_eligible": false,166 "media_expires_at": "2026-11-03T12:31:10Z",167 "regional_regulation_data": {168 "finserv": {169 "is_deemed_finserv": false,170 "is_limited_delivery": false171 },172 "tw_anti_scam": {173 "is_limited_delivery": false174 }175 }176 }177 }178 ],179 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ",180 "has_more": true,181 "parent": null182 },183 "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ",184 "has_more": true185}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 (
GET /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)