Facebook Ad Library advertiser search API
Advertisers matching a name: Ad Library page id, category, likes, verification and Instagram details.
GET /v1/facebook/ad-library/search/companies
GET /v1/facebook/ad-library/search/companies
Advertisers matching a name: Ad Library page id, category, likes, verification and Instagram details. Use the page id with company/ads. Meta closes its advertiser typeahead, so these are the pages behind the ads a search for the name returns (up to 10, name matches first), each completed from the ad-details query; ad_count is not available.
- 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 | Search terms. Also accepted as keyword, q. |
Every request also accepts:
cursor: the cursor from the previous page (Pagination).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/companies" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "query=nike"1import os2import requests34params = {5 "query": "nike",6}7res = requests.get(8 "https://api.socialscrape.dev/v1/facebook/ad-library/search/companies",9 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},10 params=params,11)12body = res.json()1314if body["ok"]:15 print(body["data"])16else:17 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/facebook/ad-library/search/companies");2url.search = new URLSearchParams({3 "query": "nike"4}).toString();5const res = await fetch(url, {6 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },7});8const body = await res.json();910if (body.ok) {11 console.log(body.data);12} else {13 console.error(body.error.code, body.error.message);14}1{2 "nodes": [3 {4 "name": "SocialScrape Facebook Ad Library advertiser 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/companies",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "query",19 "value": "nike"20 }21 ]22 },23 "sendHeaders": true,24 "headerParameters": {25 "parameters": [26 {27 "name": "x-api-key",28 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"29 }30 ]31 }32 }33 }34 ],35 "connections": {}36}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_d42b11390eaf7bfb7c1099f7",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "advertiser",13 "platform": "facebook",14 "id": "15087023444",15 "name": "Nike",16 "url": "https://facebook.com/nike",17 "page_id": "15087023444",18 "country": null,19 "verified": true,20 "ad_count": null,21 "extra": {22 "ads_in_results": 8,23 "alias": "nike",24 "categories": [25 "Sportswear",26 "Product/service"27 ],28 "category": "Sportswear Store",29 "cover_url": "https://scontent-lga3-3.xx.fbcdn.net/v/t39.30808-6/285211224_10159903868008445_5477337468887983165_n.png?_nc_cat=102&ccb=1-7&_nc_sid=957871&_nc_ohc=53UQOnRTJU8Q7kNvwHSiBK0&_nc_oc=AdqtBJ5-40RWRTZ6q9R5FZxKbpK1zbOZTAjOf1LOPS58Q2_k1GtBcmBotPsOW...",30 "entity_type": "PERSON_PROFILE",31 "image_url": "https://scontent-lga3-1.xx.fbcdn.net/v/t39.30808-1/284964043_10159903868513445_7696353984967674128_n.jpg?stp=dst-jpg_s148x148_tt6&_nc_cat=1&ccb=1-7&_nc_sid=418b77&_nc_ohc=QiTzxIgVfoIQ7kNvwEoU3ID&_nc_oc=AdpwWTj2YnQX0wh9oZTvaXVARkQoLCoJ0ao8ZV...",32 "instagram_followers": 290868439,33 "instagram_username": "nike",34 "instagram_verified": true,35 "likes": 39491775,36 "restricted": false,37 "verification": "BLUE_VERIFIED"38 }39 },40 {41 "object": "advertiser",42 "platform": "facebook",43 "id": "146705838515566",44 "name": "Sukeban World",45 "url": "https://facebook.com/61551864263186",46 "page_id": "146705838515566",47 "country": null,48 "verified": false,49 "ad_count": null,50 "extra": {51 "ads_in_results": 1,52 "categories": [53 "Sports league"54 ],55 "category": "Sports league",56 "cover_url": "https://scontent-lga3-2.xx.fbcdn.net/v/t39.30808-6/509313384_10106078306132770_1968421726604544597_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=957871&_nc_ohc=ladQaK-N8OgQ7kNvwEUu3jQ&_nc_oc=AdqpfELabGK4kf7CKXrz2_vShJUPDN5nwb5srweQWQCBIdZE6i1y1Ymkg3457...",57 "entity_type": "PERSON_PROFILE",58 "image_url": "https://scontent-lga3-2.xx.fbcdn.net/v/t39.30808-1/380760046_10105090366990730_3531502738674670798_n.jpg?stp=dst-jpg_s148x148_tt6&_nc_cat=101&ccb=1-7&_nc_sid=418b77&_nc_ohc=KVtrV1a8xZMQ7kNvwE2Y9_D&_nc_oc=Adp0XTnucfxpqIuFLYCJEfR9_yLeOEsbC1mn...",59 "instagram_followers": 46980,60 "instagram_username": "sukeban_world",61 "instagram_verified": true,62 "likes": 425,63 "restricted": false,64 "verification": "NOT_VERIFIED"65 }66 }67 ],68 "cursor": null,69 "has_more": false,70 "parent": null71 },72 "cursor": null,73 "has_more": false74}Response#
A list of Advertiser 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/companies. See Switching from ScrapeCreators.
Related endpoints#
- Facebook Ad Library search (
GET /v1/facebook/ad-library/search) - 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 profile or page (
GET /v1/facebook/profile) - Facebook profile posts (
GET /v1/facebook/profile/posts)