- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
Regulated ads add their transparency data in extra.
You send one of id or url.
Part of the Facebook Scraper API: 23 Facebook endpoints on one key.
Request
Send your key in the x-api-key header.
1curl -G "https://api.socialscrape.dev/v1/facebook/ad-library/ad" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode 'id=352695862528588'1import os2import requests34params = {5 "id": "352695862528588",6}7res = requests.get(8 "https://api.socialscrape.dev/v1/facebook/ad-library/ad",9 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},10 params=params,11 timeout=60,12)13body = res.json()1415if body["ok"]:16 print(body["data"])17else:18 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/facebook/ad-library/ad");2url.search = new URLSearchParams({3 id: "352695862528588",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 ad details",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/ad",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "id",19 "value": "352695862528588"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}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | one of | Ad id in the library. Also accepted as ad_id, adId. |
url | url | one of | Ad Library URL (facebook.com/ads/library/?id=...). |
get_transcript | boolean | Accepted 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`. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are examples, not your data.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_4b391ed27ba57aff4b7f1f13",8 "data": {9 "object": "ad",10 "platform": "facebook",11 "id": "352695862528588",12 "url": "https://www.facebook.com/ads/library/?id=352695862528588",13 "advertiser": {14 "object": "advertiser",15 "platform": "facebook",16 "id": "20531316728",17 "name": "Facebook",18 "url": "https://facebook.com/facebook",19 "page_id": "20531316728",20 "country": null,21 "verified": true,22 "ad_count": null,23 "extra": {24 "alias": "facebook",25 "categories": [26 "Website",27 "Company"28 ],29 "category": "Internet company",30 "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=EuEVSNa1R...",31 "entity_type": "PERSON_PROFILE",32 "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=4..."33 }34 },35 "status": "inactive",36 "started_at": "2020-08-27T07:00:00Z",37 "ended_at": "2020-08-30T07:00:00Z",38 "title": "Change Together: From the March on Washington to Today",39 "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. C...",40 "cta_text": null,41 "landing_url": null,42 "format": "video",43 "media": {44 "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=tpXEeRskuV...",45 "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...",46 "audio_url": null,47 "image_urls": null,48 "width": null,49 "height": null50 },51 "regions": null,52 "publisher_platforms": [53 "facebook"54 ],55 "impressions": {56 "lower": 1000000,57 "upper": null,58 "currency": null59 },60 "spend": {61 "lower": 1000000,62 "upper": null,63 "currency": "USD"64 },65 "extra": {66 "byline": "Facebook, Inc.",67 "categories": [68 "POLITICAL"69 ],70 "contains_digital_created_media": false,71 "contains_sensitive_content": false,72 "disclaimer_label": "PAID_FOR_BY",73 "gated_type": "TAKEN_DOWN"74 }75 },76 "cursor": null,77 "has_more": null78}Fields
One Ad in data.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "ad" | ||
platform | Platform | yes | the ad library's platform |
id | string | yes | |
url | string or null | ||
advertiser | Advertiser or null | ||
status | "active" or "inactive" or "unknown" | ||
started_at | string (ISO 8601 date-time) or null | ||
ended_at | string (ISO 8601 date-time) or null | ||
title | string or null | ||
body | string or null | ||
cta_text | string or null | ||
landing_url | string or null | ||
format | string or null | "image" | "video" | "carousel" | "text" | platform-specific | |
media | Media |
Show the other 5 fields
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), unsupported_url (do not retry), not_found (do not retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
Is there an SDK call for it?
The Python client has client.facebook.ad_library_ad(...) and the TypeScript client client.facebook.adLibraryAd(). Both return the same envelope as the HTTP API. Install them from PyPI (socialscrape-sdk) or npm (socialscrape); plain HTTP works in any language.
Can an AI agent call it?
Yes. The MCP server, which you run on your own machine, reaches every built endpoint, with the same prices.