Facebook Ad Library advertiser search API
  1. Docs
  2. Facebook
  3. Facebook Ad Library advertiser search API

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_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
querystringyesSearch terms. Also accepted as keyword, q.

Every request also accepts:

  • cursor: the cursor from the previous page (Pagination).
  • 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).

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"

Example response#

This is a sample from a recorded response, lists and long text are shortened. Status 200.

200 OKSample response
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.

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/companies. See Switching from ScrapeCreators.