# Facebook Ad Leads (email, phone & more) (`igolaizola/facebook-ad-leads`)

Scrape business details from Facebook Ad Library to create comprehensive company profiles featuring email, phone, address, website, and social media links. Perfect for competitive analysis, market research, and lead generation.

- **URL**: https://beta-securitybyobscurity.apify.com/igolaizola/facebook-ad-leads.md
- **Developed by:** [Iñigo Garcia Olaizola](https://beta-securitybyobscurity.apify.com/igolaizola) (community)
- **Categories:** Lead generation, Social media, Other
- **Stats:** 193 total users, 36 monthly users, 87.3% runs succeeded, 7 bookmarks
- **User rating**: No ratings yet

## Pricing

$25.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

# README

## Facebook Ad Leads Scraper

### 🤖 What does Facebook Ad Leads Scraper do?

Facebook Ad Leads Scraper is designed to extract detailed information about the companies behind Facebook ads by leveraging data from the [Meta Ad Library](https://www.facebook.com/ads/library/). Instead of collecting ad creatives, this actor focuses on gathering owner details—including contact information, addresses, social media links, and more—to help you gain insights into the businesses behind these ads.

This actor collects key company details such as:

- **ID:** Unique identifier for the company record.
- **Name:** The official name of the company or organization.
- **Category:** Business category or industry classification.
- **Email:** Contact email address.
- **Phone:** Telephone number.
- **Address:** Physical address or location.
- **Description:** A brief description or overview of the company.
- **Website:** Company website URL.
- **Facebook & Instagram:** Company social media profiles.
- **Profile Picture:** Visual representation or logo of the company.

### 💡 Why scrape company details from Facebook Ad Library?

The Facebook Ad Leads Scraper is a powerful tool for anyone looking to understand the entities behind digital advertising campaigns. Here’s why you might want to use it:

- **Competitive Analysis:** Identify key players and competitors in your industry by analyzing which companies are actively advertising.
- **Market Research:** Gain insights into business trends, outreach strategies, and the contact channels companies are promoting.
- **Enhanced Lead Generation:** Build more accurate marketing lists or databases based on verified company information.
- **Campaign Analysis:** Understand how businesses position themselves online and refine your own digital strategies.
- **Business Intelligence:** Monitor the advertising landscape and discover emerging brands or industry leaders.

### 🚀 How to scrape Facebook Ad Leads

Getting started with the Facebook Ad Leads Scraper is simple:

1. **Configure Your Input:**
   - **Max Items:** Define the maximum number of company records to retrieve.
   - **Search Query:** Specify a keyword to filter the ads and identify relevant companies.
   - **Country:** Optionally limit your search by a specific country code.
   - **Category:** Filter companies by the type of ad or industry category.
   - **Proxy Configuration:** Utilize Apify's proxy settings (default is residential proxies) for reliable and secure scraping.
2. **Run the Actor:**
   - Click **Run** to initiate the scraping process.
3. **Access Your Data:**
   - View or download the extracted company data from the Dataset tab for further analysis.

### 📝 Input Parameters

The actor accepts the following input parameters:

| Parameter            | Type    | Required | Description                                                                                                                                           |
| -------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `maxItems`           | Integer | Yes      | Maximum number of company records to scrape. Must be at least 1. Default is 10.                                                                       |
| `query`              | String  | Yes      | Search query to filter the ads and, by extension, the companies behind them. For example, "pizza".                                                    |
| `country`            | String  | No       | Country code to filter companies by location. Default is set to "ALL" (all countries).                                                                |
| `category`           | String  | No       | Category to filter companies. Options include: "all", "political\_and\_issue\_ads", "housing\_ads", "employment\_ads", and "credit\_ads". Default is "all". |
| `proxyConfiguration` | Object  | No       | Proxy settings to route requests. Default configuration uses Apify's residential proxy group.                                                         |

Example input:

```json
{
  "maxItems": 10,
  "query": "pizza",
  "country": "US",
  "category": "Employment",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

### 📊 Results

After running the actor, you will receive a structured dataset with the following fields:

- **ID:** Unique company identifier.
- **Name:** The company’s name.
- **Category:** Business category or type.
- **Email:** Contact email address.
- **Phone:** Contact telephone number.
- **Address:** Physical or mailing address.
- **Description:** Brief company overview.
- **Website:** URL of the company website.
- **Facebook:** Link to the company's Facebook page.
- **Instagram:** Company’s Instagram handle.
- **Profile Picture:** URL to the company logo or profile image.

Example output snippet:

```json
[
  {
    "id": "123456789",
    "name": "Example Company",
    "category": "Employment",
    "email": "contact@example.com",
    "phone": "+1-800-123-4567",
    "address": "123 Example Street, Example City, EX 12345",
    "description": "A leading provider in employment solutions.",
    "website": "https://www.example.com",
    "facebook": "https://www.facebook.com/examplecompany",
    "instagram": "examplecompany",
    "profile_picture": "https://example.com/logo.png"
  }
]
```

### 🌍 Proxy Usage

To maximize success rates and minimize detection risks, Facebook Ad Leads Scraper uses Apify's proxy infrastructure. This setup provides:

- **Enhanced Reliability:** Stable access to Facebook's Ad Library.
- **Geographical Flexibility:** Ability to scrape data from different regions.
- **Reduced Blocking Risks:** Mitigates IP blocking during high-frequency requests.

### ⚖️ Legal Considerations

When using Facebook Ad Leads Scraper, please ensure that you:

- **Respect Facebook's Terms:** Always comply with Facebook's terms of service and policies.
- **Avoid Overloading Servers:** Implement reasonable request rates to prevent server overload.
- **Adhere to Data Privacy Laws:** Comply with data protection regulations such as GDPR.
- **Seek Legal Advice if Needed:** Consult a legal professional if you are unsure about the implications of web scraping.

For additional insights on the legal aspects of web scraping, you may refer to our blog post on [is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

# Actor input Schema

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

Maximum number of items to scrape

## `query` (type: `string`):

Search query to filter ads

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

Country code to filter ads

## `category` (type: `string`):

Category to filter ads

## `minDate` (type: `string`):

Select min date in format YYYY-MM-DD

## `maxDate` (type: `string`):

Select max date in format YYYY-MM-DD

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

Select proxies to be used.

## Actor input object example

```json
{
  "maxItems": 10,
  "query": "put your search query here",
  "country": "ALL",
  "category": "all",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "query": "put your search query here",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("igolaizola/facebook-ad-leads").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 = {
    "query": "put your search query here",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("igolaizola/facebook-ad-leads").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 '{
  "query": "put your search query here",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call igolaizola/facebook-ad-leads --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Ad Leads (email, phone & more)",
        "description": "Scrape business details from Facebook Ad Library to create comprehensive company profiles featuring email, phone, address, website, and social media links. Perfect for competitive analysis, market research, and lead generation.",
        "version": "0.0",
        "x-build-id": "8ZOkTpBj3svhS5u6X"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/igolaizola~facebook-ad-leads/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-igolaizola-facebook-ad-leads",
                "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/igolaizola~facebook-ad-leads/runs": {
            "post": {
                "operationId": "runs-sync-igolaizola-facebook-ad-leads",
                "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/igolaizola~facebook-ad-leads/run-sync": {
            "post": {
                "operationId": "run-sync-igolaizola-facebook-ad-leads",
                "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": [
                    "maxItems",
                    "query"
                ],
                "properties": {
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of items to scrape",
                        "default": 10
                    },
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Search query to filter ads"
                    },
                    "country": {
                        "title": "Country",
                        "enum": [
                            "ALL",
                            "AX",
                            "AL",
                            "DZ",
                            "AS",
                            "AD",
                            "AO",
                            "AI",
                            "AQ",
                            "AG",
                            "AR",
                            "AM",
                            "AW",
                            "AU",
                            "AT",
                            "AZ",
                            "BH",
                            "BD",
                            "BB",
                            "BY",
                            "BE",
                            "BZ",
                            "BJ",
                            "BM",
                            "BT",
                            "BO",
                            "BQ",
                            "BA",
                            "BW",
                            "BV",
                            "BR",
                            "IO",
                            "VG",
                            "BN",
                            "BG",
                            "BF",
                            "BI",
                            "KH",
                            "CM",
                            "CA",
                            "CV",
                            "KY",
                            "CF",
                            "TD",
                            "CL",
                            "CO",
                            "KM",
                            "CK",
                            "CR",
                            "CI",
                            "HR",
                            "CW",
                            "CY",
                            "CZ",
                            "CD",
                            "DK",
                            "DJ",
                            "DM",
                            "DO",
                            "EC",
                            "EG",
                            "SV",
                            "GQ",
                            "ER",
                            "EE",
                            "ET",
                            "FK",
                            "FO",
                            "FM",
                            "FJ",
                            "FI",
                            "FR",
                            "GF",
                            "GA",
                            "GE",
                            "DE",
                            "GH",
                            "GI",
                            "GR",
                            "GL",
                            "GD",
                            "GP",
                            "GU",
                            "GT",
                            "GG",
                            "GN",
                            "GW",
                            "GY",
                            "HT",
                            "HN",
                            "HU",
                            "IS",
                            "IN",
                            "ID",
                            "IQ",
                            "IE",
                            "IM",
                            "IT",
                            "JM",
                            "JP",
                            "JE",
                            "JO",
                            "KZ",
                            "KE",
                            "KI",
                            "XK",
                            "KW",
                            "KG",
                            "LA",
                            "LV",
                            "LB",
                            "LS",
                            "LR",
                            "LY",
                            "LI",
                            "LT",
                            "LU",
                            "MK",
                            "MG",
                            "MW",
                            "MY",
                            "MV",
                            "ML",
                            "MT",
                            "MH",
                            "MQ",
                            "MR",
                            "MU",
                            "YT",
                            "MX",
                            "MD",
                            "MC",
                            "MN",
                            "ME",
                            "MS",
                            "MA",
                            "MZ",
                            "MM",
                            "NA",
                            "NR",
                            "NP",
                            "NL",
                            "NZ",
                            "NI",
                            "NE",
                            "NG",
                            "NU",
                            "MP",
                            "NO",
                            "OM",
                            "PK",
                            "PW",
                            "PS",
                            "PA",
                            "PG",
                            "PY",
                            "PE",
                            "PH",
                            "PN",
                            "PL",
                            "PT",
                            "PR",
                            "QA",
                            "CG",
                            "RE",
                            "RO",
                            "RW",
                            "BL",
                            "SH",
                            "KN",
                            "MF",
                            "PM",
                            "VC",
                            "WS",
                            "SM",
                            "ST",
                            "SA",
                            "SN",
                            "RS",
                            "SC",
                            "SL",
                            "SG",
                            "SX",
                            "SK",
                            "SI",
                            "SB",
                            "SO",
                            "ZA",
                            "GS",
                            "SS",
                            "ES",
                            "LK",
                            "LC",
                            "SR",
                            "SJ",
                            "SZ",
                            "SE",
                            "CH",
                            "TW",
                            "TJ",
                            "TZ",
                            "TH",
                            "BS",
                            "GM",
                            "TL",
                            "TG",
                            "TK",
                            "TO",
                            "TT",
                            "TN",
                            "TR",
                            "TM",
                            "TC",
                            "TV",
                            "UG",
                            "UA",
                            "AE",
                            "GB",
                            "US",
                            "UM",
                            "UY",
                            "VI",
                            "UZ",
                            "VU",
                            "VA",
                            "VE",
                            "VN",
                            "YE",
                            "ZM",
                            "ZW",
                            "AF",
                            "CN",
                            "CX",
                            "CC",
                            "PF",
                            "TF",
                            "HM",
                            "HK",
                            "IL",
                            "MO",
                            "AN",
                            "NC",
                            "NF",
                            "RU",
                            "KR",
                            "WF",
                            "EH"
                        ],
                        "type": "string",
                        "description": "Country code to filter ads",
                        "default": "ALL"
                    },
                    "category": {
                        "title": "Category",
                        "enum": [
                            "all",
                            "political_and_issue_ads",
                            "housing_ads",
                            "employment_ads",
                            "credit_ads"
                        ],
                        "type": "string",
                        "description": "Category to filter ads",
                        "default": "all"
                    },
                    "minDate": {
                        "title": "Min date",
                        "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
                        "type": "string",
                        "description": "Select min date in format YYYY-MM-DD"
                    },
                    "maxDate": {
                        "title": "Max date",
                        "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
                        "type": "string",
                        "description": "Select max date in format YYYY-MM-DD"
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Select proxies to be used."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
