# Facebook Ad Library Scraper – From $0.50/1K Ads (`lofomachines/facebook-ads-library-scraper`) Actor

Export Facebook and Instagram ads from Meta Ad Library for $0.50 per 1,000 ads on Gold and higher, $0.60 on Silver or $0.70 on Bronze and Free. Find competitor ads by keyword or Page ID. Download ad copy, media links and landing page URLs in CSV, Excel or JSON. Batch exports add a start fee.

- **URL**: https://apify.com/lofomachines/facebook-ads-library-scraper.md
- **Developed by:** [Lofomachines](https://apify.com/lofomachines) (community)
- **Categories:** Social media, Marketing
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 batch ads

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 Ad Library Scraper for competitor ad research

Export Facebook and Instagram ads from the [Meta Ad Library](https://www.facebook.com/ads/library/) to CSV, Excel or JSON. Enter a competitor’s Facebook Page ID to see their ads, or search a keyword in a country to see which advertisers promote the same product. Each row contains one ad, with its copy, creative links, call to action and landing page URL when available.

Per 1,000 ads returned, the price is **$0.50 on Gold, Platinum and Diamond**, **$0.60 on Silver**, **$0.70 on Bronze and Free**. The same rates apply to batch downloads and the live API. Batch downloads also have a start fee.

### What do 1,000 Facebook ads cost?

| Apify Store discount tier | Batch export per 1,000 ads | Live Server API per 1,000 ads |
| --- | ---: | ---: |
| Free | $0.70 | $0.70 |
| Bronze | $0.70 | $0.70 |
| Silver | $0.60 | $0.60 |
| Gold, Platinum and Diamond | **$0.50** | **$0.50** |

Batch exports support up to 1,000 ads per run and add $0.00005 per GB of allocated memory per start, with a one-event minimum. At default memory, a 100-ad batch costs **$0.05005 on Gold** or **$0.07005 on Bronze**. The Server API returns up to 100 ads per request. A 20-ad API lookup costs **$0.010 on Gold**, **$0.012 on Silver** or **$0.014 on Bronze and Free**.

Each Library ID counts once per search, even if the same ad appears on Facebook and Instagram. An empty search has zero ad events. Running the same search again is a new export.

### How do I export a competitor’s Facebook ads to CSV or Excel?

1. Open **Input**. Enter a keyword and country for market research, or paste an existing Facebook Ads Library link.
2. To build a competitor swipe file, enter the advertiser’s **Facebook Page ID** under **Advertiser and ad filters**. The Page ID is the number after `view_all_page_id=` in an advertiser’s Ads Library link.
3. Choose **Maximum Ads** and click **Start**. Open **Dataset → Export** and select **CSV**, **Excel** or **JSON**. A separate JSON download is available in **Output**.

Try the [competitor ad export example](https://apify.com/lofomachines/facebook-ads-library-scraper/examples/export-competitor-facebook-ads-to-csv) to collect ten examples from the Nike advertiser Page. Replace its Page ID with your competitor’s.

### How do I find ads by keyword, advertiser or Facebook Ad Library ID?

- **Keyword** finds advertising related to a topic, offer or product. A search for Nike can also return retailers promoting Nike products.
- **Facebook Page ID** follows one advertiser. Use **Country** to select the market or `ALL` for all countries available in the library.
- **Advertiser name** searches for an exact advertiser name. Use a Page ID when several advertisers share the same name.
- **Specific Ad ID** retrieves one creative by its Library ID. Paste an individual ad link or enter the number.
- **Ads Library URL** reproduces the search encoded in the link and takes priority over the other search fields.

Choose active, inactive or all ads, image or video creative, country and content language. Meta determines availability by market, ad category and date. Results can carry several placement labels, including Facebook and Instagram, for the same Library ID.

### What does a Meta Ad Library export look like?

Use this input to export up to ten active ads from the Nike Page across all available countries.

```json
{"facebookPageId":"15087023444","country":"ALL","adStatus":"active","maxItems":10}
```

Here are selected fields from one Nike ad returned by the scraper.

```json
{
  "libraryID": "2687341841704200",
  "brand": "Nike",
  "active": true,
  "platforms": [
    "Facebook",
    "Instagram"
  ],
  "format": "image",
  "startDate": "10/23/2026"
}
```

Each row can also include `body`, `linkTitle`, `linkDescription`, `linkUrl`, `ctaText`, `ctaUrl`, `images`, `videos`, `brandLogo`, `endDate`, `similarAdCount`, `multipleVersions` and `scrapeDate`. Some advertisers omit destinations or use dynamic creative. To revisit an ad, open `https://www.facebook.com/ads/library/?id=LIBRARY_ID` with the exported ID.

### Questions about competitor ad research

#### How do I find a competitor’s Instagram ads?

Enter their Facebook Page ID and choose a country. Export the results and filter the `platforms` column for rows containing `Instagram`. A row can list both Facebook and Instagram when the same ad ran on both.

#### Can I export video ads for a creative brief?

Choose **Video** under **Media Type** to find video ads. In the export, use `videos` for creative links, `body` for the ad copy and `linkUrl` for the offer’s landing page. The export includes media URLs when available. These links can expire.

#### How do I track new ads from the same advertiser?

Save the Page ID and country as an Apify task and schedule it. Compare each new export with the previous one using `libraryID`. IDs appearing for the first time identify creatives you have just discovered. The same ID on several dates shows that you saw the same ad again.

#### Can I see how much a competitor spent on an ad?

The export includes creative details and the start and end dates when Meta supplies them. Spend, conversions and return on ad spend are outside this dataset.

### How do I get Meta Ad Library results from the live API?

Open **Server** to try `POST /scrape`. It accepts a keyword, Page, ad ID or Ads Library URL and returns `count`, `ads`, `status` and a request ID. The default is 20 ads and the maximum is 100 per request.

```bash
curl https://lofomachines--facebook-ads-library-scraper.apify.actor/scrape \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"facebookPageId":"15087023444","country":"ALL","maxItems":10}'
```

A `complete` search reached your cap or exhausted the available matches. `empty` means Meta returned no matching ads. `partial` means the scraper collected some records before Meta limited further access or the time limit expired. Each response bills only the ads delivered. A request that encounters an unavailable feed before collecting any ads returns an error. Use `GET /health` to check readiness.

### Italiano · Scaricare le inserzioni Facebook e Instagram

Inserisci una parola chiave o l’ID della Pagina Facebook e scegli il Paese. Con l’ID Pagina puoi isolare le inserzioni di un concorrente. Esporta testi, creatività, link e date in CSV o Excel oppure usa l’API. Per 1.000 annunci paghi **0,70 USD con Free e Bronze, 0,60 con Silver e 0,50 con Gold o superiore**. Il batch prevede anche il costo di avvio.

### Español · Exportar anuncios de Facebook e Instagram

Busca por palabra clave, país o ID de la página del anunciante. Descarga textos, enlaces y fechas en CSV o Excel o consulta hasta 100 anuncios por petición en la API. Por 1.000 anuncios, el precio es **0,70 USD en Free y Bronze, 0,60 en Silver y 0,50 en Gold o superior**. El lote añade una tarifa de inicio.

### Français · Exporter les publicités de la bibliothèque Meta

Choisissez le pays et saisissez un mot-clé ou l’identifiant de la Page d’un concurrent. Exportez les textes, liens et visuels en CSV ou Excel, ou interrogez l’API. Pour 1 000 annonces, comptez **0,70 USD en Free et Bronze, 0,60 en Silver et 0,50 en Gold ou au-delà**. Des frais de démarrage s’ajoutent pour le traitement par lot.

### Deutsch · Facebook- und Instagram-Werbeanzeigen exportieren

Mit einer Seiten-ID finden Sie die Anzeigen eines bestimmten Werbetreibenden. Land und Suchbegriff eingeben und Texte, Medienlinks und Laufzeiten als CSV oder Excel exportieren. Für Batch und Server-API gelten je 1.000 Anzeigen **0,70 USD in Free und Bronze, 0,60 USD in Silver und 0,50 USD ab Gold**. Beim Batch kommt die Startgebühr hinzu.

Discover more tools for competitor research and social media monitoring in the [Lofomachines Apify Store](https://apify.com/lofomachines).

# Actor input Schema

## `searchQuery` (type: `string`):

Keyword, brand, product, or competitor name to search in Meta Ads Library.

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

Two-letter country code for the Ads Library market, such as US, GB, IT, FR, DE, ES, or CA.

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

Maximum number of ads to save. Start small for a quick test, increase for deeper competitor research.

## `directUrl` (type: `string`):

Optional. Paste a Facebook Ads Library search, advertiser or individual ad link.

## `facebookPageId` (type: `string`):

Optional Facebook Page ID to scrape ads from one advertiser page.

## `facebookPageName` (type: `string`):

Match the advertiser name exactly. Use its numeric Page ID to distinguish businesses with the same name.

## `specificAdId` (type: `string`):

Optional Meta Ads Library ID for one specific ad.

## `adStatus` (type: `string`):

Choose whether to collect active ads, inactive ads, or every available ad.

## `adType` (type: `string`):

Filter by ad category. Most competitor research uses All ads.

## `mediaType` (type: `string`):

Collect all creatives, image ads only, or video ads only.

## `targetedCountryOnly` (type: `boolean`):

Only return ads targeted to the selected country.

## `contentLanguages` (type: `array`):

Optional language codes such as en, es, it, de, fr, or pt.

## `sortBy` (type: `string`):

Sort results by Meta's available result ordering.

## `sortDirection` (type: `string`):

Descending usually surfaces the strongest or newest examples first.

## `maxConcurrency` (type: `integer`):

Retained for saved inputs. Each search follows Meta’s result pages in order.

## `pageTimeoutSecs` (type: `integer`):

Time allowed to collect a large batch. Smaller exports usually finish sooner.

## `proxyConfiguration` (type: `object`):

Optional custom route for batch searches. By default the Actor tries a direct connection first and can use Apify Proxy when Meta limits access. The Store event price includes collection.

## Actor input object example

```json
{
  "searchQuery": "nike",
  "country": "US",
  "maxItems": 25,
  "adStatus": "active",
  "adType": "all",
  "mediaType": "all",
  "targetedCountryOnly": false,
  "contentLanguages": [],
  "sortBy": "total_impressions",
  "sortDirection": "desc",
  "maxConcurrency": 1,
  "pageTimeoutSecs": 900,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Structured ad records with Library ID, brand, ad copy, CTA, landing page URL, creative media URLs, platforms, dates, format, scrape timestamp, and source URL.

## `jsonFile` (type: `string`):

A ready-to-download JSON file containing all ads from the run, useful for AI workflows, dashboards, automations, and backups.

# 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 = {
    "searchQuery": "nike",
    "country": "US",
    "maxItems": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("lofomachines/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 = {
    "searchQuery": "nike",
    "country": "US",
    "maxItems": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("lofomachines/facebook-ads-library-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 '{
  "searchQuery": "nike",
  "country": "US",
  "maxItems": 25
}' |
apify call lofomachines/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lofomachines/facebook-ads-library-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/K5DBZYF0dvfQTf3oR/builds/dWmErhKXyUAEmrm4A/openapi.json
