# BrickLink Scraper - LEGO Catalog & Price Guide (`jongoose/bricklink-scraper`) Actor

Scrape the BrickLink LEGO catalog + price guide: item no, name, type, category, image, and current-market New/Used min, average, qty-average & max prices with quantities and seller counts. Search by keyword and item type (Set/Part/Minifig/Book). No account or API key.

- **URL**: https://apify.com/jongoose/bricklink-scraper.md
- **Developed by:** [James Scott](https://apify.com/jongoose) (community)
- **Categories:** E-commerce, Lead generation
- **Stats:** 3 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## BrickLink Scraper - LEGO Catalog & Price Guide

Scrape the **BrickLink** LEGO catalog and its **price guide** into clean, structured data - no BrickLink account or API key required. For every catalog item you get its identity (number, name, type, category, image) plus the **current-market price guide**: New and Used **min / average / qty-average / max** prices, quantities and seller counts, computed from every live listing.

### What you get (per item)
- **Item number** (`75300-1`, `3001`, `sw0599`), **name**, **type** (Set / Part / Minifig / Book / Gear / ...), **BrickLink category id**
- Canonical **catalog URL** and **image URL**
- **Currency** (`USD` - all prices are BrickLink's US$-normalized figures)
- **New** price guide: `newMinPrice`, `newAvgPrice`, `newQtyAvgPrice`, `newMaxPrice`, `newTotalQty`, `newLots`, `newSellerCount`
- **Used** price guide: `usedMinPrice`, `usedAvgPrice`, `usedQtyAvgPrice`, `usedMaxPrice`, `usedTotalQty`, `usedLots`, `usedSellerCount`
- `priceGuideSource` - `current_market` when the detailed per-item price guide was fetched, else `search_summary` (min/max/qty only)

The New/Used min-average-qty-average-max figures mirror BrickLink's **"Current Items for Sale"** price-guide tables - the numbers resellers price against day to day.

### Input
- **Search keyword** - e.g. `star wars`, `millennium falcon`, `75300`, or a part number like `3001`.
- **Item type** - Set, Part, Minifig, Book, Gear, Catalog, Instruction, or **Any** (scans Set/Part/Minifig/Book).
- **BrickLink search URLs** - or paste catalog/search URLs; the keyword is read from each URL's `?q=` parameter.
- **Fetch detailed price guide per item** - ON (default) computes exact averages from every live listing (one extra bounded request per item); OFF keeps only the search min/max/qty summary (faster/cheaper).
- **Max items** caps the run.

#### Example input
```json
{
  "query": "star wars",
  "itemType": "S",
  "priceGuideDetail": true,
  "maxItems": 200,
  "proxyConfiguration": { "useApifyProxy": true }
}
````

#### Example output record (real, live)

```json
{
  "itemNo": "75407-1",
  "itemName": "Brick-Built Star Wars Logo",
  "itemType": "Set",
  "itemTypeCode": "S",
  "categoryId": "65.169",
  "yearReleased": null,
  "url": "https://www.bricklink.com/v2/catalog/catalogitem.page?S=75407-1",
  "imageUrl": "https://img.bricklink.com/ItemImage/SN/0/75407-1.png",
  "currency": "USD",
  "newMinPrice": 38.34,
  "newAvgPrice": 67.1586,
  "newQtyAvgPrice": 65.4792,
  "newMaxPrice": 120.55,
  "newTotalQty": 272,
  "newLots": 104,
  "newSellerCount": 101,
  "usedMinPrice": 29.99,
  "usedAvgPrice": 41.268,
  "usedQtyAvgPrice": 41.268,
  "usedMaxPrice": 57.16,
  "usedTotalQty": 5,
  "usedLots": 5,
  "usedSellerCount": 4,
  "priceGuideSource": "current_market",
  "priceGuideSampled": false,
  "soldPriceGuide": null,
  "scrapedFrom": "bricklink.com"
}
```

### How it works

- **Search** - `GET /ajax/clone/search/searchproduct.ajax` paginates the catalog for your keyword + item type. Each row already carries a current New/Used min-max-qty-seller summary.
- **Price guide** - for each item, one bounded `GET /ajax/clone/catalogifs.ajax` pulls the whole current for-sale book (up to 500 listings, price-sorted), and the actor computes the New/Used min/avg/qty-avg/max/total-qty/lots.

Both are BrickLink's own internal JSON handlers, so the actor parses **structured JSON, not brittle CSS**, and runs on Apify's default **datacenter** proxy (no pricey residential proxy).

### Known limitation - historical "sold" data

BrickLink's **"Last 6 Months Sold"** price-guide quadrants live only on the classic `catalogPG.asp` page, which is protected by an **AWS WAF JavaScript challenge** and cannot be reached by a plain HTTP client. This actor therefore captures the **current-market** price guide (live listings) and emits `soldPriceGuide` as `null`. Adding sold data would require a headless browser to solve the WAF challenge and mint an `aws-waf-token` cookie before calling `catalogPG.asp`; it is intentionally out of scope for this JSON-only, proxy-light actor.

`yearReleased` is likewise only on the WAF-gated detail page and is emitted as `null`; `categoryId` is BrickLink's stable catalog category identifier (name resolution also requires the gated catalog).

### Why this actor

- **Real price intelligence:** New/Used averages, ranges, quantities and seller depth for any LEGO set, part or minifig.
- **Fast + cheap:** BrickLink's own JSON, one bounded request per item, default datacenter proxy.
- **Durable:** structured JSON handlers, not CSS selectors.
- Export as JSON, CSV, or Excel, or pull via the Apify API.

Great for **LEGO resellers, collectors and analysts** doing pricing, sell-through and inventory-valuation research.

This is public catalog data provided for research; it is **not** affiliated with or endorsed by BrickLink or the LEGO Group.

# Actor input Schema

## `query` (type: `string`):

Keyword to search the BrickLink catalog for, e.g. "star wars", "75300", "millennium falcon", or a part number like "3001". Leave empty (and provide no Start URLs) to browse the whole catalog for the chosen item type.

## `itemType` (type: `string`):

Which BrickLink catalog type to search. Choose "Any" to scan Sets, Parts, Minifigs and Books.

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

Optional. Paste one or more BrickLink search/catalog URLs; a keyword is derived from each URL's ?q= parameter or its last path segment. Leave empty to search by the Keyword above.

## `priceGuideDetail` (type: `boolean`):

ON (recommended): make one extra bounded request per item to compute exact current-market New/Used min, average, qty-average and max prices from every live listing. OFF: faster/cheaper - keep only the min/max/qty summary that comes with search results (no averages).

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

Stop after collecting this many catalog items.

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

BrickLink's catalog JSON works fine through Apify's default (datacenter) proxy - no residential proxy needed.

## Actor input object example

```json
{
  "query": "star wars",
  "itemType": "S",
  "startUrls": [],
  "priceGuideDetail": true,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "query": "star wars",
    "startUrls": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("jongoose/bricklink-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 = {
    "query": "star wars",
    "startUrls": [],
}

# Run the Actor and wait for it to finish
run = client.actor("jongoose/bricklink-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "star wars",
  "startUrls": []
}' |
apify call jongoose/bricklink-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=jongoose/bricklink-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "BrickLink Scraper - LEGO Catalog & Price Guide",
        "description": "Scrape the BrickLink LEGO catalog + price guide: item no, name, type, category, image, and current-market New/Used min, average, qty-average & max prices with quantities and seller counts. Search by keyword and item type (Set/Part/Minifig/Book). No account or API key.",
        "version": "0.1",
        "x-build-id": "wCeOh7p0gia8dOfiU"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/jongoose~bricklink-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-jongoose-bricklink-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/jongoose~bricklink-scraper/runs": {
            "post": {
                "operationId": "runs-sync-jongoose-bricklink-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/jongoose~bricklink-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-jongoose-bricklink-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": {
                    "query": {
                        "title": "Search keyword",
                        "type": "string",
                        "description": "Keyword to search the BrickLink catalog for, e.g. \"star wars\", \"75300\", \"millennium falcon\", or a part number like \"3001\". Leave empty (and provide no Start URLs) to browse the whole catalog for the chosen item type."
                    },
                    "itemType": {
                        "title": "Item type",
                        "enum": [
                            "S",
                            "P",
                            "M",
                            "B",
                            "G",
                            "C",
                            "I",
                            "any"
                        ],
                        "type": "string",
                        "description": "Which BrickLink catalog type to search. Choose \"Any\" to scan Sets, Parts, Minifigs and Books.",
                        "default": "S"
                    },
                    "startUrls": {
                        "title": "BrickLink search URLs",
                        "type": "array",
                        "description": "Optional. Paste one or more BrickLink search/catalog URLs; a keyword is derived from each URL's ?q= parameter or its last path segment. Leave empty to search by the Keyword above.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "priceGuideDetail": {
                        "title": "Fetch detailed price guide per item",
                        "type": "boolean",
                        "description": "ON (recommended): make one extra bounded request per item to compute exact current-market New/Used min, average, qty-average and max prices from every live listing. OFF: faster/cheaper - keep only the min/max/qty summary that comes with search results (no averages).",
                        "default": true
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Stop after collecting this many catalog items.",
                        "default": 100
                    },
                    "proxyConfiguration": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "BrickLink's catalog JSON works fine through Apify's default (datacenter) proxy - no residential proxy needed.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            },
                            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
