# Facebook Marketplace Scraper (`khadinakbar/facebook-marketplace-scraper`) Actor

Scrape Facebook Marketplace search results, listing details, prices, photos, sellers, locations, and item status into clean structured data. Perfect for SEO and AI agents, MCP optimized.

- **URL**: https://apify.com/khadinakbar/facebook-marketplace-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, Lead generation, MCP servers
- **Stats:** 2 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 marketplace listing scrapeds

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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Marketplace Scraper

Scrape Facebook Marketplace search results, direct item details, and location lookups into clean structured records. This actor is perfect for SEO and AI agents, MCP optimized, and designed for product research, local-market monitoring, lead discovery, resale analysis, and price intelligence.

### What it extracts

- Marketplace search listings by query and location
- Direct Marketplace item details by URL or listing ID
- Location lookup results with latitude and longitude
- Listing titles, IDs, URLs, prices, photos, status flags, delivery types, category IDs, and locations
- Item descriptions, created time, condition attributes, seller info when available, photos, shipping flags, and sold/live/pending status
- Provider pagination cursors for continuation runs

### Input modes

Use `searchQueries` with either `latitude` and `longitude`, or a `locationQuery` such as `Austin, TX`. The actor resolves the location first, then searches Marketplace around those coordinates.

Use `itemUrls` or `itemIds` when you already know the listing and want item detail records.

Set `includeItemDetails` to `true` when you want each search listing enriched with a full item detail request. Leave it off for lower-cost bulk search.

### Provider-backed reliability

Facebook Marketplace is heavily login-gated in browser sessions. This actor uses configured provider APIs first:

- `SCRAPECREATORS_API_KEY`
- `SOCIAVAULT_API_KEY`
- `SOCIALVAULT_API_KEY` as a backwards-compatible alias

Provider keys are owner secrets, never user input. If no provider key is configured, the actor exits successfully with a diagnostic `OUTPUT` summary instead of failing the run.

### Example input

```json
{
  "searchQueries": ["bike"],
  "locationQuery": "Austin, TX",
  "radiusKm": 40,
  "maxListings": 25,
  "maxPages": 2,
  "countPerPage": 24,
  "sortBy": "suggested",
  "availability": "in_stock"
}
```

### Output

Dataset rows include `recordType` values:

- `location`
- `listing`
- `item`

The key-value store contains `OUTPUT` and `RUN_SUMMARY` with totals, provider status codes, dedupe counts, estimated PPE cost, and `nextCursors`.

### Pricing

This actor uses pay per event:

- `listing-scraped`: $0.004 per listing row
- `item-scraped`: $0.006 per item detail row
- `location-found`: $0.001 per location lookup row

Pricing preserves provider cost margin while keeping bulk search predictable.

# Actor input Schema

## `searchQueries` (type: `array`):

Marketplace search terms, for example bikes, sofas, apartments, iPhone, or office chairs.

## `itemUrls` (type: `array`):

Direct Facebook Marketplace item URLs to scrape in detail.

## `itemIds` (type: `array`):

Direct Marketplace numeric listing IDs. Use this when you know the item ID but do not have the full URL.

## `locationQuery` (type: `string`):

City or place to resolve into Marketplace latitude and longitude before search. Example: Austin, TX.

## `latitude` (type: `number`):

Search latitude. If omitted, location query is used.

## `longitude` (type: `number`):

Search longitude. If omitted, location query is used.

## `radiusKm` (type: `number`):

Marketplace search radius around the resolved coordinates.

## `minPrice` (type: `number`):

Optional minimum listing price.

## `maxPrice` (type: `number`):

Optional maximum listing price.

## `maxListings` (type: `integer`):

Maximum search listing records to save across all search queries.

## `maxPages` (type: `integer`):

Maximum provider result pages to request per search query.

## `countPerPage` (type: `integer`):

Number of listings requested from the provider per page.

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

Provider-side Marketplace ordering.

## `deliveryMethod` (type: `string`):

Optional Marketplace delivery filter.

## `condition` (type: `string`):

Optional item condition filter.

## `dateListed` (type: `string`):

Optional Marketplace date-listed filter.

## `availability` (type: `string`):

Optional listing availability filter.

## `startCursor` (type: `string`):

Optional provider pagination cursor from RUN\_SUMMARY.nextCursors.

## `dataSource` (type: `string`):

Provider mode uses configured ScrapeCreators or SociaVault APIs. Auto currently resolves to provider mode because Facebook Marketplace is login-heavy.

## `providerOrder` (type: `string`):

Choose which managed provider API is tried first.

## `includeItemDetails` (type: `boolean`):

Fetch detailed item records for each search listing. This costs one item-detail provider request per listing.

## `includeLocationResults` (type: `boolean`):

Save location lookup results to the dataset when location query is used.

## `includeRawData` (type: `boolean`):

Include raw source objects in each dataset row for debugging and custom downstream parsing.

## Actor input object example

```json
{
  "searchQueries": [
    "bike"
  ],
  "itemUrls": [
    {
      "url": "https://www.facebook.com/marketplace/item/1880804689276480/"
    }
  ],
  "locationQuery": "Austin, TX",
  "radiusKm": 40,
  "maxListings": 100,
  "maxPages": 5,
  "countPerPage": 24,
  "sortBy": "suggested",
  "deliveryMethod": "all",
  "condition": "all",
  "dateListed": "all",
  "availability": "in_stock",
  "dataSource": "auto",
  "providerOrder": "scrapecreators-first",
  "includeItemDetails": false,
  "includeLocationResults": true,
  "includeRawData": false
}
```

# Actor output Schema

## `records` (type: `string`):

Structured dataset rows for listings, item details, and locations.

## `recordsCsv` (type: `string`):

CSV export of the same Marketplace records.

## `runSummary` (type: `string`):

Machine-readable telemetry with counts, providers used, provider status codes, cursors, and stop reason.

## `outputSummary` (type: `string`):

Compact agent-friendly summary for the run.

# 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 = {
    "searchQueries": [
        "bike"
    ],
    "itemUrls": [
        {
            "url": "https://www.facebook.com/marketplace/item/1880804689276480/"
        }
    ],
    "locationQuery": "Austin, TX"
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/facebook-marketplace-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 = {
    "searchQueries": ["bike"],
    "itemUrls": [{ "url": "https://www.facebook.com/marketplace/item/1880804689276480/" }],
    "locationQuery": "Austin, TX",
}

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/facebook-marketplace-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 '{
  "searchQueries": [
    "bike"
  ],
  "itemUrls": [
    {
      "url": "https://www.facebook.com/marketplace/item/1880804689276480/"
    }
  ],
  "locationQuery": "Austin, TX"
}' |
apify call khadinakbar/facebook-marketplace-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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