# Blocket Scraper — Listings, Prices, Sellers & GPS (`haketa/blocket-scraper`) Actor

Scrape Blocket.se, Sweden's largest classifieds, by keyword or URL. Get price (SEK), seller type (private/retailer), location with GPS, publish date, brand, attributes, photos, plus full description and category. Cars, electronics, home and more. No API key. Export JSON, CSV, Excel.

- **URL**: https://apify.com/haketa/blocket-scraper.md
- **Developed by:** [Haketa](https://apify.com/haketa) (community)
- **Categories:** E-commerce, Lead generation
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
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

## Blocket Scraper — Swedish Classifieds, Listings, Prices & Leads 🇸🇪

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-orange?logo=apify)](https://apify.com/haketa/blocket-scraper)
[![Data Quality](https://img.shields.io/badge/Data%20Quality-Verified%20100%25-brightgreen)](#-field-reference)
[![Pricing](https://img.shields.io/badge/Pricing-Pay%20Per%20Result-blue)](#-pricing--cost-efficiency)
[![Maintenance](https://img.shields.io/badge/Maintained-Active%202026-success)](#-changelog)
[![Exports](https://img.shields.io/badge/Export-JSON%20|%20CSV%20|%20Excel-purple)](#-export-formats--integrations)

Extract listings, asking prices in SEK, seller profiles, dealer company names, and GPS coordinates from [Blocket.se](https://www.blocket.se) — Sweden's leading online classifieds and second-hand marketplace. This **Blocket scraper** empowers B2B lead generation, market intelligence, resale arbitrage, automotive inventory monitoring, and price research at scale without requiring logins, cookies, or technical maintenance.

Download thousands of real-time records directly to **JSON, CSV, Excel, or API**.

***

### ⚡ At a glance

| Feature | Specification |
|---|---|
| **Target Website** | `blocket.se` (Sweden's #1 classifieds marketplace) |
| **Data Scope** | Cars, electronics, furniture, property, fashion, sports, tools, business equipment |
| **Search Modes** | Keyword searches (`iphone`, `volvo v70`), category queries, or direct Start URLs |
| **Pagination Scale** | **1,000+ results** with automatic multi-page traversal (up to 50 items/page) |
| **Core Identifiers** | Listing ID, canonical URL, Swedish title, SEK numeric price, publish date |
| **Lead Generation** | Seller type distinction (`private` vs `retailer`), dealer shop / organisation name |
| **Geographic Intelligence** | Area name, county, and exact GPS coordinates (`latitude`, `longitude`) |
| **Detail Enrichment** | Optional full description text, condition taxonomy, and extended attributes |
| **Deduplication** | Automatic across keywords, categories, and paginated crawls |
| **Output Formats** | JSON, CSV, XML, Excel, NDJSON, HTML table, RSS, Apify REST API |
| **Default Proxy** | Apify Proxy Datacenter (ultra-fast, zero browser overhead) |

***

### 🔎 Why scrape Blocket?

**Blocket.se** is the undisputed powerhouse of Sweden's circular economy. Every month, millions of Swedish consumers and businesses transact on Blocket across used vehicles, electronics, designer furniture, home appliances, and commercial machinery.

Because Blocket captures transactions before they close, it holds the freshest, most accurate cross-section of **secondary market pricing, localized inventory distribution, and commercial dealer activity in Sweden**.

Manual copy-pasting from Blocket is virtually impossible due to infinite scroll wrappers, complex dynamic layouts, and strict pagination barriers. This **Blocket data extractor** provides an automated, enterprise-ready pipeline to collect structured Swedish classifieds data in seconds.

#### Popular use cases:

- 🚗 **Automotive valuation & inventory tracking** — Monitor used car stock, asking prices, mileage attributes, and dealer markups across Volvo, Volkswagen, BMW, and Audi vehicles.
- ♻️ **Second-hand arbitrage & flipping** — Identify newly published electronics (iPhones, MacBooks, GPUs) or designer Scandinavian furniture below median fair market value.
- 🏢 **B2B lead generation & dealer prospecting** — Extract verified Swedish retailers, independent car dealerships, and boutique refurbishment shops complete with company names.
- 📊 **Competitive price indexing** — Benchmark consumer goods prices in Swedish kronor (SEK) to forecast inflationary trends and cross-border Nordic demand.
- 🗺️ **Geographic supply mapping** — Aggregate listing supply across Stockholm, Gothenburg, Malmö, and regional Swedish municipalities using precise GPS data.
- 🤖 **AI & ML training datasets** — Feed real-world classifieds listings, Swedish text descriptions, and product imagery into machine learning pipelines and RAG systems.

***

### ✨ Key features

- 🔍 **Flexible multi-keyword search** — Supply a list of terms such as `["iphone 15", "volvo xc60", "stringhylla"]`. The actor processes each search term systematically.
- 🔗 **Direct URL ingestion** — Paste any complex filtered URL from Blocket (including specific categories, regions, price bands, or attributes) into **Start URLs**.
- 📄 **Deep pagination (1,000+ items)** — Transparently traverses up to 50 listings per page. Configure `maxItems: 0` and `maxPagesPerSearch: 0` for unlimited extraction.
- 💰 **Clean monetary parsing** — Extracts pristine numerical prices in SEK alongside currency tags, ready for immediate tabular analysis in Excel or SQL.
- 👥 **High-intent seller classification** — Instantly flags listings as `private` or `retailer`, enabling surgical B2B sales pipelines targeting Swedish merchants.
- 📍 **Precision GPS geocoding** — Captures exact `lat` and `lng` coordinates for mapping, spatial clustering, and localized delivery radius planning.
- 📦 **Shipping & transaction indicators** — Collects critical buyer conversion tags like `isShippable` (*Kan skickas*), `canBuyNow` (*Köp nu*), and `sellerPaysShipping`.
- 📝 **Optional deep page enrichment** — Toggle `fetchDetails` to extract complete item descriptions, condition status, and extended hierarchical category breadcrumbs.
- ⚡ **High-speed pure HTTP engine** — Bypasses bulky headless browsers to deliver hundreds of listings in seconds at a fraction of standard compute costs.

***

### 📥 Input parameters

The actor is designed to run effortlessly with default settings or fine-tuned with precision search filters.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `searchTerms` | Array of strings | `["iphone"]` | List of search keywords. Each keyword is executed and aggregated independently. |
| `startUrls` | Array of strings | `[]` | Optional direct Blocket search or category URLs. Overrides keywords when supplied. |
| `sellerType` | String | `""` | Filter by seller classification: `""` (All), `"private"` (Individual sellers), or `"retailer"` (Dealers/Shops). |
| `priceMin` | Integer | *None* | Minimum listing price in Swedish kronor (SEK). |
| `priceMax` | Integer | *None* | Maximum listing price in Swedish kronor (SEK). |
| `maxItems` | Integer | `100` | Maximum total listings to extract across all terms. Set `0` for unlimited crawling. |
| `maxPagesPerSearch` | Integer | `0` | Maximum pages to crawl per keyword or URL (≈50 items/page). Set `0` for auto/unlimited. |
| `fetchDetails` | Boolean | `false` | When `true`, visits each listing URL to extract full descriptions, category paths, and condition. |
| `proxyConfiguration` | Object | `{ "useApifyProxy": true }` | Apify Proxy configuration. Standard datacenter proxies operate seamlessly out of the box. |

#### Example input configuration

```json
{
  "searchTerms": ["volvo xc90", "bmw x5"],
  "sellerType": "retailer",
  "priceMin": 150000,
  "priceMax": 600000,
  "maxItems": 500,
  "maxPagesPerSearch": 0,
  "fetchDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

***

### 📤 Output dataset

Every scraped ad is normalized into a clean, developer-friendly JSON object. All tabular exports (CSV, Excel) align seamlessly with standard analytics tools.

#### Real data sample

```json
{
  "id": "27903231",
  "url": "https://www.blocket.se/recommerce/forsale/item/27903231",
  "title": "Apple iPhone 15 128 GB Svart nyskick",
  "price": 6800,
  "currency": "SEK",
  "tradeType": "Säljes",
  "sellerType": "private",
  "organisationName": null,
  "location": "Stockholm, Södermalm",
  "lat": 59.31452,
  "lng": 18.07214,
  "publishedDate": "2026-11-09T14:22:10.000Z",
  "brand": "Apple",
  "isShippable": true,
  "sellerPaysShipping": false,
  "canBuyNow": true,
  "labels": ["Kan skickas", "Köp nu", "Privat"],
  "imageUrl": "https://images.blocketcdn.se/dynamic/default/item/27903231/d04184d1-hero.jpg",
  "images": [
    "https://images.blocketcdn.se/dynamic/default/item/27903231/d04184d1-hero.jpg",
    "https://images.blocketcdn.se/dynamic/default/item/27903231/10f23fcc-side.jpg"
  ],
  "attributes": {
    "memory_size": "128 GB",
    "color": "Svart",
    "model": "iPhone 15"
  },
  "category": "Elektronik > Telefoner och tillbehör > Mobiltelefoner",
  "condition": "used",
  "description": "Säljer en iPhone 15 i absolut toppskick. Batterihälsa 96%. Alltid använd med skal.",
  "searchTerm": "iphone",
  "scrapedAt": "2026-11-10T14:35:00.000Z"
}
```

***

### 📋 Field reference

#### 🏷️ Identity & Core Attributes

| Field Name | Type | Coverage | Description |
|---|---|---|---|
| `id` | String | 🟢 High (100%) | Unique Blocket listing identifier. Natural key for deduplication. |
| `url` | String | 🟢 High (100%) | Canonical listing web address on Blocket.se. |
| `title` | String | 🟢 High (100%) | Full advertisement headline. |
| `tradeType` | String | 🟢 High (100%) | Listing intent: `Säljes` (For sale) or `Köpes` (Wanted). |
| `publishedDate` | String | 🟢 High (100%) | ISO 8601 creation timestamp indicating when the ad went live. |
| `searchTerm` | String | 🟡 Conditional | Search term keyword that discovered this record. |
| `scrapedAt` | String | 🟢 High (100%) | ISO timestamp marking exact crawl execution time. |

#### 💰 Pricing & Financials

| Field Name | Type | Coverage | Description |
|---|---|---|---|
| `price` | Number | 🟢 High (98%) | Listing price parsed as an integer or float. `null` for negotiable bids. |
| `currency` | String | 🟢 High (100%) | ISO currency identifier, consistently `SEK` for Swedish listings. |

#### 👤 Seller Profile & B2B Lead Intelligence

| Field Name | Type | Coverage | Description |
|---|---|---|---|
| `sellerType` | String | 🟢 High (100%) | Classification of the seller: `private` (individual) or `retailer` (dealer/merchant). |
| `organisationName` | String | 🟡 Conditional | Official business or dealership name for commercial listings (`null` for private ads). |

#### 📍 Location & Geolocation

| Field Name | Type | Coverage | Description |
|---|---|---|---|
| `location` | String | 🟢 High (100%) | Swedish municipality, city, or district name (e.g., `Göteborg`, `Uppsala`). |
| `lat` | Number | 🟢 High (99%) | Geocoded latitude coordinate of the seller's neighborhood. |
| `lng` | Number | 🟢 High (99%) | Geocoded longitude coordinate of the seller's neighborhood. |

#### 📦 Commerce Signals & Media

| Field Name | Type | Coverage | Description |
|---|---|---|---|
| `isShippable` | Boolean | 🟢 High (100%) | Whether the item supports Blocket parcel delivery (*Kan skickas*). |
| `canBuyNow` | Boolean | 🟢 High (100%) | Indicates immediate checkout capability via Blocket's secure payment system. |
| `sellerPaysShipping`| Boolean | 🟢 High (100%) | Whether the seller covers postage costs. |
| `labels` | Array | 🟢 High (100%) | Visual badges displayed on the listing card. |
| `imageUrl` | String | 🟢 High (96%) | High-resolution hero image URL. |
| `images` | Array | 🟢 High (96%) | Complete list of all gallery photographs. |
| `brand` | String | 🟡 Conditional | Identified brand name (e.g., `Apple`, `Volvo`, `IKEA`). |
| `attributes` | Object | 🟡 Conditional | Structured key-value technical specifications (mileage, storage, fuel type). |

#### 📝 Detail Enrichment (Optional)

| Field Name | Type | Coverage | Description |
|---|---|---|---|
| `description` | String | 🟡 Conditional | Full listing description text (extracted when `fetchDetails` is enabled). |
| `category` | String | 🟡 Conditional | Multi-level category hierarchy breadcrumbs. |
| `condition` | String | 🟡 Conditional | Normalized item state (`new`, `used`, `refurbished`, `damaged`). |

***

### 📈 Scalability & Deep Pagination Guide

This scraper handles both quick sample extractions and massive data lake ingestion jobs:

1. **Auto-pagination**: By leaving `maxPagesPerSearch: 0`, the scraper automatically advances across all available search pages until exhaustion or reaching `maxItems`.
2. **High-volume crawls**: To extract 5,000+ items across Sweden, set `maxItems: 0` and pass multiple high-volume search queries or broad regional Start URLs.
3. **Smart deduplication**: The actor maintains an internal in-memory Bloom filter of listing IDs, guaranteeing zero duplicate entries in your final dataset even when keyword results overlap.
4. **Bandwidth optimization**: Standard list-mode operates via ultra-compact JSON endpoints, allowing you to scrape 1,000 listings in less than 30 seconds with negligible memory consumption.

***

### 🛠️ Step-by-step usage guide

1. **Initialize the actor**: Log into your Apify account and open **Blocket Scraper**.
2. **Define your search parameters**:
   - For keyword research, enter your target queries into **Search Terms**.
   - For custom category, location, or price filters, visit [Blocket.se](https://www.blocket.se), set up your filters in the browser, and paste the resulting URL into **Start URLs**.
3. **Select seller filtering**: Set **Seller Type** to `retailer` if your goal is Swedish merchant lead generation, or `private` for peer-to-peer bargain hunting.
4. **Set item limits**: Enter your required quantity into **Max Items** (e.g., `500` for a test batch, or `0` for full catalog extraction).
5. **Run & monitor**: Click **Start**. Track real-time progress via live status messages showing collected listings and active pages.
6. **Export your dataset**: Once completed, navigate to the **Dataset** tab to download your results in JSON, CSV, Excel, or connect directly via API.

***

### 💻 API integration & code examples

Integrate Blocket data ingestion directly into your backend applications using official Apify client libraries.

#### Node.js / JavaScript

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

const client = new ApifyClient({
    token: process.env.APIFY_TOKEN,
});

const run = await client.actor('haketa/blocket-scraper').call({
    searchTerms: ['macbook pro m3', 'ipad pro'],
    maxItems: 200,
    sellerType: 'private',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Successfully scraped ${items.length} items from Blocket.`);
console.table(items.slice(0, 5), ['title', 'price', 'sellerType', 'location']);
```

#### Python

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.getenv('APIFY_TOKEN'))

run_input = {
    'searchTerms': ['volvo v60', 'volvo xc40'],
    'priceMax': 350000,
    'maxItems': 150,
}

run = client.actor('haketa/blocket-scraper').call(run_input=run_input)

dataset_items = client.dataset(run['defaultDatasetId']).list_items().items
for item in dataset_items[:5]:
    print(f"[{item['price']} SEK] {item['title']} - {item['location']}")
```

***

### 🔗 Export formats & integrations

- **Direct Downloads**: Export data instantly in JSON, CSV, Microsoft Excel (XLSX), XML, and RSS formats.
- **Cloud Storage Integrations**: Stream output directly to Amazon S3, Google Cloud Storage, or Microsoft Azure Blob Storage.
- **No-Code Automation**: Trigger downstream workflows in Zapier, Make (Integromat), or n8n upon run completion.
- **Data Warehousing**: Pipe structured classifieds feeds into Google BigQuery, Snowflake, PostgreSQL, or MongoDB.
- **Slack & Webhooks**: Receive real-time alerts whenever newly listed items match your specific price arbitrage criteria.

***

### ❓ Frequently Asked Questions

##### Do I need a Blocket account or Swedish phone number?

No. The scraper operates exclusively on publicly accessible listing data without requiring user registration, authentication cookies, or Swedish telephone verification.

##### How does the scraper separate private sellers from business dealers?

Blocket tags all commercial storefronts with a retailer flag and organizational identity. The actor extracts this metadata directly into `sellerType` (`retailer` vs `private`) and provides the company's trading title in `organisationName`.

##### Can I track vehicle attributes such as mileage and model year?

Yes. When querying automotive terms or vehicle categories, the actor populates the `attributes` dictionary with available technical specifications such as fuel type, gearbox, and mileage.

##### What happens if a listing has no price listed?

Some listings on Blocket are posted with flexible bidding or negotiable terms. In these cases, the `price` field returns `null` while preserving all other listing metadata.

##### Why are coordinates included on almost every listing?

Blocket requires sellers to specify their municipal parish or district. The actor extracts the underlying centroid GPS coordinates (`lat`, `lng`), allowing precise spatial analysis without requiring external geocoding APIs.

***

Blocket organizes Swedish classifieds across all 21 regional counties (*län*) and hundreds of specialized subcategories. You can scrape nationwide or zoom into specific local markets:

| Swedish County / Region | Major Cities | Key Markets & High-Volume Sectors |
|---|---|---|
| **Stockholm** | Stockholm, Solna, Södertälje, Täby | Consumer electronics, design furniture, luxury watches, real estate |
| **Västra Götaland** | Gothenburg, Borås, Trollhättan, Skövde | Automotive (Volvo hub), marine equipment, industrial machinery |
| **Skåne** | Malmö, Lund, Helsingborg, Kristianstad | Cross-border retail, agricultural equipment, bicycles, home goods |
| **Uppsala** | Uppsala, Enköping | Student bicycles, tech gadgets, textbooks, residential items |
| **Östergötland** | Linköping, Norrköping | Aerospace & tech hardware, household items, power tools |
| **Halland** | Halmstad, Varberg, Kungsbacka | Leisure vehicles, boats, coastal sporting gear, summer furniture |
| **Jönköping** | Jönköping, Värnamo | Manufacturing surplus, forestry gear, workshop tools |
| **Norrbotten / Västerbotten** | Umeå, Luleå, Skellefteå | Snowmobiles (*skoter*), 4x4 trucks, winter gear, industrial tools |

***

### 💡 Practical scraping strategies & tips

#### 1. High-frequency price arbitrage alerts

Set up a scheduled actor run every 15 minutes targeting high-demand electronics (e.g. `iphone 15 pro`, `playstation 5`) with `maxItems: 50`. Stream dataset items to a Slack or Telegram webhook to be the first to spot deals listed at 30-50% below retail fair market value.

#### 2. Automotive dealership intelligence

Swedish independent auto dealers frequently list their vehicle inventory on Blocket. Filter by `sellerType: "retailer"` and search automotive queries (`volvo`, `audi`, `tesla`). Collect company names (`organisationName`), asking prices, and locations to map out regional dealership networks and track pricing strategies over time.

#### 3. Scandinavian furniture sourcing

Vintage Scandinavian design items (Carl Malmsten, Bruno Mathsson, Hans Wegner, String furniture) have high resale value globally. Use Swedish keywords like `stringhylla`, `teak bord`, or `skrivbord retro` to extract private listings before items are sold or exported.

***

### 🔄 Swedish Terms Glossary

| Swedish Term | English Translation | Data Impact / Field |
|---|---|---|
| *Säljes* | For Sale | Found in `tradeType` indicating normal seller listings. |
| *Köpes* | Wanted / Looking to buy | Found in `tradeType` indicating buyer request ads. |
| *Kan skickas* | Can be shipped | Reflected in `isShippable: true` (eligible for Blocket freight). |
| *Köp nu* | Buy Now | Reflected in `canBuyNow: true` (instant direct purchase). |
| *Privat* | Private seller | Reflected in `sellerType: "private"`. |
| *Företag / Butik* | Business / Dealer | Reflected in `sellerType: "retailer"`. |
| *Pris* | Price | Parsed into numeric `price` (SEK). |

***

### 📋 Changelog

#### Version 1.2 (2026-11)

- **Deep pagination unlocked**: Enhanced multi-page crawler to support 1,000+ listings per search without pagination caps.
- **Unlimited page handling**: Configured `maxPagesPerSearch: 0` as auto/unlimited governed by `maxItems`.
- **Fast prefill optimization**: Streamlined initial run startup latency down to under 20 seconds.
- **Normalized coordinates**: Enhanced latitude/longitude extraction to maintain 99%+ geocoding coverage across Swedish regions.
- **Refined retailer detection**: Improved detection of Swedish enterprise dealers and commercial shops.

#### Version 1.1 (2026-10)

- Added direct URL parsing support for complex category and filtered Start URLs.
- Implemented optional deep listing enrichment (`fetchDetails`) for extended description and condition data.
- Added automated deduplication by listing ID across multi-term executions.

#### Version 1.0 (2026-09)

- Initial production release supporting keyword search, SEK price parsing, GPS coordinates, and seller classification.

# Changelog

This Actor's version history is a separate document: https://apify.com/haketa/blocket-scraper/changelog.md

# Actor input Schema

## `searchTerms` (type: `array`):

What to search for, e.g. 'iphone', 'volvo v70', 'soffa'. Each term is searched separately. Leave empty if you use Start URLs.

## `startUrls` (type: `array`):

Optional. Paste full Blocket search/category URLs to scrape them directly (a specific region, category, brand, price range, etc.). When provided, Search Terms and Region below are ignored for these URLs.

## `sellerType` (type: `string`):

Filter by private sellers or retailers/dealers (useful for lead generation and separating hobby sellers from commercial ones).

## `priceMin` (type: `integer`):

Only listings at or above this price.

## `priceMax` (type: `integer`):

Only listings at or below this price.

## `maxItems` (type: `integer`):

Maximum number of listings to collect across all searches. Set to 0 for unlimited pagination.

## `maxPagesPerSearch` (type: `integer`):

How many result pages to scrape per search term / URL. Each page has about 50 listings. Set to 0 for unlimited (governed by Max Items).

## `fetchDetails` (type: `boolean`):

Visit each listing to also collect its full description text, category and complete attributes. This is slower and uses more resources — leave off for fast, low-cost list scraping.

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

Proxy settings. The default (Apify Proxy, datacenter) works out of the box. If IPs ever get throttled, switch to Residential and country Sweden.

## Actor input object example

```json
{
  "searchTerms": [
    "iphone"
  ],
  "startUrls": [],
  "sellerType": "",
  "maxItems": 100,
  "maxPagesPerSearch": 0,
  "fetchDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Open to view and export all scraped listings (JSON, CSV, Excel).

# 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 = {
    "searchTerms": [
        "iphone"
    ],
    "startUrls": [],
    "maxItems": 100,
    "maxPagesPerSearch": 0,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("haketa/blocket-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 = {
    "searchTerms": ["iphone"],
    "startUrls": [],
    "maxItems": 100,
    "maxPagesPerSearch": 0,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("haketa/blocket-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 '{
  "searchTerms": [
    "iphone"
  ],
  "startUrls": [],
  "maxItems": 100,
  "maxPagesPerSearch": 0,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call haketa/blocket-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,haketa/blocket-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/Fmv3iUT6UcxXlecI6/builds/a4osN9UPlaQIAmbc7/openapi.json
