{
  "openapi": "3.0.1",
  "info": {
    "title": "Blocket Scraper: Car Monitor",
    "description": "Blocket scraper: each run returns up to 2,500 Blocket Bil and Torget listings as flat rows with price, make, model, year, mileage, VIN, inspections and seller. Monitor mode adds new, changed and removed since last run.",
    "version": "0.1",
    "x-build-id": "GGmwxSDrd8mimUMGb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/redomic~blocket-se-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-redomic-blocket-se-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/redomic~blocket-se-scraper/runs": {
      "post": {
        "operationId": "runs-sync-redomic-blocket-se-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/redomic~blocket-se-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-redomic-blocket-se-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "detail",
              "monitor"
            ],
            "type": "string",
            "description": "search = listings, detail = full pages for specific ads, monitor = new/changed/removed since last run.",
            "default": "search"
          },
          "queries": {
            "title": "Queries",
            "type": "array",
            "description": "Keyword searches. Each item can set its own vertical (car, torget or all).",
            "items": {
              "type": "object",
              "properties": {
                "query": {
                  "title": "Keyword",
                  "type": "string",
                  "description": "Keyword to search, or a Blocket search/ad URL.",
                  "editor": "textfield"
                },
                "vertical": {
                  "title": "Vertical",
                  "type": "string",
                  "description": "car = Blocket Bil cars, torget = Torget marketplace, all = both.",
                  "enum": [
                    "car",
                    "torget",
                    "all"
                  ]
                }
              }
            }
          },
          "query": {
            "title": "Query",
            "type": "string",
            "description": "Single keyword (used when queries is empty)."
          },
          "vertical": {
            "title": "Vertical",
            "enum": [
              "car",
              "torget",
              "all"
            ],
            "type": "string",
            "description": "car = Blocket Bil cars, torget = Torget marketplace, all = both.",
            "default": "car"
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Past Blocket search, ad or dealer page URLs (a dealer page, e.g. https://www.blocket.se/mobility/dealer/7903992/riddermark-bil-goteborg, returns that dealer's whole car inventory).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "dealerOrgIds": {
            "title": "Dealer org IDs",
            "type": "array",
            "description": "Blocket dealer IDs (the number in a dealer page URL, also the sellerId on business rows). Each returns that dealer's full car inventory; use monitor mode to track what a competitor adds, reprices and sells.",
            "items": {
              "type": "string"
            }
          },
          "listingUrls": {
            "title": "Listing URLs",
            "type": "array",
            "description": "Specific ad URLs to fetch in detail (also used with mode search/monitor).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "listingIds": {
            "title": "Listing IDs",
            "type": "array",
            "description": "Blocket ad IDs, e.g. 26371427. Prefix with torget: for Torget ads, e.g. torget:28099024. Unprefixed IDs are car ads."
          },
          "priceMin": {
            "title": "Min price (SEK)",
            "type": "integer",
            "description": "Keep listings priced at or above this value."
          },
          "priceMax": {
            "title": "Max price (SEK)",
            "type": "integer",
            "description": "Keep listings priced at or below this value."
          },
          "priceType": {
            "title": "Price type",
            "type": "array",
            "description": "Keep only listings with these price types: fixed (priced), auction, or request (price on request/free). Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "fixed",
                "auction",
                "request"
              ]
            }
          },
          "yearMin": {
            "title": "Min model year (cars)",
            "type": "integer",
            "description": "Keep cars with model year at or after this value."
          },
          "yearMax": {
            "title": "Max model year (cars)",
            "type": "integer",
            "description": "Keep cars with model year at or before this value."
          },
          "publishedWithinDays": {
            "title": "Published within days",
            "minimum": 1,
            "type": "integer",
            "description": "Keep only listings published within the last N days (applied to postedAt, e.g. 1, 3, 7 or 9)."
          },
          "mileageMin": {
            "title": "Min mileage (mil)",
            "type": "integer",
            "description": "Keep cars with mileage at or above this value, in mil (Swedish miles, 1 mil = 10 km; e.g. 2000 mil = 20,000 km)."
          },
          "mileageMax": {
            "title": "Max mileage (mil)",
            "type": "integer",
            "description": "Keep cars with mileage at or below this value, in mil (Swedish miles, 1 mil = 10 km; e.g. 2000 mil = 20,000 km)."
          },
          "bodyType": {
            "title": "Body type (cars)",
            "type": "string",
            "description": "Kombi, Sedan, SUV, Halvkombi 5-dörrar, Halvkombi 3-dörrar, Familjebuss, Coupé, Cabriolet, Pickup, Skåpbil or Annat - or the numeric code Blocket shows in URLs (e.g. Kombi = 4)."
          },
          "location": {
            "title": "Location (cars)",
            "type": "string",
            "description": "Swedish region name (e.g. Stockholm, Skåne, Västra Götaland) or Blocket region/city code (e.g. 0.300001 for Stockholm län, 1.300001.310180 for Stockholm kommun)."
          },
          "fuel": {
            "title": "Fuel (cars)",
            "type": "string",
            "description": "Bensin, Diesel, El, Hybrid bensin, Hybrid diesel, Plugin bensin, Plugin diesel, Etanol, Fordonsgas, Vätgas - or the numeric code Blocket shows in URLs."
          },
          "transmission": {
            "title": "Transmission (cars)",
            "type": "string",
            "description": "Manuell, Automatisk or Sekventiell - or the numeric code."
          },
          "dealerSegment": {
            "title": "Seller type (cars)",
            "type": "string",
            "description": "Företag (company/dealer) or Privat (private) - or the numeric code."
          },
          "salesForm": {
            "title": "Sales form (cars)",
            "type": "string",
            "description": "Begagnad (used), Ny (new) or Leasing - or the numeric code."
          },
          "sort": {
            "title": "Sort",
            "enum": [
              "published_desc",
              "price_asc",
              "price_desc",
              "year_desc",
              "year_asc",
              "mileage_asc",
              "mileage_desc",
              "relevance"
            ],
            "type": "string",
            "description": "Sort order for results.",
            "default": "published_desc"
          },
          "scrapeDetails": {
            "title": "Scrape details",
            "type": "boolean",
            "description": "Fetch each listing page in search mode for full specs (inspection dates, equipment). Slower; monitor mode stays list-only. While off, detail-only fields are omitted from rows entirely (no blank CSV columns).",
            "default": false
          },
          "compareToMarket": {
            "title": "Compare to market",
            "type": "boolean",
            "description": "Add in-run below-market valuation (no extra requests): marketValue is the median price of at least 5 priced listings with the same make and model in this run, with priceVsMarketSek, priceVsMarketPct, marketComparables, marketConfidence and redFlags on each row.",
            "default": true
          },
          "onlyBelowMarketPct": {
            "title": "Only below market (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Keep only rows priced at least this many percent below marketValue (e.g. 10 keeps rows at -10% or cheaper). Rows without a market comparison are dropped while this filter is set. Red-flagged rows are dropped unless includeRedFlagged is true."
          },
          "onlyBelowMarketSek": {
            "title": "Only below market (SEK)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only rows priced at least this many SEK below marketValue. Rows without a market comparison are dropped while this filter is set. Red-flagged rows are dropped unless includeRedFlagged is true."
          },
          "includeRedFlagged": {
            "title": "Include red-flagged",
            "type": "boolean",
            "description": "When a below-market filter is set, red-flagged rows (motorfel, växellådsfel, körförbud, startar ej, krockskadad, reservdelar, or priced under 35% of market) are dropped unless this is true. Unfiltered runs always return them with redFlags set.",
            "default": false
          },
          "partition": {
            "title": "Auto-partition past the ceiling",
            "type": "boolean",
            "description": "When a search hits Blocket's 2,500-per-query ceiling and maxItems asks for more, automatically split the query into price bands (recursively halved to a 2,000-match safe cap per band), collect and dedupe by ad ID, and report partitions plus expected-vs-collected in the status row. Default true; set false to keep the old stop-at-2,500 behaviour.",
            "default": true
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Upper limit on rows returned per run. 2,500 is Blocket's per-query ceiling; with partition true the run can collect beyond it up to this limit.",
            "default": 100
          },
          "includeRemoved": {
            "title": "Include removed (monitor)",
            "type": "boolean",
            "description": "In monitor mode, include listings that disappeared since the previous run as removed rows. Set false to report only new and changed listings; state still tracks removals so nothing is re-reported later.",
            "default": true
          },
          "proxy": {
            "title": "Proxy",
            "type": "object",
            "description": "Proxy settings.",
            "default": {
              "useApifyProxy": true
            }
          },
          "onlyWithImages": {
            "title": "Only with images",
            "type": "boolean",
            "description": "Keep only listings that have at least one photo (imagesCount > 0).",
            "default": false
          },
          "shippingOnly": {
            "title": "Shipping only (Blocket Frakt)",
            "type": "boolean",
            "description": "Keep only listings where the seller offers Blocket Frakt (shipping).",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}