# Facebook Ads Scraper (`icoe-man/facebook-ads-scraper`) Actor

A facebook ads library scraper: search public ads by keyword and country, collect the ads of one advertiser, look up a single ad, and get ad transcripts. Export JSON, CSV or Excel.

- **URL**: https://apify.com/icoe-man/facebook-ads-scraper.md
- **Developed by:** [Icoe Man](https://apify.com/icoe-man) (community)
- **Categories:** Social media, Marketing
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Facebook Ads Scraper

Give this Actor keywords, advertiser page ids or ad ids and pick what to look up in the public Facebook ad library: ads, advertisers, a single ad or the spoken text of a video ad. Results arrive as a clean table you can download or pass on to other tools.

### What it does

Pick a **Mode**, fill in the fields listed for it and start the run. Each run collects one kind of result; fields that belong to other modes are ignored. Pick **Live** under **Freshness** to always collect fresh data.

### Modes

#### Ad search

Searches the public ad library by keyword, optionally limited to one country. Mode `adlibrary-search`: fill in **Keywords** (up to 100 entries), and **Country** (optional). For each entry, the Actor collects up to **Max results per target** ads (100 by default, at most 1000). Each ad becomes one item in the dataset, charged as **Adlibrary search**.

Each ad looks like this:

```json
{
  "status": "ok",
  "type": "ad",
  "platform": "facebook",
  "id": "1702938977100376",
  "url": "https://www.facebook.com/ads/library/?id=1702938977100376",
  "advertiser": {
    "id": "15087023444",
    "name": "Nike"
  },
  "text": "Bring sports more fully into your day with the Nike App.",
  "ctaText": "Install now",
  "landingUrl": null,
  "startedAt": "2025-04-07T07:00:00Z",
  "endedAt": "2026-11-10T08:00:00Z",
  "isActive": true,
  "media": [
    {
      "kind": "image",
      "url": "https://scontent.fsac1-1.fna.fbcdn.net/v/t39.35426-6/431718739_3499889103593675_2072398184202305018_n.jpg?_nc_cat=111&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=EVFY-oYhOWwQ7kNvwET4Q6e&_nc_oc=Adr3q3e58YadVlVucg8tfLBq66BiQZ5iB88w2TaI8d9jIG0fnTgA-pIhFtuY-YTebrA&_nc_zt=14&_nc_ht=scontent.fsac1-1.fna&_nc_gid=fJz9kfUvyCZg9eiDww8odw&_nc_ss=78180&oh=00_AQTkVaE9_sGZEQM0ihniSFveH2drMBYjYN9X9AzoXZzz0A&oe=6AF9E382",
      "thumbnailUrl": null
    },
    {
      "kind": "image",
      "url": "https://scontent.fsac1-2.fna.fbcdn.net/v/t39.35426-6/431748186_289316047369916_1595311644416959995_n.jpg?_nc_cat=104&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=7jBzNbtJzZQQ7kNvwGzF4dS&_nc_oc=AdrcEMB_StN7O05FjsRVzmBgGPHQYcsouaVhPGi4UlwA2g2Liip0jlSQum4ZKXtzlWQ&_nc_zt=14&_nc_ht=scontent.fsac1-2.fna&_nc_gid=fJz9kfUvyCZg9eiDww8odw&_nc_ss=78180&oh=00_AQQ3LDc-Yywv6jNMiDRJUEbFkdbRQWQFlmkKobrWvtkKYQ&oe=6AF9BD1F",
      "thumbnailUrl": null
    },
    {
      "kind": "image",
      "url": "https://scontent.fsac1-2.fna.fbcdn.net/v/t39.35426-6/431631323_928727432024463_5606595664509361185_n.jpg?_nc_cat=103&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=nX44MCFkcBoQ7kNvwESoLe1&_nc_oc=AdqLSz9UlJratafsnPChSDPSuvL3EEu2mn4OtuAgkzZAm87pKYTPPJkMUQF0Xw8hctk&_nc_zt=14&_nc_ht=scontent.fsac1-2.fna&_nc_gid=fJz9kfUvyCZg9eiDww8odw&_nc_ss=78180&oh=00_AQQZqEtNvf8mCg3jR-OlM3uYwjzNsr0mUf9wqiuH8KyMyw&oe=6AF9D0E7",
      "thumbnailUrl": null
    },
    {
      "kind": "image",
      "url": "https://scontent.fsac1-2.fna.fbcdn.net/v/t39.35426-6/431644642_737508601479774_8272309847273720820_n.jpg?_nc_cat=102&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=8CEYXYDY3RkQ7kNvwGWGjdi&_nc_oc=AdqGFSbqZY9cZlISFTYLMlzYtEz9Uhb_r3Sp7VRmiNDnHeONTHAoO7NkuJQCuK0vpWc&_nc_zt=14&_nc_ht=scontent.fsac1-2.fna&_nc_gid=fJz9kfUvyCZg9eiDww8odw&_nc_ss=78180&oh=00_AQRXlILstYOlrVuK6bgFgoBJOpQqqZ_hvATHrtUWrINjlg&oe=6AF9B543",
      "thumbnailUrl": null
    },
    {
      "kind": "image",
      "url": "https://scontent.fsac1-1.fna.fbcdn.net/v/t39.35426-6/431679131_949214166636263_7090981238489979310_n.jpg?_nc_cat=100&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=TdB4dgR1J-QQ7kNvwE8IQ9r&_nc_oc=AdpVDG2upiOmPBUQN2j4lZu4FGcPL_cW5BhsmkSfo_g_wGep_8PuO5akettk5GLB-2g&_nc_zt=14&_nc_ht=scontent.fsac1-1.fna&_nc_gid=fJz9kfUvyCZg9eiDww8odw&_nc_ss=78180&oh=00_AQSiLrEKUfc_0LuiDQyq7IML9vhaIuFTnTUYeS4yX5ew2w&oe=6AF9CA91",
      "thumbnailUrl": null
    },
    {
      "kind": "image",
      "url": "https://scontent.fsac1-1.fna.fbcdn.net/v/t39.35426-6/431734766_930233981755195_3984431312184472988_n.jpg?_nc_cat=104&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=64M1wnEooIQQ7kNvwFI-O2o&_nc_oc=AdpTWM2PVo5ouMOukn0C8xH3Fm4M78xameM3SkGZv03Cw3dRqNR2mJprgv_IhLXEY84&_nc_zt=14&_nc_ht=scontent.fsac1-1.fna&_nc_gid=fJz9kfUvyCZg9eiDww8odw&_nc_ss=78180&oh=00_AQTWDH93JsgtFnZnrUHONjS-lp5uacWXW8-UyvEvkq_WEg&oe=6AF9D0AB",
      "thumbnailUrl": null
    }
  ],
  "details": null,
  "collectedAt": "2026-11-11T05:02:31Z",
  "input": {
    "keyword": "nike",
    "maxItems": 30
  }
}
```

#### Company ads

Collects the public ads of each advertiser page. Mode `adlibrary-company`: fill in **Advertiser page ids** (up to 100 entries). For each entry, the Actor collects up to **Max results per target** ads (100 by default, at most 1000). Each ad becomes one item in the dataset, charged as **Adlibrary company**.

Each ad looks like this:

```json
{
  "status": "ok",
  "type": "ad",
  "platform": "facebook",
  "id": "1702938977100376",
  "url": "https://www.facebook.com/ads/library/?id=1702938977100376",
  "advertiser": {
    "id": "15087023444",
    "name": "Nike"
  },
  "text": "Bring sports more fully into your day with the Nike App.",
  "ctaText": "Install now",
  "landingUrl": null,
  "startedAt": "2025-04-07T07:00:00Z",
  "endedAt": "2026-11-10T08:00:00Z",
  "isActive": true,
  "media": [
    {
      "kind": "image",
      "url": "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/431734766_930233981755195_3984431312184472988_n.jpg?_nc_cat=104&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=64M1wnEooIQQ7kNvwFLLFeH&_nc_oc=Ado0ay5hE0FhXiwvRUL5KLPcOz6iHGxMVFm2W__NFQIiF3xh6nckwbgY2N3IakjyW9c&_nc_zt=14&_nc_ht=scontent-lga3-3.xx&_nc_gid=jgOVq0C54-nCSgL-cWzQlg&_nc_ss=78180&oh=00_AQSN0gJxguoGsGiVpO123KT2MqXUYRIVLrULUjGLEXCgVg&oe=6AF9D0AB"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-2.xx.fbcdn.net/v/t39.35426-6/431679131_949214166636263_7090981238489979310_n.jpg?_nc_cat=100&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=TdB4dgR1J-QQ7kNvwE3V22P&_nc_oc=Adoyj950njbYoLkliByhI4Pib--NHpT0Qr4KR4UvHShqfdViOmzMx2GUpd5A9vIfuI4&_nc_zt=14&_nc_ht=scontent-lga3-2.xx&_nc_gid=jgOVq0C54-nCSgL-cWzQlg&_nc_ss=78180&oh=00_AQQDr7MiXuoP_LBGG6HL8jCq3exgE9Des82xqQAk27Q96A&oe=6AF9CA91"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/431718739_3499889103593675_2072398184202305018_n.jpg?_nc_cat=111&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=EVFY-oYhOWwQ7kNvwFy1NZS&_nc_oc=AdpaST48oLaX-UNxu7KkYv7XJ5Jug-GerMh2SreEKuMOyS107DDnbFaw_CjA0ynynAg&_nc_zt=14&_nc_ht=scontent-lga3-1.xx&_nc_gid=jgOVq0C54-nCSgL-cWzQlg&_nc_ss=78180&oh=00_AQSY-5R4kwyqDoDoIvyf2ExnDTvrUmEuosWYiQTrdjvckg&oe=6AF9AB42"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/431748186_289316047369916_1595311644416959995_n.jpg?_nc_cat=104&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=7jBzNbtJzZQQ7kNvwFoc2W-&_nc_oc=Adr5K3nWRxNSZOJUtk4EpEMSpDaWowPiSd8AoFOuPq6iC1D0_sgwu1k7WYDDlh8e2FE&_nc_zt=14&_nc_ht=scontent-lga3-3.xx&_nc_gid=jgOVq0C54-nCSgL-cWzQlg&_nc_ss=78180&oh=00_AQTKMsXovITtCMI5yWviFF_c5w3qZMoN4R5SSR2APDJy9w&oe=6AF9BD1F"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/431644642_737508601479774_8272309847273720820_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=8CEYXYDY3RkQ7kNvwEBbvY7&_nc_oc=AdpOOj571OGrAaZCNQymn1fVVAlcAlwQ8Deu7XeP9pMBN2P56Yb_WtclrqxJ5V4IgKg&_nc_zt=14&_nc_ht=scontent-lga3-3.xx&_nc_gid=jgOVq0C54-nCSgL-cWzQlg&_nc_ss=78180&oh=00_AQTg7XhvewTd4J9fMb3CNoo5viBEE6F5cM5EfcASvX1ReA&oe=6AF9B543"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/431631323_928727432024463_5606595664509361185_n.jpg?_nc_cat=103&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=nX44MCFkcBoQ7kNvwHqaAi8&_nc_oc=AdrowBIysdUyyrYSxESDxnDfA1kiX-WAw2y0Enp1My23Vf9lNCw484hmu0VsloTGPzk&_nc_zt=14&_nc_ht=scontent-lga3-1.xx&_nc_gid=jgOVq0C54-nCSgL-cWzQlg&_nc_ss=78180&oh=00_AQSFv487hq-IQCSPcQd7hKF19retNS--4umMsAaBKO9RIw&oe=6AF9D0E7"
    }
  ],
  "details": null,
  "collectedAt": "2026-11-11T04:31:21Z",
  "input": {
    "pageId": "15087023444",
    "maxItems": 20
  }
}
```

#### Companies

Finds advertiser pages in the ad library by name. Mode `adlibrary-companies`: fill in **Keywords** (up to 100 entries). For each entry, the Actor collects up to **Max results per target** profiles (100 by default, at most 100). Each profile becomes one item in the dataset, charged as **Adlibrary companies**.

Each profile looks like this:

```json
{
  "status": "ok",
  "type": "profile",
  "platform": "facebook",
  "id": "15087023444",
  "url": "https://www.facebook.com/nike",
  "username": "nike",
  "displayName": "Nike",
  "avatarUrl": "https://scontent-sea5-2.xx.fbcdn.net/v/t39.30808-1/284964043_10159903868513445_7696353984967674128_n.jpg?stp=dst-jpg_s200x200_tt6&_nc_cat=1&ccb=1-7&_nc_sid=418b77&_nc_ohc=hDLugZFy-CMQ7kNvwH8wePc&_nc_oc=AdoTOVb8_FNwloeS4jAZfp66coyBP4qa9h5rJRHdc2f3mfGH8XKpJDoCcJ64vCMMevw&_nc_zt=24&_nc_ht=scontent-sea5-2.xx&_nc_gid=bDZ48hKXUVFkxQVnKzK7rw&_nc_ss=70289&oh=00_AQTAv971sXNHhYWEJELm7x2yuvY13OHfrw2tFWRec2sqZA&oe=6AF9B570",
  "verified": true,
  "details": {
    "facebook": {
      "category": "Sportswear Store",
      "likes": 39488819,
      "instagramUsername": "nike",
      "instagramFollowers": 290801313
    }
  },
  "collectedAt": "2026-11-11T05:06:17Z",
  "input": {
    "keyword": "nike",
    "maxItems": 100
  }
}
```

#### Ad details

Looks up one ad by its id. Mode `adlibrary-ad`: fill in **Ad ids** (up to 100 entries). The Actor returns one ad for each entry. Each ad becomes one item in the dataset, charged as **Adlibrary ad**.

Each ad looks like this:

```json
{
  "status": "ok",
  "type": "ad",
  "platform": "facebook",
  "id": "1702938977100376",
  "url": "https://www.facebook.com/ads/library/?id=1702938977100376",
  "advertiser": {
    "id": "15087023444",
    "name": "Nike"
  },
  "text": "Bring sports more fully into your day with the Nike App.",
  "ctaText": "Install now",
  "landingUrl": null,
  "startedAt": "2025-04-07T07:00:00Z",
  "endedAt": "2026-11-10T08:00:00Z",
  "isActive": true,
  "media": [
    {
      "kind": "image",
      "url": "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/431734766_930233981755195_3984431312184472988_n.jpg?_nc_cat=104&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=64M1wnEooIQQ7kNvwFSowA9&_nc_oc=Adqr97b8biEL7Yym4SNnL24OmvrSyi6JfHcTMz3sE4_l6ciSaJ_Z8OwUmQyuU72Xd00&_nc_zt=14&_nc_ht=scontent-lga3-3.xx&_nc_gid=mjLZgzAsQErH8yxnxGQEMw&_nc_ss=78180&oh=00_AQT9FVFc_5d4JikLUE4jwXw3Bz5vkHvAkqblrCtUK_idXA&oe=6AF9D0AB"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/431631323_928727432024463_5606595664509361185_n.jpg?_nc_cat=103&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=nX44MCFkcBoQ7kNvwHAJU5W&_nc_oc=Adq9873j1Fac9jeK5OQKR3fwSg9EEkR_hNxAs1eqf3rJ4Grgq74O9B4jobljQzRvoq0&_nc_zt=14&_nc_ht=scontent-lga3-1.xx&_nc_gid=mjLZgzAsQErH8yxnxGQEMw&_nc_ss=78180&oh=00_AQR0YAioS5a52TfD6hXKR0BnF6Tym2I5fT0yZP4n_l4PJA&oe=6AF9D0E7"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/431718739_3499889103593675_2072398184202305018_n.jpg?_nc_cat=111&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=EVFY-oYhOWwQ7kNvwE_q4-5&_nc_oc=AdqI_glLixGkUQIGrLnp-n0yU_zgftY0vNjPvSXbFFyr3s4o2oipSX2nE5QIfU52-J4&_nc_zt=14&_nc_ht=scontent-lga3-1.xx&_nc_gid=mjLZgzAsQErH8yxnxGQEMw&_nc_ss=78180&oh=00_AQSd4ErenP-KkR8DkQSZXQlgPPjiuc-v-rqGp3KkasbKJA&oe=6AF9AB42"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/431748186_289316047369916_1595311644416959995_n.jpg?_nc_cat=104&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=7jBzNbtJzZQQ7kNvwHB83ay&_nc_oc=AdoaXJpObeU5hH6NGafC5Emuvy1ZW9oTszMDu5Dphocj0GTHo8I0d79k2d2ADdGsewQ&_nc_zt=14&_nc_ht=scontent-lga3-3.xx&_nc_gid=mjLZgzAsQErH8yxnxGQEMw&_nc_ss=78180&oh=00_AQSNoOD9PiLv0BlVW723OJmv0mc-62aDnTxpzv7Nsw0weA&oe=6AF9BD1F"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-3.xx.fbcdn.net/v/t39.35426-6/431644642_737508601479774_8272309847273720820_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=8CEYXYDY3RkQ7kNvwGRWrGp&_nc_oc=Ado49E3hcVEeH7h0U3gD2rLVkRmPRhfY_1W65wGIFXlGFRdCQArjFxNXQBS82cLG6o4&_nc_zt=14&_nc_ht=scontent-lga3-3.xx&_nc_gid=mjLZgzAsQErH8yxnxGQEMw&_nc_ss=78180&oh=00_AQQ3b-S8N3mJzxjfzBXt8JyISqhBzHRe6grs9Uu_7T--0Q&oe=6AF9B543"
    },
    {
      "kind": "image",
      "url": "https://scontent-lga3-2.xx.fbcdn.net/v/t39.35426-6/431679131_949214166636263_7090981238489979310_n.jpg?_nc_cat=100&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=TdB4dgR1J-QQ7kNvwFpbicZ&_nc_oc=AdrIZmf_pZB6cVu7re-zYqiwj-vfBnh93jehnLtmn1M06QJ2aioXqYEOuL6aJzgwANk&_nc_zt=14&_nc_ht=scontent-lga3-2.xx&_nc_gid=mjLZgzAsQErH8yxnxGQEMw&_nc_ss=78180&oh=00_AQR--D3-UsSYw4eWtVYNIJzk2-wD_X0ZuQbkwJWuil6NIg&oe=6AF9CA91"
    }
  ],
  "details": null,
  "collectedAt": "2026-11-11T04:31:48Z",
  "input": {
    "adId": "1702938977100376",
    "maxItems": 1
  }
}
```

#### Ad transcript

Returns the spoken text of a video ad by its id. Mode `adlibrary-transcript`: fill in **Ad ids** (up to 100 entries). The Actor returns one transcript for each entry. Each transcript becomes one item in the dataset, charged as **Adlibrary transcript**.

Each transcript looks like this:

```json
{
  "status": "ok",
  "type": "transcript",
  "platform": "facebook",
  "id": "974466855339122",
  "url": "https://www.facebook.com/ads/library/?id=974466855339122",
  "sourceId": "974466855339122",
  "text": "What kind of AI magic is this? Grammarly's AI keyboard is the most powerful writing tool I've ever used on my phone. It works across all your apps with built-in AI that catches mistakes as you type, which means no more switching between apps or copying and pasting. I drafted three client emails during my coffee break without a single typo, and my favorite, the AI rewrite feature that transforms my jumbled thoughts into perfect messages. Look at this, I wrote this rambling message to my boss, tapped, \"make it professional,\" and boom, clear, concise, and perfectly professional in seconds. That promotion? Yeah, this keyboard is basically writing it for me. Download the Grammarly AI keyboard right now. It's free and works with every app on your phone.",
  "details": null,
  "collectedAt": "2026-11-11T04:32:44Z",
  "input": {
    "adId": "974466855339122",
    "maxItems": 1
  }
}
```

### Use cases

- Competitor ads: see what a brand is running right now and how long.
- Creative research: collect ad texts, images and calls to action for a topic.
- Market monitoring: track new advertisers for a keyword and country.
- Video ad analysis: read the spoken text of an ad.

### Input

| Field | Title | Description |
| --- | --- | --- |
| `mode` | Mode | What to collect. Each run collects one kind of result; fill in the fields listed for that mode. |
| `keywords` | Keywords | Words to search ads or advertisers for, like nike. |
| `country` | Country | Two-letter country code the ads ran in, like US. Leave empty for all countries. |
| `pageIds` | Advertiser page ids | Numeric ids of advertiser pages, like 15087023444. Find them with the Companies mode. |
| `adIds` | Ad ids | Numeric ids of ads in the ad library, like 1702938977100376. |
| `maxItems` | Max results per target | The most results to collect for each target. Each mode caps it at its own maximum; leave it empty for the mode default. Single-lookup modes return one item per target, whatever this is set to: Ad details and Ad transcript. |
| `freshness` | Freshness | Standard may return recently collected data, which is faster. Live always collects fresh data. |

Example:

```json
{
  "mode": "adlibrary-search",
  "keywords": [
    "nike",
    "nasa"
  ],
  "maxItems": 20,
  "freshness": "standard"
}
```

### Output

Each mode has its own table view in the dataset; the item shapes are shown under **Modes**.

Every item carries a `status` field. A target that fails gives one item with `status: "error"` and an `error` object with a `code` and a `message`. A mode that is missing a field it needs gives one such item and collects nothing.

### Pricing

You pay per result. Prices are in USD per 1,000 results and depend on your Apify plan.

| Event | Free | Bronze | Silver | Gold | Platinum | Diamond |
| --- | --- | --- | --- | --- | --- | --- |
| Adlibrary ad | $5.650 | $5.000 | $4.444 | $3.333 | $3.333 | $3.333 |
| Adlibrary companies | $5.650 | $5.000 | $4.444 | $3.333 | $3.333 | $3.333 |
| Adlibrary company | $5.650 | $5.000 | $4.444 | $3.333 | $3.333 | $3.333 |
| Adlibrary search | $5.650 | $5.000 | $4.444 | $3.333 | $3.333 | $3.333 |
| Adlibrary transcript | $5.650 | $5.000 | $4.444 | $3.333 | $3.333 | $3.333 |

Errors and empty results are never charged, and the run stops when it reaches your spending limit.

Free plan: up to 10 results per run and 20 runs per day.

### FAQ

#### What does each mode return?

Ad search finds ads for keywords, optionally in one country. Company ads collects the ads of an advertiser page. Companies finds advertiser pages by name. Ad details looks up one ad. Ad transcript returns the spoken text of a video ad.

#### Where do I find an advertiser page id or an ad id?

Run Companies or Ad search first. Each result carries the advertiser id and the ad id, which you can use in the other modes.

#### Do I need to log in or share a Facebook account?

No. The Actor collects only public information and needs no login or cookies.

#### How many results can I collect, and what do I pay?

Set the maximum number of results per target in the input. You pay only for the results delivered, and a run stops when it reaches your spending limit. Errors and empty results are not charged.

#### Is this Actor affiliated with Facebook?

No. It is an independent tool, not affiliated with, endorsed by or sponsored by Facebook or Meta. It collects only information that is shown publicly on Facebook.

### Disclaimer

This Actor is not affiliated with, endorsed by, or sponsored by Facebook. All trademarks belong to their respective owners.

# Actor input Schema

## `mode` (type: `string`):

What to collect. Each run collects one kind of result; fill in the fields listed for that mode.

## `keywords` (type: `array`):

Words to search ads or advertisers for, like nike.

## `country` (type: `string`):

Two-letter country code the ads ran in, like US. Leave empty for all countries.

## `pageIds` (type: `array`):

Numeric ids of advertiser pages, like 15087023444. Find them with the Companies mode.

## `adIds` (type: `array`):

Numeric ids of ads in the ad library, like 1702938977100376.

## `maxItems` (type: `integer`):

The most results to collect for each target. Each mode caps it at its own maximum; leave it empty for the mode default. Single-lookup modes return one item per target, whatever this is set to: Ad details and Ad transcript.

## `freshness` (type: `string`):

Standard may return recently collected data, which is faster. Live always collects fresh data.

## Actor input object example

```json
{
  "mode": "adlibrary-search",
  "keywords": [
    "nike",
    "nasa"
  ],
  "pageIds": [
    "15087023444"
  ],
  "adIds": [
    "1702938977100376"
  ],
  "maxItems": 20,
  "freshness": "standard"
}
```

# Actor output Schema

## `results` (type: `string`):

All collected items in the default dataset.

# 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 = {
    "mode": "adlibrary-search",
    "keywords": [
        "nike",
        "nasa"
    ],
    "pageIds": [
        "15087023444"
    ],
    "adIds": [
        "1702938977100376"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("icoe-man/facebook-ads-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 = {
    "mode": "adlibrary-search",
    "keywords": [
        "nike",
        "nasa",
    ],
    "pageIds": ["15087023444"],
    "adIds": ["1702938977100376"],
    "maxItems": 20,
}

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

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

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

```

## CLI example

```bash
echo '{
  "mode": "adlibrary-search",
  "keywords": [
    "nike",
    "nasa"
  ],
  "pageIds": [
    "15087023444"
  ],
  "adIds": [
    "1702938977100376"
  ],
  "maxItems": 20
}' |
apify call icoe-man/facebook-ads-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,icoe-man/facebook-ads-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/lw7FsyJ92PMIXu4Aa/builds/ddPK0YyaWlYVd7QPO/openapi.json
