POST
/
api
/
scrapers
/
fb-marketplace
/
create-and-run
Create and run a Facebook Marketplace scraper
curl --request POST \
  --url https://app.mrscraper.com/api/scrapers/fb-marketplace/create-and-run \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Test Latest",
  "webhook_url": "https://example.com",
  "pagination": 5,
  "detail": false,
  "zip_codes": [
    "80004",
    "14350",
    "80301"
  ],
  "categories": [
    {
      "name": "Air Conditioners",
      "url": "https://www.facebook.com/marketplace/category/air-conditioners/"
    },
    {
      "name": "Cars",
      "url": "https://www.facebook.com/marketplace/category/cars/"
    },
    {
      "name": "Electronics",
      "url": "https://www.facebook.com/marketplace/category/electronics/"
    }
  ]
}'
{
  "message": "Scraping queued successfully",
  "scraper": {
    "id": 387,
    "name": "Facebook Marketplace",
    "url": [
      "https://www.facebook.com/marketplace"
    ],
    "urls": [
      "https://www.facebook.com/marketplace"
    ],
    "scheduled": false,
    "schedule": null,
    "created_at": "2024-09-20T06:50:16.000000Z",
    "updated_at": "2024-09-20T06:50:16.000000Z"
  },
  "results": [
    {
      "scraping_run_id": 1026,
      "user_id": 26,
      "scraper_name": "Test Latest",
      "scrapped_url": "80004\n14350\n80301",
      "scraped_url": "80004\n14350\n80301",
      "scraper_id": 387,
      "status": "running",
      "updated_at": "2024-09-20T06:50:17.000000Z",
      "created_at": "2024-09-20T06:50:16.000000Z",
      "id": 1291,
      "scraper": {
        "id": 387,
        "user_id": 26,
        "sharing": false,
        "share_uuid": null,
        "name": "Test Latest",
        "type": "fb_marketplace",
        "urls": "https://www.facebook.com/marketplace",
        "pdf_urls": "Default",
        "ai_prompt": null,
        "ai_scope": null,
        "headers": null,
        "cookies": null,
        "user_agent": null,
        "disabled_resources": null,
        "delay": 0,
        "html_wanted": false,
        "screenshot_wanted": false,
        "screenshot_type": null,
        "locale": null,
        "scheduled": false,
        "cron": null,
        "cron_timezone": "UTC",
        "paginate": 0,
        "pagination_type": null,
        "infinite_pagination_type": null,
        "infinite_pagination_seconds": null,
        "infinite_pagination_text": null,
        "infinite_pagination_css_selector": null,
        "infinite_pagination_n_selector": null,
        "load_more_selector": null,
        "pagination_query_parameter": null,
        "pagination_next_page_selector": null,
        "pagination_limit_type": null,
        "pagination_max_page": null,
        "max_next_page": null,
        "pagination_max_variable": null,
        "created_at": "2024-09-20T06:50:16.000000Z",
        "updated_at": "2024-09-20T06:50:16.000000Z",
        "cron_minutes": "*",
        "cron_minutes_n_detail": null,
        "cron_minutes_x_detail": null,
        "cron_hours": "*",
        "cron_hours_n_detail": null,
        "cron_hours_x_detail": null,
        "cron_day_of_month": "*",
        "cron_day_of_month_x_detail": null,
        "cron_month": "*",
        "cron_month_x_detail": null,
        "cron_day_of_week": "*",
        "cron_day_of_week_x_detail": null,
        "click_action_enabled": false,
        "click_action_selector": null,
        "click_action_wait": "no",
        "workflow": [
          {
            "type": "options",
            "data": {
              "webhook_url": "https://hooks.zapier.com/hooks/catch/123456/abcdef-example-endpoint",
              "zip_codes": "80004\n14350\n80301",
              "categories": [
                {
                  "type": "category",
                  "data": {
                    "name": "Air Conditioners",
                    "url": "https://www.facebook.com/marketplace/category/air-conditioners/"
                  }
                },
                {
                  "type": "category",
                  "data": {
                    "name": "Cars",
                    "url": "https://www.facebook.com/marketplace/category/cars/"
                  }
                },
                {
                  "type": "category",
                  "data": {
                    "name": "Electronics",
                    "url": "https://www.facebook.com/marketplace/category/electronics/"
                  }
                }
              ]
            }
          }
        ],
        "version": 2,
        "proxy_type": "rotation",
        "proxy_host": null,
        "proxy_port": null,
        "proxy_username": null,
        "proxy_password": null,
        "parsers": null,
        "deleted_at": null
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

You can retrieve your token by visiting the API Tokens section inside your profile page or see https://docs.mrscraper.com/documentation/api-token for the details.

Body

application/json
name
string
required

The name of the scraping task.

Example:

"Test Latest"

zip_codes
string[]
required

The zip codes to scrape.

Example:
["80004", "14350", "80301"]
categories
object[]
required

The categories to scrape

Example:
[
{
"name": "Air Conditioners",
"url": "https://www.facebook.com/marketplace/category/air-conditioners/"
},
{
"name": "Cars",
"url": "https://www.facebook.com/marketplace/category/cars/"
},
{
"name": "Electronics",
"url": "https://www.facebook.com/marketplace/category/electronics/"
}
]
webhook_url
string

The URL to which the scraping results will be sent using POST request.

Example:

"https://example.com"

pagination
number
default:5

Scrape until page.

Example:

5

detail
boolean
default:true

Scrape listed date.

Example:

false

Response

200 - application/json
message
string
Example:

"Scraping queued successfully"

scraper
object
Example:
{
"id": 387,
"name": "Test Latest",
"url": ["https://www.facebook.com/marketplace"],
"urls": ["https://www.facebook.com/marketplace"],
"scheduled": false,
"schedule": null,
"created_at": "2024-09-20T06:50:16.000000Z",
"updated_at": "2024-09-20T06:50:16.000000Z"
}
results
any[]
Example:
[
{
"scraping_run_id": 1026,
"user_id": 26,
"scraper_name": "Test Latest",
"scrapped_url": "80004\n14350\n80301",
"scraped_url": "80004\n14350\n80301",
"scraper_id": 387,
"status": "running",
"updated_at": "2024-09-20T06:50:17.000000Z",
"created_at": "2024-09-20T06:50:16.000000Z",
"id": 1291,
"scraper": {
"id": 387,
"user_id": 26,
"sharing": false,
"share_uuid": null,
"name": "Test Latest",
"type": "fb_marketplace",
"urls": "https://www.facebook.com/marketplace",
"pdf_urls": "Default",
"ai_prompt": null,
"ai_scope": null,
"headers": null,
"cookies": null,
"user_agent": null,
"disabled_resources": null,
"delay": 0,
"html_wanted": false,
"screenshot_wanted": false,
"screenshot_type": null,
"locale": null,
"scheduled": false,
"cron": null,
"cron_timezone": "UTC",
"paginate": 0,
"pagination_type": null,
"infinite_pagination_type": null,
"infinite_pagination_seconds": null,
"infinite_pagination_text": null,
"infinite_pagination_css_selector": null,
"infinite_pagination_n_selector": null,
"load_more_selector": null,
"pagination_query_parameter": null,
"pagination_next_page_selector": null,
"pagination_limit_type": null,
"pagination_max_page": null,
"max_next_page": null,
"pagination_max_variable": null,
"created_at": "2024-09-20T06:50:16.000000Z",
"updated_at": "2024-09-20T06:50:16.000000Z",
"cron_minutes": "*",
"cron_minutes_n_detail": null,
"cron_minutes_x_detail": null,
"cron_hours": "*",
"cron_hours_n_detail": null,
"cron_hours_x_detail": null,
"cron_day_of_month": "*",
"cron_day_of_month_x_detail": null,
"cron_month": "*",
"cron_month_x_detail": null,
"cron_day_of_week": "*",
"cron_day_of_week_x_detail": null,
"click_action_enabled": false,
"click_action_selector": null,
"click_action_wait": "no",
"workflow": [
{
"type": "options",
"data": {
"webhook_url": "https://hooks.zapier.com/hooks/catch/123456/abcdef-example-endpoint",
"zip_codes": "80004\n14350\n80301",
"categories": [
{
"type": "category",
"data": {
"name": "Air Conditioners",
"url": "https://www.facebook.com/marketplace/category/air-conditioners/"
}
},
{
"type": "category",
"data": {
"name": "Cars",
"url": "https://www.facebook.com/marketplace/category/cars/"
}
},
{
"type": "category",
"data": {
"name": "Electronics",
"url": "https://www.facebook.com/marketplace/category/electronics/"
}
}
]
}
}
],
"version": 2,
"proxy_type": "rotation",
"proxy_host": null,
"proxy_port": null,
"proxy_username": null,
"proxy_password": null,
"parsers": null,
"deleted_at": null
}
}
]