# 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:** 1 total users, 0 monthly users, 0.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 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 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

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Marketplace Scraper",
        "description": "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.",
        "version": "1.0",
        "x-build-id": "IM495dq7s7FpeE4OV"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/khadinakbar~facebook-marketplace-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-khadinakbar-facebook-marketplace-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/khadinakbar~facebook-marketplace-scraper/runs": {
            "post": {
                "operationId": "runs-sync-khadinakbar-facebook-marketplace-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/khadinakbar~facebook-marketplace-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-khadinakbar-facebook-marketplace-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",
                "properties": {
                    "searchQueries": {
                        "title": "Search queries",
                        "type": "array",
                        "description": "Marketplace search terms, for example bikes, sofas, apartments, iPhone, or office chairs.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "itemUrls": {
                        "title": "Item URLs",
                        "type": "array",
                        "description": "Direct Facebook Marketplace item URLs to scrape in detail.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "itemIds": {
                        "title": "Item IDs",
                        "type": "array",
                        "description": "Direct Marketplace numeric listing IDs. Use this when you know the item ID but do not have the full URL.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "locationQuery": {
                        "title": "Location query",
                        "type": "string",
                        "description": "City or place to resolve into Marketplace latitude and longitude before search. Example: Austin, TX."
                    },
                    "latitude": {
                        "title": "Latitude",
                        "type": "number",
                        "description": "Search latitude. If omitted, location query is used."
                    },
                    "longitude": {
                        "title": "Longitude",
                        "type": "number",
                        "description": "Search longitude. If omitted, location query is used."
                    },
                    "radiusKm": {
                        "title": "Radius in kilometers",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "number",
                        "description": "Marketplace search radius around the resolved coordinates.",
                        "default": 40
                    },
                    "minPrice": {
                        "title": "Minimum price",
                        "minimum": 0,
                        "type": "number",
                        "description": "Optional minimum listing price."
                    },
                    "maxPrice": {
                        "title": "Maximum price",
                        "minimum": 0,
                        "type": "number",
                        "description": "Optional maximum listing price."
                    },
                    "maxListings": {
                        "title": "Maximum listings",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum search listing records to save across all search queries.",
                        "default": 100
                    },
                    "maxPages": {
                        "title": "Maximum pages per query",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Maximum provider result pages to request per search query.",
                        "default": 5
                    },
                    "countPerPage": {
                        "title": "Count per page",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Number of listings requested from the provider per page.",
                        "default": 24
                    },
                    "sortBy": {
                        "title": "Sort by",
                        "enum": [
                            "suggested",
                            "distance_ascend",
                            "creation_time_descend",
                            "price_ascend",
                            "price_descend"
                        ],
                        "type": "string",
                        "description": "Provider-side Marketplace ordering.",
                        "default": "suggested"
                    },
                    "deliveryMethod": {
                        "title": "Delivery method",
                        "enum": [
                            "all",
                            "local_pick_up",
                            "shipping"
                        ],
                        "type": "string",
                        "description": "Optional Marketplace delivery filter.",
                        "default": "all"
                    },
                    "condition": {
                        "title": "Condition",
                        "enum": [
                            "all",
                            "new",
                            "used_like_new",
                            "used_good",
                            "used_fair"
                        ],
                        "type": "string",
                        "description": "Optional item condition filter.",
                        "default": "all"
                    },
                    "dateListed": {
                        "title": "Date listed",
                        "enum": [
                            "all",
                            "last_24_hours",
                            "last_7_days",
                            "last_30_days"
                        ],
                        "type": "string",
                        "description": "Optional Marketplace date-listed filter.",
                        "default": "all"
                    },
                    "availability": {
                        "title": "Availability",
                        "enum": [
                            "in_stock",
                            "sold",
                            "all"
                        ],
                        "type": "string",
                        "description": "Optional listing availability filter.",
                        "default": "in_stock"
                    },
                    "startCursor": {
                        "title": "Start cursor",
                        "type": "string",
                        "description": "Optional provider pagination cursor from RUN_SUMMARY.nextCursors."
                    },
                    "dataSource": {
                        "title": "Data source",
                        "enum": [
                            "auto",
                            "provider"
                        ],
                        "type": "string",
                        "description": "Provider mode uses configured ScrapeCreators or SociaVault APIs. Auto currently resolves to provider mode because Facebook Marketplace is login-heavy.",
                        "default": "auto"
                    },
                    "providerOrder": {
                        "title": "Provider order",
                        "enum": [
                            "scrapecreators-first",
                            "sociavault-first",
                            "scrapecreators-only",
                            "sociavault-only"
                        ],
                        "type": "string",
                        "description": "Choose which managed provider API is tried first.",
                        "default": "scrapecreators-first"
                    },
                    "includeItemDetails": {
                        "title": "Include item details",
                        "type": "boolean",
                        "description": "Fetch detailed item records for each search listing. This costs one item-detail provider request per listing.",
                        "default": false
                    },
                    "includeLocationResults": {
                        "title": "Include location results",
                        "type": "boolean",
                        "description": "Save location lookup results to the dataset when location query is used.",
                        "default": true
                    },
                    "includeRawData": {
                        "title": "Include raw provider data",
                        "type": "boolean",
                        "description": "Include raw source objects in each dataset row for debugging and custom downstream parsing.",
                        "default": false
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
