Docs menu

Facebook Ad Library ad details

Beta GET /v1/facebook/ad-library/ad

GET /v1/facebook/ad-library/ad

One ad by id or URL: page, status, dates and the snapshot (text, images, videos, format, link, call to action). Regulated ads add their transparency data in extra.

  • 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
idstringone ofAd id in the library. Also accepted as ad_id, adId.
urlURLone ofAd Library URL (facebook.com/ads/library/?id=...). Accepted hosts: facebook.com.
get_transcriptbooleannoAccepted for compatibility. A video ad's transcript is its own call, ad/transcript (AI transcription, metered); this flag only adds a pointer to it in extra.transcript_hint. Default false.

Send at least one of id, url. If you send several, the first listed is used and the rest are ignored.

Every request also accepts:

  • 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/ad" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode "id=352695862528588"
Python
import os
import requests

params = {
    "id": "352695862528588",
}
res = requests.get(
    "https://api.socialscrape.io/v1/facebook/ad-library/ad",
    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/ad");
url.search = new URLSearchParams({
  "id": "352695862528588"
}).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 ad details",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/facebook/ad-library/ad",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "id",
              "value": "352695862528588"
            }
          ]
        },
        "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_4b391ed27ba57aff4b7f1f13",
  "data": {
    "object": "ad",
    "platform": "facebook",
    "id": "352695862528588",
    "url": "https://www.facebook.com/ads/library/?id=352695862528588",
    "advertiser": {
      "object": "advertiser",
      "platform": "facebook",
      "id": "20531316728",
      "name": "Facebook",
      "url": "https://facebook.com/facebook",
      "page_id": "20531316728",
      "country": null,
      "verified": true,
      "ad_count": null,
      "extra": {
        "alias": "facebook",
        "categories": [
          "Website",
          "Company"
        ],
        "category": "Internet company",
        "cover_url": "https://scontent-iad3-1.xx.fbcdn.net/v/t39.30808-6/756138980_1586883190150362_1776895842644499433_n.avif?_nc_cat=108&ccb=1-7&_nc_sid=957871&_nc_ohc=EuEVSNa1RDcQ7kNvwHnW1tw&_nc_oc=AdqSn7iMHpK98NorWHNmWMsaeUzo9rmK0eTofV9wjUckzcvcGFaCln32LWYFM...",
        "entity_type": "PERSON_PROFILE",
        "image_url": "https://scontent-iad3-1.xx.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=dst-jpg_s148x148_tt6&_nc_cat=1&ccb=1-7&_nc_sid=418b77&_nc_ohc=J-0bhyn71VEQ7kNvwGwrgcD&_nc_oc=Adp9fMi50sr3ccQrqeElkIGp8BZbrFv8hTEDP5...",
        "instagram_followers": 7777531,
        "instagram_username": "facebook",
        "instagram_verified": true,
        "likes": 154849444,
        "restricted": false,
        "verification": "BLUE_VERIFIED"
      }
    },
    "status": "inactive",
    "started_at": "2020-08-27T07:00:00Z",
    "ended_at": "2020-08-30T07:00:00Z",
    "title": "Change Together: From the March on Washington to Today",
    "body": "Queen Latifah hosts a series of candid conversations honoring the 57th anniversary of the #MarchOnWashington and this new era of the civil rights movement. Change Together features notable civil rights leaders such as Patrisse Cullors, Reve...",
    "cta_text": null,
    "landing_url": null,
    "format": "video",
    "media": {
      "thumbnail_url": "https://scontent-iad6-1.xx.fbcdn.net/v/t39.35426-6/123131854_3586232378268717_4745383357747290556_n.jpg?_nc_cat=109&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=tpXEeRskuVcQ7kNvwG_nIfD&_nc_oc=AdoK9Gjnn-LfVkcA-p5JCkomtqIfP8YyI9f9CQlVa3u5K07rih2FUPhm0sfcl4...",
      "video_url": "https://video-iad6-1.xx.fbcdn.net/o1/v/t2/f2/m412/AQOhKuKthAVVa0rFEi41ggsiGpIjueM36xj6WP_vqqtBOe-ys_sa5nUBYG9fKBArU14yCLHp-zR-F0aBPcYRtpg.mp4?_nc_cat=107&_nc_sid=ef5aa3&_nc_ht=video-iad6-1.xx.fbcdn.net&_nc_ohc=QaFwD5-UhtsQ7kNvwFsGH28&efg=ey...",
      "audio_url": null,
      "image_urls": null,
      "width": null,
      "height": null
    },
    "regions": null,
    "publisher_platforms": [
      "facebook"
    ],
    "impressions": {
      "lower": 1000000.0,
      "upper": null,
      "currency": null
    },
    "spend": {
      "lower": 1000000.0,
      "upper": null,
      "currency": "USD"
    },
    "extra": {
      "byline": "Facebook, Inc.",
      "categories": [
        "POLITICAL"
      ],
      "contains_digital_created_media": false,
      "contains_sensitive_content": false,
      "disclaimer_label": "PAID_FOR_BY",
      "gated_type": "TAKEN_DOWN",
      "hide_data_status": "NONE",
      "impressions_text": ">1M",
      "is_aaa_eligible": false,
      "media_expires_at": "2026-11-03T13:31:43Z",
      "page_spend": {
        "current_week": null,
        "is_political_page": true,
        "lifetime_by_disclaimer": [
          {
            "disclaimer": "",
            "spend": 921310
          },
          {
            "disclaimer": "Facebook, Inc.",
            "spend": 30356362
          }
        ],
        "weekly_by_disclaimer": []
      },
      "reach_estimate": ">1M",
      "regional_regulation_data": {
        "finserv": {
          "is_deemed_finserv": false,
          "is_limited_delivery": false
        },
        "tw_anti_scam": {
          "is_limited_delivery": false
        }
      }
    }
  },
  "cursor": null,
  "has_more": null
}

Response#

A Ad object in data.

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.
unsupported_url400noThe URL is not one this endpoint accepts (wrong platform or form).
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.

Example error:

{
  "ok": false,
  "error": {
    "code": "not_found",
    "message": "The platform says this profile, post or item does not exist.",
    "retryable": false
  },
  "credits_charged": 0,
  "request_id": "req_18965a343014cc47f59524ec"
}

Also served at#

These paths answer the same request, so code written for other APIs keeps working: /v1/facebook/adLibrary/ad. See Switching from ScrapeCreators.