Facebook Ad Library advertiser search
Beta 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 to logged-out visitors, 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
- Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
- 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).
curl -G "https://api.socialscrape.io/v1/facebook/ad-library/search/companies" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode "query=nike"import os
import requests
params = {
"query": "nike",
}
res = requests.get(
"https://api.socialscrape.io/v1/facebook/ad-library/search/companies",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
)
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/companies");
url.search = new URLSearchParams({
"query": "nike"
}).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 advertiser 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/companies",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "query",
"value": "nike"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_d42b11390eaf7bfb7c1099f7",
"data": {
"object": "list",
"items": [
{
"object": "advertiser",
"platform": "facebook",
"id": "15087023444",
"name": "Nike",
"url": "https://facebook.com/nike",
"page_id": "15087023444",
"country": null,
"verified": true,
"ad_count": null,
"extra": {
"ads_in_results": 8,
"alias": "nike",
"categories": [
"Sportswear",
"Product/service"
],
"category": "Sportswear Store",
"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...",
"entity_type": "PERSON_PROFILE",
"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...",
"instagram_followers": 290868439,
"instagram_username": "nike",
"instagram_verified": true,
"likes": 39491775,
"restricted": false,
"verification": "BLUE_VERIFIED"
}
},
{
"object": "advertiser",
"platform": "facebook",
"id": "146705838515566",
"name": "Sukeban World",
"url": "https://facebook.com/61551864263186",
"page_id": "146705838515566",
"country": null,
"verified": false,
"ad_count": null,
"extra": {
"ads_in_results": 1,
"categories": [
"Sports league"
],
"category": "Sports league",
"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...",
"entity_type": "PERSON_PROFILE",
"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...",
"instagram_followers": 46980,
"instagram_username": "sukeban_world",
"instagram_verified": true,
"likes": 425,
"restricted": false,
"verification": "NOT_VERIFIED"
}
}
],
"cursor": null,
"has_more": false,
"parent": null
},
"cursor": null,
"has_more": false
}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)