How to scrape Facebook Marketplace with an API (Python)
Send GET /v1/facebook/marketplace-search with a keyword (q) and a city (searchLocation) and you get public Facebook Marketplace listings back as JSON. You don't run a browser, proxies or a Facebook login.
This guide shows a first search in Python, cursor pagination, a small price tracker that stores results in SQLite, and the things that usually break a Marketplace scraper.
1. Set up
Create a free account (100 credits, no card), copy your API key from the dashboard and put it in an environment variable.
pip install requests
export CAPTAPI_KEY="capt_live_..."2. Run your first search
The script below searches for desk chairs under $100 in Austin, newest first, and prints each listing's price, status, title and URL.
import os
import requests
resp = requests.get(
"https://api.captapi.com/v1/facebook/marketplace-search",
params={
"q": "desk chair",
"searchLocation": "Austin, TX",
"maxPrice": 100,
"sortBy": "creation_time",
},
headers={"Authorization": f"Bearer {os.environ['CAPTAPI_KEY']}"},
timeout=120, # a cold search can take about 50 seconds
)
resp.raise_for_status()
data = resp.json()
for item in data["listings"]:
# priceAmount is in minor units: 1500 = $15.00
print(item["priceAmount"] / 100, item["currency"], item["status"], item["title"], item["url"])
# Next page: send cursor=data["nextCursor"] while data["hasMore"] is trueA real response, captured from the live API in October 2026 and trimmed to two listings. We left out seller fields and the signed image URLs before publishing it.
{
"query": "desk chair",
"searchLocation": "Austin, TX",
"totalReturned": 2,
"hasMore": false,
"nextCursor": null,
"listings": [
{
"platform": "facebook",
"id": "1636174394632757",
"title": "Desk chair",
"url": "https://www.facebook.com/marketplace/item/1636174394632757/",
"price": 15,
"priceFormatted": "$15",
"priceAmount": 1500,
"currency": "USD",
"categoryId": "1583634935226685",
"cityPageId": "106224666074625",
"status": "available",
"isSold": false,
"isPending": false,
"deliveryTypes": [
"IN_PERSON",
"DOOR_PICKUP"
],
"createdAt": "2026-10-19T13:55:33+00:00",
"location": {
"name": "Austin, TX",
"city": "Austin",
"state": "TX",
"countryCode": "US",
"latitude": null,
"longitude": null
},
"mediaUrlsExpireAt": "2026-10-24T00:31:26.000Z",
"isLocal": true
},
{
"platform": "facebook",
"id": "3064200493923408",
"title": "Little desk chair",
"url": "https://www.facebook.com/marketplace/item/3064200493923408/",
"price": 15,
"priceFormatted": "$15",
"priceAmount": 1500,
"currency": "USD",
"categoryId": "1583634935226685",
"cityPageId": "106224666074625",
"status": "available",
"isSold": false,
"isPending": false,
"deliveryTypes": [
"IN_PERSON"
],
"createdAt": "2026-10-19T02:56:33+00:00",
"location": {
"name": "Austin, TX",
"city": "Austin",
"state": "TX",
"countryCode": "US",
"latitude": null,
"longitude": null
},
"mediaUrlsExpireAt": "2026-10-24T00:11:21.000Z",
"isLocal": true
}
]
}Every field and filter (minPrice, maxPrice, sortBy, daysSinceListed, condition, deliveryMethod, radiusMiles, category) is documented on the Facebook Marketplace API page.
3. Page through results
A response carries hasMore and nextCursor. Send the cursor back with the same query to get the next page. Cap the number of pages: each page is a billed call.
import os
import requests
API = "https://api.captapi.com/v1/facebook/marketplace-search"
HEADERS = {"Authorization": f"Bearer {os.environ['CAPTAPI_KEY']}"}
def search_all(q, city, max_pages=5, **filters):
"""Yield listings page by page. Each page is one billed call."""
params = {"q": q, "searchLocation": city, **filters}
for _ in range(max_pages):
resp = requests.get(API, params=params, headers=HEADERS, timeout=120)
resp.raise_for_status()
data = resp.json()
yield from data["listings"]
if not data["hasMore"]:
break
params = {"q": q, "searchLocation": city, "cursor": data["nextCursor"], **filters}
for item in search_all("road bike", "Denver, CO", maxPrice=800):
print(item["id"], item["priceAmount"] / 100, item["title"])4. Track prices every day
Run this once a day (cron, a scheduled job, anything). It keeps one row per listing id and prints new listings, price drops and status changes such as available to pending or sold.
import os
import sqlite3
import requests
API = "https://api.captapi.com/v1/facebook/marketplace-search"
HEADERS = {"Authorization": f"Bearer {os.environ['CAPTAPI_KEY']}"}
db = sqlite3.connect("marketplace.db")
db.execute(
"CREATE TABLE IF NOT EXISTS listing ("
" id TEXT PRIMARY KEY, title TEXT, url TEXT,"
" price_amount INTEGER, currency TEXT, status TEXT, seen_at TEXT)"
)
resp = requests.get(
API,
params={
"q": "standing desk",
"searchLocation": "Seattle, WA",
"sortBy": "creation_time",
"daysSinceListed": "1",
},
headers=HEADERS,
timeout=120,
)
resp.raise_for_status()
for item in resp.json()["listings"]:
row = db.execute(
"SELECT price_amount, status FROM listing WHERE id = ?", (item["id"],)
).fetchone()
if row is None:
print("NEW", item["priceAmount"] / 100, item["title"], item["url"])
elif item["priceAmount"] < row[0]:
print("PRICE DROP", row[0] / 100, "->", item["priceAmount"] / 100, item["title"])
elif item["status"] != row[1]:
print("STATUS", row[1], "->", item["status"], item["title"])
db.execute(
"INSERT INTO listing VALUES (?, ?, ?, ?, ?, ?, datetime('now'))"
" ON CONFLICT(id) DO UPDATE SET price_amount = excluded.price_amount,"
" status = excluded.status, seen_at = excluded.seen_at",
(item["id"], item["title"], item["url"], item["priceAmount"],
item["currency"], item["status"]),
)
db.commit()What breaks Marketplace scrapers
- The city. Search needs a location, and city names are ambiguous: Austin, TX and Austin, MN are different searches. Resolve the name first with location search and use the place you meant.
curl -G "https://api.captapi.com/v1/facebook/marketplace-location-search" \
--data-urlencode "q=Austin" \
-H "Authorization: Bearer $CAPTAPI_KEY"- Slow pages. A search usually takes about 28 seconds and up to about 50 when cold. Default HTTP timeouts of 10 or 30 seconds cut it off. Use 120 seconds and read
timings.fetchMsif you want to log it. - Expiring images. Image URLs are signed and stop working after a few days;
mediaUrlsExpireAttells you when. Store the listing id and refetch, or download the image right away. - Shipped and broadened results. Facebook mixes shipped listings into local searches and can broaden your keyword. Use
isLocalordeliveryMethod=local_pickupto keep local pickups, and filter titles on your side when you need exact matches. - Prices in minor units.
priceAmountis an integer in cents (1500 is $15.00). Compare integers, not the formatted string. - The login wall. Only what a logged-out visitor sees is available: no messages, no saved items, no seller contact details. Description, condition and coordinates need
details=trueor the item endpoint.
What it costs
Each search page is 2 credits. With details=true it is 2 plus 2 for each enriched listing. A search with no matching listings and a failed call cost 0. Plans start at $29/mo for 18k credits; the daily tracker above uses about 60 credits a month. See pricing.
Questions
Is there an official Facebook Marketplace API for reading listings?
Not one that any developer can sign up for. Meta's Marketplace Partnerships APIs upload, update or delete listings for eligible partners, and Meta Content Library search is limited to approved researchers (Meta developer docs, read 2026-11-16). The Facebook Marketplace API page has the links.
Do I need a Facebook account to scrape Marketplace this way?
No. The API reads only what Facebook shows to a logged-out visitor, with no account and no cookies. You need a Captapi API key.
How much does one Marketplace search cost?
2 credits per call. details=true adds 2 credits per enriched listing. A search with no matching listings and a failed call cost 0.
Why do I get listings from outside my city?
Facebook mixes in shipped listings, and radiusMiles does not remove them. Check isLocal on each row, or pass deliveryMethod=local_pickup for nearby-only results.
Try it with 100 free credits
That is 50 Marketplace searches. No card needed.