# Facebook Ads Library Scraper (`easyapi/facebook-ads-library-scraper`) Actor

Extract detailed information about active Facebook ads including content, images, targeting data and more. Perfect for market research, competitor analysis and ad intelligence. Supports all countries and ad categories with anti-detection measures.

- **URL**: https://apify.com/easyapi/facebook-ads-library-scraper.md
- **Developed by:** [EasyApi](https://apify.com/easyapi) (community)
- **Categories:** Social media
- **Stats:** 1,682 total users, 84 monthly users, 100.0% runs succeeded, 34 bookmarks
- **User rating**: 2.18 out of 5 stars

## Pricing

from $2.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Facebook Ads Library Scraper 📊

Scrape detailed information about active ads from Facebook's Ad Library. Extract ad content, images, targeting data and more. Perfect for market research and competitor analysis! 🎯

### Features ✨

- Extract active ads from Facebook Ad Library search results
- Support for all countries and ad categories
- Get detailed ad information including:
  - Ad content and creative assets 
  - Publisher information
  - Running dates
  - Media files (images/videos)
  - Call-to-action details
  - Page information
  - Ad categories and types
- Configurable number of ads to scrape
- Clean JSON output format

### Usage 🚀

1. Enter a Facebook Ad Library search URL
2. Set maximum number of ads to scrape
3. Run and get structured data results!

### Input Parameters 📝

- `searchUrl`: Facebook Ad Library search URL (required)
- `maxItems`: Maximum number of ads to scrape

### Output 📋

Structured JSON containing detailed ad information including:
- Ad content and creative assets
- Publisher details 
- Running dates
- Media files
- CTA information
- Page data
- Categories and types

Perfect for digital marketers, researchers and businesses looking to analyze Facebook advertising landscape! 🎯


#### Input Example
  
A full explanation of an input example in JSON.  
````

{
"searchUrl": "https://www.facebook.com/ads/library/?active\_status=active\&ad\_type=all\&country=ALL\&media\_type=all\&q=color%20book\&search\_type=keyword\_unordered",
"maxItems": 20
}

```
  
#### Output sample
  
The results will be wrapped into a dataset which you can always find in the **Storage** tab. Here's an excerpt from the data you'd get if you apply the input parameters above:  
  
And here is the same data but in JSON. You can choose in which format to download your data: JSON, JSONL, Excel spreadsheet, HTML table, CSV, or XML.  
  
```

\[
{
"ad\_archive\_id": "3804712299743449",
"ad\_id": null,
"archive\_types": \[],
"categories": \[
"UNKNOWN"
],
"collation\_count": 1,
"collation\_id": "1478322286215387",
"contains\_digital\_created\_media": false,
"contains\_sensitive\_content": false,
"currency": "",
"end\_date": 1730271600,
"entity\_type": "PERSON\_PROFILE",
"fev\_info": null,
"finserv\_ad\_data": {
"is\_deemed\_finserv": false,
"is\_limited\_delivery": false
},
"gated\_type": "ELIGIBLE",
"has\_user\_reported": false,
"hidden\_safety\_data": false,
"hide\_data\_status": "NONE",
"impressions\_with\_index": {
"impressions\_text": null,
"impressions\_index": -1
},
"is\_aaa\_eligible": false,
"is\_active": true,
"is\_profile\_page": false,
"menu\_items": \[],
"page\_id": "571062419989773",
"page\_is\_deleted": false,
"page\_name": "Debonair Men's Salon",
"political\_countries": \[],
"publisher\_platform": \[
"FACEBOOK",
"INSTAGRAM"
],
"reach\_estimate": null,
"report\_count": null,
"snapshot": {
"body": {
"text": "Time is money, and we’re saving you both! ⏳\n\nSeize the day with Grand discount off on all services via our Early Bird Offer\nFor appointments call/whatsapp \n0307 0881490\nDHA location: Seher commercial\nShop no 2 & 3, building 20c, lane 5, sehar commercial phase 7 dha khi.\n#MensHair #MenHairstyles #MenHaircuts #HaircutsForMen #HairSalonForMen #pedicure #manicurepedicure #hairtransformation #hairstyle #hairtreatment #hairdresser #hairprotein #nonsurgicalhairreplacement #hairproducts #hairpatch #hairgoals #hairstylist #haircare #haircutsalon #MenHairSalon #StylishMen #GentlemanStyle #BarberLife #Barbershop #HairCareForMen #SharpLook #HairGoals #MenWithStyle #Groom #grooming"
},
"branded\_content": null,
"brazil\_tax\_id": null,
"byline": null,
"caption": null,
"cards": \[],
"cta\_text": "Send WhatsApp message",
"cta\_type": "WHATSAPP\_MESSAGE",
"country\_iso\_code": null,
"current\_page\_name": "Debonair Men's Salon",
"disclaimer\_label": null,
"display\_format": "MULTI\_IMAGES",
"event": null,
"images": \[
{
"original\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464806700\_514824171533348\_437147196145397960\_n.jpg?\_nc\_cat=103\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=kkzfNwpWUaQQ7kNvgF8P1-W&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYBkF5oHXiWu9JibNJ0oALc0JMc78phGZUDLmBH2w1kIDg\&oe=6728D5D9",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464917482\_569289055626973\_651291196043835463\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=101\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=B6-ZXsgpRdoQ7kNvgHqHy0R&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYBAE74ZFTCqiLY39Sy9VtNy0BzGSGkDTlw0htG0B2ea6Q\&oe=6728D50A",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/465059823\_2003885753357561\_5355299205850459249\_n.jpg?\_nc\_cat=101\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=0zXIdAixYyoQ7kNvgHd3yYu&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYC4APwz7aQKqL0R3xbVs8IRkREfM18zV4pzmSid2-n1rw\&oe=6728E9E4",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/465008114\_1553930715510692\_3315535505336645089\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=107\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=qm7lyZt4pVcQ7kNvgHxe6Kq&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYAaUO44prL8PM4nV3q7HLD0W6\_RBZrHk\_oppEiJr\_gmxQ\&oe=6728CD93",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/465008698\_1226172448716620\_1891063173292121086\_n.jpg?\_nc\_cat=111\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=5IkHwA37iAgQ7kNvgGPnK5G&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYD\_TekgpNyeY6PSSfYfsKhf2Y-EjBx7xOJgFAeEZh5U5g\&oe=6728C708",
"resized\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/464794219\_591044836689612\_721992582964696878\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=108\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=3CoKFbWioJAQ7kNvgH3ykc1&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYB-l\_AvZ87D6Z6SetaQsFLIYzLQLFhpYfkmjIcWhxi8Cg\&oe=6728F735",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/464905924\_1083582322835577\_3301493116233754299\_n.jpg?\_nc\_cat=111\&ccb=1-7&\_nc\_sid=c53f8f&*nc\_ohc=yEcC13w7TwUQ7kNvgFVxnl*&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYBU7tQdIsrCaJ0f1knmmGh\_3hJEjf\_jO7Zr5\_A\_clXcxA\&oe=6728D141",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/465170061\_918777330115513\_7589361058575265416\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=103\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=AnYb9Zu3QJ8Q7kNvgEoJZWN&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYB901r4HcDUMlKNkVKXbIQQCpCHn-XOmAI4gHfApNZEuQ\&oe=6728DEFE",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/465144117\_1236441984136480\_600451280592920916\_n.jpg?\_nc\_cat=103\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=sxD7Elykv7QQ7kNvgGodHc0&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYDAxWx-Y6Fy7XuVdCDbKt7QtgfGDF5rGuMwmld9wDA7Ng\&oe=6728CF99",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464863144\_8559359050814946\_3414829529384654926\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=102\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=\_CxAeMWJt4AQ7kNvgHz68t-&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYBk3\_RSBGQOq4bLZmg9qgnwrSZpqtum0g-Dtwu38gnYIA\&oe=6728CE3D",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/464825516\_574617054998366\_5169572547226126098\_n.jpg?\_nc\_cat=106\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=tHTtarNIbqoQ7kNvgH7xw7J&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYAoFzouPGOWAcBFlgALH8m8cMRrCHM1wshQQBCdKOOVPg\&oe=6728EEC6",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464769024\_3742700595991850\_1391836675619502740\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=105\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=na66dvGTeMYQ7kNvgH9nj0K&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYDx1O9kWgd80lrLLNmZC5\_a435Y-aHnnFZCdFqYJOsnnw\&oe=6728C7A6",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/464918523\_1054999466081761\_6673474027571679659\_n.jpg?\_nc\_cat=108\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=eucDO\_5p8S8Q7kNvgHLKOlS&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYCRdXmiMjM-UEQh20LD03hfvjlKKoS6YGlnhPsQiPXc8g\&oe=6728F9CB",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/465008818\_528742529926578\_3205406010784926986\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=109\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=escNRR120F8Q7kNvgEdIOV8&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYCx7v155fBqlMnCdtFhDUTJzYjY6EmPMRqoLt8sXeGPGg\&oe=6728C463",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464806120\_533003759501821\_5569284613834806112\_n.jpg?\_nc\_cat=105\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=zkd1riI2LaoQ7kNvgGjE1ri&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYBZoLIvKggK165JB2Ci3Er9RKl8Rb8h8XqgRXuUU1-5tA\&oe=6728EC24",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464872323\_1619700361954386\_5073584901534489003\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=103\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=OhSecq8NWNQQ7kNvgEoQYOJ&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYBWfDxw61jG1Rp1GURKOx5Www49t5y9YYan7sN4EIBU0Q\&oe=6728EE5F",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464969471\_573459795215574\_2712323577481054010\_n.jpg?\_nc\_cat=102\&ccb=1-7&\_nc\_sid=c53f8f&*nc\_ohc=H*-neiLBDggQ7kNvgGfX7Vo&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYDWjkEmfNJvtDmDQpmBXnHv5lP-MuB3gwezsMiwcuwTFg\&oe=6728ED02",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464845538\_449510084917406\_1662700153295737614\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=102\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=IVT5rc-gGEkQ7kNvgEduDpn&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYCgZZ3odwEqrmlIASw\_86GW1ZuIg57dOE-PfXMg8C7W9Q\&oe=6728E245",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/465154076\_896149279246640\_6597417767553030917\_n.jpg?\_nc\_cat=106\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=91bbm\_tNLAAQ7kNvgF32igz&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYDDb1jrIIPCQ2xGDi0nWFyegrsvon0\_BhXi\_ckybZwsUA\&oe=6728D1BB",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/465170863\_472708508507423\_443624499509367397\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=105\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=Z8Y1c4S\_wx8Q7kNvgE-BHMk&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYD7ze4vHt5nC2zn\_xiWpX5ZtOQFs9yntXB3x7MHo-nv9w\&oe=6728E556",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/464956691\_927283805931277\_1565871344537340848\_n.jpg?\_nc\_cat=106\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=ynuHEMM28UIQ7kNvgEIgsoZ&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYCcxiAqzOufStZy2p8It\_XvHdg\_NWQ-GKr7sAMGxxFNgA\&oe=6728C378",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/465032603\_1075774147341479\_7474475397695077492\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=107\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=M4aiXA-TPFIQ7kNvgHhFnxU&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYAQZoDGw65E1nbAx9Uh\_9WBOUDo6YvUgpzrdXCMKyKy\_A\&oe=6728CB3E",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/465239876\_861400536208150\_603694795788341519\_n.jpg?\_nc\_cat=111\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=DLSWyuEC8lcQ7kNvgF9iUyn&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYAR-81lAnTqLg95U\_WTRQD1P\_7MYu3nESpjMQHUA3gQwQ\&oe=6728D1B1",
"resized\_image\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/464829520\_952969853337149\_4205198902646595697\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=100\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=3Yx18rDdXvAQ7kNvgHlOGEe&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYAs8byHN7Gg8IaaVGE0Kl3HcCs44-NeoAQr8aT-2nAZmA\&oe=6728F6B4",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
},
{
"original\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464769932\_588367900282622\_3217137094917755752\_n.jpg?\_nc\_cat=101\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=sLj8MRxs2OQQ7kNvgFd-zWy&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYC\_ADecF7bWUJV55oMUzMlPUilv0om8RQmEEWaNQdD7fA\&oe=6728E249",
"resized\_image\_url": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.35426-6/464837680\_477490595327546\_7717743317530044102\_n.jpg?stp=dst-jpg\_s600x600&\_nc\_cat=105\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=br4kZjYWGR4Q7kNvgEuxqF2&\_nc\_zt=14&\_nc\_ht=scontent-ams4-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYDWZgNcBvhOM6\_UUmPElMgHK\_5OHSm2WY3MsNiZWVsqvQ\&oe=6728F721",
"watermarked\_resized\_image\_url": "",
"image\_crops": \[]
}
],
"is\_reshared": false,
"link\_description": null,
"link\_url": "https://api.whatsapp.com/send",
"page\_categories": \[
"Beauty Salon"
],
"page\_entity\_type": "PERSON\_PROFILE",
"page\_id": "571062419989773",
"page\_is\_deleted": false,
"page\_is\_profile\_page": false,
"page\_like\_count": 87467,
"page\_name": "Debonair Men's Salon",
"page\_profile\_picture\_url": "https://scontent-ams2-1.xx.fbcdn.net/v/t39.35426-6/464816251\_1631108674113420\_2479663649940565412\_n.jpg?stp=dst-jpg\_s60x60&\_nc\_cat=104\&ccb=1-7&\_nc\_sid=c53f8f&\_nc\_ohc=ktKTArH1pIAQ7kNvgEqsOoT&\_nc\_zt=14&\_nc\_ht=scontent-ams2-1.xx&\_nc\_gid=A9GxqoLSnszL9irL-2vwX\_N\&oh=00\_AYB\_04HbtuvhcUueG3GQ15HMGa\_vT8XC4X2huPWmK8-7\_w\&oe=6728F897",
"page\_profile\_uri": "https://www.facebook.com/debonairmensalon/",
"root\_reshared\_post": null,
"title": null,
"videos": \[],
"additional\_info": null,
"ec\_certificates": \[],
"extra\_images": \[],
"extra\_links": \[],
"extra\_texts": \[],
"extra\_videos": \[]
},
"spend": null,
"start\_date": 1730271600,
"state\_media\_run\_label": null,
"total\_active\_time": null
},
...
]

````

# Actor input Schema

## `searchUrl` (type: `string`):

URL of Facebook Ad Library search results page
## `maxItems` (type: `integer`):

Maximum number of ads to scrape

## Actor input object example

```json
{
  "searchUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&q=cup&search_type=keyword_unordered",
  "maxItems": 20
}
````

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&q=cup&search_type=keyword_unordered",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("easyapi/facebook-ads-library-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&q=cup&search_type=keyword_unordered",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("easyapi/facebook-ads-library-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchUrl": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&q=cup&search_type=keyword_unordered",
  "maxItems": 20
}' |
apify call easyapi/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=easyapi/facebook-ads-library-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Ads Library Scraper",
        "description": "Extract detailed information about active Facebook ads including content, images, targeting data and more. Perfect for market research, competitor analysis and ad intelligence. Supports all countries and ad categories with anti-detection measures.",
        "version": "0.0",
        "x-build-id": "AI9mgoUxQBnByWT7N"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/easyapi~facebook-ads-library-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-easyapi-facebook-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/easyapi~facebook-ads-library-scraper/runs": {
            "post": {
                "operationId": "runs-sync-easyapi-facebook-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/easyapi~facebook-ads-library-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-easyapi-facebook-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "searchUrl"
                ],
                "properties": {
                    "searchUrl": {
                        "title": "Facebook Ad Library Search URL",
                        "type": "string",
                        "description": "URL of Facebook Ad Library search results page",
                        "default": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&q=cup&search_type=keyword_unordered"
                    },
                    "maxItems": {
                        "title": "Maximum Items",
                        "minimum": 20,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of ads to scrape",
                        "default": 20
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
