{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Marketplace Scraper: listings inside your area",
    "description": "Scrape Facebook Marketplace listings that are really inside the area you ask for (distance computed, not Facebook's radius), past the ~2,400 per search limit, with a returned / duplicates / outside-the-zone / delivered count. Listing pages by URL, new-listing and price-drop monitoring.",
    "version": "0.1",
    "x-build-id": "dzy4Ws3qSTQvL0gXj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alexmorain~facebook-marketplace-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alexmorain-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/alexmorain~facebook-marketplace-scraper/runs": {
      "post": {
        "operationId": "runs-sync-alexmorain-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/alexmorain~facebook-marketplace-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-alexmorain-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": "What to look for, as you would type it in the Marketplace search box: <code>iphone</code>, <code>couch</code>, <code>vélo</code>. Each query is run for each place below.",
            "items": {
              "type": "string"
            }
          },
          "locations": {
            "title": "Places",
            "type": "array",
            "description": "City as <code>New York, NY</code>, <code>Austin, Texas</code>, <code>Paris</code> or <code>Lyon, France</code>. The most populated place of that name is used (add the state or country when a name is shared). Or use latitude and longitude below for an exact center.",
            "items": {
              "type": "string"
            }
          },
          "latitude": {
            "title": "Latitude",
            "minimum": -90,
            "maximum": 90,
            "type": "number",
            "description": "Center of the zone, instead of a place. Give latitude and longitude together."
          },
          "longitude": {
            "title": "Longitude",
            "minimum": -180,
            "maximum": 180,
            "type": "number",
            "description": "Center of the zone, instead of a place."
          },
          "radiusKm": {
            "title": "Radius (km)",
            "minimum": 1,
            "maximum": 500,
            "type": "number",
            "description": "Radius of the zone, in kilometers, around the center. With <b>Strict zone</b> on, only listings placed within this distance are returned. Facebook's own radius filter does not filter anything, so the distance is computed from each listing's city.",
            "default": 40
          },
          "startUrls": {
            "title": "Marketplace search URLs",
            "type": "array",
            "description": "Optional. Search pages copied from your browser, such as <code>https://www.facebook.com/marketplace/austin/search?query=bike&amp;maxPrice=200</code>. The center is read from the page; <code>query</code>, <code>minPrice</code>, <code>maxPrice</code>, <code>daysSinceListed</code>, <code>sortBy</code>, <code>itemCondition</code> and <code>radius</code> of the URL are respected.",
            "items": {
              "type": "string"
            }
          },
          "listingUrls": {
            "title": "Listing URLs or ids",
            "type": "array",
            "description": "Optional. Read single listings: <code>https://www.facebook.com/marketplace/item/1234567890/</code> or the bare id. Always returned with the full listing page (description, condition, exact location, all photos), charged as a detailed listing.",
            "items": {
              "type": "string"
            }
          },
          "minPrice": {
            "title": "Minimum price",
            "minimum": 0,
            "type": "number",
            "description": "In the currency of the zone (dollars, euros...). Applied by Facebook to every search."
          },
          "maxPrice": {
            "title": "Maximum price",
            "minimum": 0,
            "type": "number",
            "description": "In the currency of the zone. Empty = no maximum."
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "relevance",
              "newest",
              "priceLowToHigh",
              "priceHighToLow"
            ],
            "type": "string",
            "description": "Order of the results. <code>newest</code> is the most useful for monitoring.",
            "default": "relevance"
          },
          "daysSinceListed": {
            "title": "Listed in the last N days",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Only listings created in the last N days. Done by the actor on the creation date (Facebook's own date filter does not work anonymously), with the newest-first order so the search stops as soon as results get older."
          },
          "itemCondition": {
            "title": "Condition",
            "enum": [
              "new",
              "used_like_new",
              "used_good",
              "used_fair"
            ],
            "type": "string",
            "description": "Only listings in this condition. Empty = any."
          },
          "strictZone": {
            "title": "Strict zone",
            "type": "boolean",
            "description": "On: only listings really within the radius are returned (and charged). Facebook fills a search with listings from far away cities once the local stock runs out: on a New York search, 55% of what Facebook returns is outside 65 km. Off: everything Facebook returns is delivered, with <code>distanceKm</code> and <code>inZone</code> on each row.",
            "default": true
          },
          "fullCoverage": {
            "title": "Full coverage",
            "type": "boolean",
            "description": "Facebook stops a search at about 100 pages (~2,400 listings) however many exist. On, the price range is split in two at the median, again and again, until every slice fits, so a big city returns tens of thousands of listings. Off, one search: you get Facebook's ~2,400 and a note.",
            "default": true
          },
          "includeDetails": {
            "title": "Listing pages",
            "type": "boolean",
            "description": "Open each listing page for the description, condition, attributes, all photos, seller since date and exact coordinates (the distance is then computed from the exact point). Slower and charged as a detailed listing.",
            "default": false
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 0,
            "type": "integer",
            "description": "Stops after this many listings in total. Empty or 0 = every listing of the zone: tens of thousands for a big city, so set a limit or a maximum charge per run when you test."
          },
          "monitorMode": {
            "title": "Monitoring",
            "enum": [
              "off",
              "newOnly",
              "newAndPriceChanges"
            ],
            "type": "string",
            "description": "<b>New listings only</b> returns only listings not returned by an earlier run with the same input (and monitor name). <b>New and price changes</b> also returns listings whose price moved, with <code>previousPrice</code> and <code>priceChange</code> (up / down). Unchanged listings are neither returned nor charged. The first run returns everything. State is kept in a store named <code>facebook-marketplace-monitor</code> in your account.",
            "default": "off"
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Optional. Separates two monitors that use the same search."
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "Optional. A JSON summary is POSTed here when the run ends with at least one listing. Slack and Discord incoming webhooks work. Redirects are not followed (except 307 / 308)."
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Facebook blocks datacenter IPs: the default is Apify's <b>residential</b> proxy, in the country of the zone (results vary with the proxy country). Change it only if you know why.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}