Docs menu

Facebook Ad Library search

Beta 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
  • 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_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
querystringyesKeyword to search for. Also accepted as keyword, q.
sortstringnoOrder 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.
matchstringnoMatch 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_typestringnoAll ads, or only political and issue ads. One of all, political. Default all. Also accepted values: political_and_issue_ads for political.
languagestringnoOnly ads in this language, a 2-letter code (EN, ES, FR). Also accepted as lang.
statusstringnoAd 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_typestringnoCreative 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_datestringnoImpressions window start, YYYY-MM-DD.
end_datestringnoImpressions 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: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • 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
curl -G "https://api.socialscrape.io/v1/facebook/ad-library/search" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode "query=nike" \
  --data-urlencode "region=US" \
  --data-urlencode "cursor=eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ"
Python
import os
import requests

params = {
    "query": "nike",
    "region": "US",
    "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ",
}
res = requests.get(
    "https://api.socialscrape.io/v1/facebook/ad-library/search",
    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"])
TypeScript
const url = new URL("https://api.socialscrape.io/v1/facebook/ad-library/search");
url.search = new URLSearchParams({
  "query": "nike",
  "region": "US",
  "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ"
}).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);
}
n8n
{
  "nodes": [
    {
      "name": "SocialScrape Facebook Ad Library 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",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "nike"
            },
            {
              "name": "region",
              "value": "US"
            },
            {
              "name": "cursor",
              "value": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVHR6TWN1R1ZGekcxSF85UzBpNjN5VTVMYjFzZHFDZmZaRjRYeHRHS205dXlVNG1BTUpkT2F3VEg1YUM4VWdvV2EifQ"
            }
          ]
        },
        "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_1c930ec02ef98c78765ee5ca",
  "data": {
    "object": "list",
    "items": [
      {
        "object": "ad",
        "platform": "facebook",
        "id": "973479965072202",
        "url": "https://www.facebook.com/ads/library/?id=973479965072202",
        "advertiser": {
          "object": "advertiser",
          "platform": "facebook",
          "id": "89516513179",
          "name": "Nordstrom Rack",
          "url": "https://facebook.com/NordstromRack",
          "page_id": "89516513179",
          "country": null,
          "verified": null,
          "ad_count": null,
          "extra": {
            "categories": [
              "Clothing (Brand)"
            ],
            "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...",
            "likes": 2525531
          }
        },
        "status": "active",
        "started_at": "2026-10-13T07:00:00Z",
        "ended_at": null,
        "title": "New Store Now Open",
        "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
        "cta_text": "Learn more",
        "landing_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
        "format": "dynamic_creative",
        "media": {
          "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...",
          "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...",
          "audio_url": null,
          "image_urls": null,
          "width": null,
          "height": null
        },
        "regions": null,
        "publisher_platforms": [
          "facebook",
          "instagram",
          "messenger"
        ],
        "impressions": null,
        "spend": null,
        "extra": {
          "caption": "stores.nordstromrack.com",
          "cards": [
            {
              "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
              "cta_text": "Learn More",
              "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
              "title": "New Store Now Open",
              "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..."
            },
            {
              "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
              "cta_text": "Learn More",
              "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
              "title": "New Store Now Open",
              "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..."
            }
          ],
          "categories": [
            "UNKNOWN"
          ],
          "collation_count": 1,
          "collation_id": "1640782090763040",
          "contains_digital_created_media": false,
          "contains_sensitive_content": false,
          "gated_type": "ELIGIBLE",
          "hide_data_status": "NONE",
          "is_aaa_eligible": false,
          "link_description": "Great Brands. Great Prices.",
          "media_expires_at": "2026-11-03T12:21:56Z",
          "regional_regulation_data": {
            "finserv": {
              "is_deemed_finserv": false,
              "is_limited_delivery": false
            },
            "tw_anti_scam": {
              "is_limited_delivery": false
            }
          },
          "video_urls": [
            "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...",
            "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..."
          ]
        }
      },
      {
        "object": "ad",
        "platform": "facebook",
        "id": "2632171547233842",
        "url": "https://www.facebook.com/ads/library/?id=2632171547233842",
        "advertiser": {
          "object": "advertiser",
          "platform": "facebook",
          "id": "89516513179",
          "name": "Nordstrom Rack",
          "url": "https://facebook.com/NordstromRack",
          "page_id": "89516513179",
          "country": null,
          "verified": null,
          "ad_count": null,
          "extra": {
            "categories": [
              "Clothing (Brand)"
            ],
            "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...",
            "likes": 2525531
          }
        },
        "status": "active",
        "started_at": "2026-10-13T07:00:00Z",
        "ended_at": null,
        "title": "New Store Now Open",
        "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
        "cta_text": "Learn more",
        "landing_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
        "format": "dynamic_creative",
        "media": {
          "thumbnail_url": null,
          "video_url": null,
          "audio_url": null,
          "image_urls": [
            "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...",
            "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..."
          ],
          "width": null,
          "height": null
        },
        "regions": null,
        "publisher_platforms": [
          "facebook",
          "instagram",
          "messenger"
        ],
        "impressions": null,
        "spend": null,
        "extra": {
          "caption": "stores.nordstromrack.com",
          "cards": [
            {
              "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
              "cta_text": "Learn More",
              "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...",
              "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
              "title": "New Store Now Open"
            },
            {
              "body": "Your new Nordstrom Rack at Ramsey is here! Save on Nike, UGG®, Levi's®, AG, FRAME, 7 For All Mankind and more.",
              "cta_text": "Learn More",
              "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...",
              "link_url": "https://stores.nordstromrack.com/us/nj/ramsey/225-interstate-shopping-center",
              "title": "New Store Now Open"
            }
          ],
          "categories": [
            "UNKNOWN"
          ],
          "collation_count": 1,
          "collation_id": "1098100212980732",
          "contains_digital_created_media": false,
          "contains_sensitive_content": false,
          "gated_type": "ELIGIBLE",
          "hide_data_status": "NONE",
          "is_aaa_eligible": false,
          "link_description": "Great Brands. Great Prices.",
          "media_expires_at": "2026-11-03T13:06:34Z",
          "regional_regulation_data": {
            "finserv": {
              "is_deemed_finserv": false,
              "is_limited_delivery": false
            },
            "tw_anti_scam": {
              "is_limited_delivery": false
            }
          }
        }
      }
    ],
    "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",
    "has_more": true,
    "parent": null
  },
  "cursor": "eyJrIjoiZmJhZHMiLCJjIjoiQVFIVEVjQ3NEVzRfU1E2RFJlc1pyY0ZiTXJWZi1QdEs5ZDRIRjV4R2k2RklQUnRoN3oxTW1VcTVUZl9fWFk0SnVKWnc0Sy1GVkVrbzNXTWgyemVpemViX0JRIn0",
  "has_more": true
}

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.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe 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.