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

Scrape Facebook Marketplace listings by search term or category, in any city — title, price, location, photo, delivery options and sold status. No login, cookies or API key.

- **URL**: https://apify.com/xtracto/facebook-marketplace-scraper.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.33 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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 Marketplace Scraper

Scrape Facebook Marketplace listings by search term or category, in any city —
title, price, location, photo, delivery options and sold status. No login, no
cookies, no API key.

### What you get

| Field | Meaning |
|---|---|
| `title`, `customTitle` | Listing title as shown, and the seller's raw text |
| `subtitle` | The grey detail line — mileage on a car, beds on a rental |
| `priceFormatted`, `priceAmount` | `AU$450` and `450.00` — display and numeric |
| `strikethroughPriceFormatted` | Original price, when the seller has cut it |
| `city`, `state`, `locationDisplay` | Where the item is |
| `photoUrl` | Primary listing photo |
| `hasVideo`, `videoId` | Whether the listing has a video, and its id |
| `createdAt` | When it was listed, as UTC |
| `isSold`, `isLive`, `isPending` | Listing state |
| `deliveryTypes` | e.g. `["IN_PERSON"]` |
| `listingUrl` | Direct link to the listing |

### Input

```json
{
  "searchQueries": ["mountain bike"],
  "categories": ["vehicles"],
  "city": "sydney",
  "sortBy": "newest"
}
```

Search terms and categories can be used together or separately; each becomes its
own set of rows.

### Things worth knowing

**The city slug sets the region and the currency.** `sydney` returns AUD and
Australian suburbs, `london` returns GBP and UK towns, `jakarta` returns IDR. Use
the slug Facebook itself uses in the URL.

**An unrecognised city or category is silently redirected.** Facebook answers a
bogus city with a 200 and a full page of listings — from a completely different
feed. Nothing in the response says the location was ignored. This actor compares
where it landed against what you asked for and reports a `redirected` error instead
of handing you plausible-looking data about the wrong place.

**One page is all that is public.** A feed holds roughly 24–32 listings. The page
advertises more through `has_next_page` and a cursor, but spending that cursor
requires a signed-in session, so `maxItemsPerInput` above ~30 will not yield more.
This is a hard limit of the logged-out surface, not a setting.

**The seller is never disclosed.** `marketplace_listing_seller` is present on every
listing and null on every one of them. Seller name, profile and rating are not
available without logging in, so anything that depends on seller identity —
separating dealers from private sellers, for instance — cannot be built on this
data. `sellerName` is included as an explicit null rather than omitted, so the
absence is visible.

**No video URL exists here either.** A listing with a video exposes only its id, so
the actor reports `hasVideo` and `videoId` rather than a playable link it cannot
actually produce.

**Search occasionally bounces to the login page.** Facebook sometimes answers a
search URL with a redirect to `/login` — intermittently, not consistently: the same
query usually succeeds on the next run, and category browsing is affected less often
than search. The actor reports this as `login_walled` with the URL it landed on,
rather than silently returning nothing.

**Use a residential proxy.** Facebook is selective about client IPs; the input
defaults to Apify's residential group.

### Failure reporting

Every input produces at least one row. Failures carry `_error` and `_errorDetail`:

| `_error` | Meaning |
|---|---|
| `no_listings` | The feed rendered but matched nothing |
| `redirected` | Facebook sent the request to a different feed — check the city or category slug |
| `login_walled` | Facebook bounced the route to its login page — intermittent, usually clears on a retry |
| `network_error` | The request never reached Facebook |
| `blocked` | A response arrived but was unusable |

If every feed fails, the run aborts rather than finishing with an empty dataset.

# Actor input Schema

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

What to look for — e.g. 'mountain bike'. Leave empty to browse categories instead.

## `categories` (type: `array`):

Browse a whole category instead of searching. Combined with the city below.

## `city` (type: `string`):

Marketplace city slug — london, sydney, jakarta, sanfrancisco. This sets the region AND the currency. An unrecognised slug is redirected by Facebook to a default feed; the actor detects that and reports it rather than returning listings from the wrong place.

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

Applies to search terms.

## `maxItemsPerInput` (type: `integer`):

One logged-out feed page holds roughly 24–32 listings and there is no way to reach the next page without signing in, so higher values will not yield more.

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

Strongly recommended. Facebook is selective about client IPs; residential is the reliable choice.

## Actor input object example

```json
{
  "searchQueries": [
    "mountain bike"
  ],
  "city": "sydney",
  "sortBy": "best_match",
  "maxItemsPerInput": 24,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One row per scraped record, stored in the run's default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQueries": [
        "mountain bike"
    ],
    "city": "sydney"
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/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": ["mountain bike"],
    "city": "sydney",
}

# Run the Actor and wait for it to finish
run = client.actor("xtracto/facebook-marketplace-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 '{
  "searchQueries": [
    "mountain bike"
  ],
  "city": "sydney"
}' |
apify call xtracto/facebook-marketplace-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xtracto/facebook-marketplace-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/j9q47xxp1VFkqATsl/builds/FsfPfQQYpVBGvAKp3/openapi.json
