Facebook Ad Library ad details API
One ad by id or URL: page, status, dates and the snapshot (text, images, videos, format, link, call to action).
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
- 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 |
|---|---|---|---|
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=...). Accepted hosts: facebook.com. |
get_transcript | boolean | no | 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. 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: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).
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)12body = res.json()1314if body["ok"]:15 print(body["data"])16else:17 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}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
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=EuEVSNa1RDcQ7kNvwHnW1tw&_nc_oc=AdqSn7iMHpK98NorWHNmWMsaeUzo9rmK0eTofV9wjUckzcvcGFaCln32LWYFM...",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=418b77&_nc_ohc=J-0bhyn71VEQ7kNvwGwrgcD&_nc_oc=Adp9fMi50sr3ccQrqeElkIGp8BZbrFv8hTEDP5...",33 "instagram_followers": 7777531,34 "instagram_username": "facebook",35 "instagram_verified": true,36 "likes": 154849444,37 "restricted": false,38 "verification": "BLUE_VERIFIED"39 }40 },41 "status": "inactive",42 "started_at": "2020-08-27T07:00:00Z",43 "ended_at": "2020-08-30T07:00:00Z",44 "title": "Change Together: From the March on Washington to Today",45 "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...",46 "cta_text": null,47 "landing_url": null,48 "format": "video",49 "media": {50 "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...",51 "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...",52 "audio_url": null,53 "image_urls": null,54 "width": null,55 "height": null56 },57 "regions": null,58 "publisher_platforms": [59 "facebook"60 ],61 "impressions": {62 "lower": 1000000.0,63 "upper": null,64 "currency": null65 },66 "spend": {67 "lower": 1000000.0,68 "upper": null,69 "currency": "USD"70 },71 "extra": {72 "byline": "Facebook, Inc.",73 "categories": [74 "POLITICAL"75 ],76 "contains_digital_created_media": false,77 "contains_sensitive_content": false,78 "disclaimer_label": "PAID_FOR_BY",79 "gated_type": "TAKEN_DOWN",80 "hide_data_status": "NONE",81 "impressions_text": ">1M",82 "is_aaa_eligible": false,83 "media_expires_at": "2026-11-03T13:31:43Z",84 "page_spend": {85 "current_week": null,86 "is_political_page": true,87 "lifetime_by_disclaimer": [88 {89 "disclaimer": "",90 "spend": 92131091 },92 {93 "disclaimer": "Facebook, Inc.",94 "spend": 3035636295 }96 ],97 "weekly_by_disclaimer": []98 },99 "reach_estimate": ">1M",100 "regional_regulation_data": {101 "finserv": {102 "is_deemed_finserv": false,103 "is_limited_delivery": false104 },105 "tw_anti_scam": {106 "is_limited_delivery": false107 }108 }109 }110 },111 "cursor": null,112 "has_more": null113}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.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
unsupported_url | 400 | no | The URL is not one this endpoint accepts (wrong platform or form). |
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.
Example error:
1{2 "ok": false,3 "error": {4 "code": "not_found",5 "message": "The platform says this profile, post or item does not exist.",6 "retryable": false7 },8 "credits_charged": 0,9 "request_id": "req_18965a343014cc47f59524ec"10}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.
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 transcript (
GET /v1/facebook/ad-library/ad/transcript) - Facebook Ad Library advertiser search (
GET /v1/facebook/ad-library/search/companies) - Facebook profile or page (
GET /v1/facebook/profile) - Facebook profile posts (
GET /v1/facebook/profile/posts)