# LCSC Parts Price Scraper (MPN, Stock, Price Breaks) (`steadfetch/lcsc-parts-price-extractor`) Actor

Look up LCSC electronic components by manufacturer part number or LCSC code: one JSON row per part with its quantity price breaks, stock, warehouse and description, plus price/stock delta in monitor mode. For BOM cost monitoring and component price research. Keyless, no login, no proxies.

- **URL**: https://apify.com/steadfetch/lcsc-parts-price-extractor.md
- **Developed by:** [Steadfetch](https://apify.com/steadfetch) (community)
- **Categories:** E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.60 / 1,000 priced part delivereds

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

## LCSC Parts Price Scraper (MPN, Stock, Price Breaks)

Look up public LCSC electronic component data by manufacturer part number (MPN) or by LCSC part code. Each row carries one part with its quantity price ladder, stock, warehouse split and description, normalized so price-monitoring jobs do not have to parse LCSC pages or manage API keys.

### What it does

- Resolves manufacturer part numbers through LCSC's public catalogue search and part codes (`C25804`) directly, without an API key.
- Returns **one row per part**: the full quantity price ladder stays inside `priceBreaks`, so quantity tiers never create extra billable rows.
- Reads stock, warehouse split (China main / overseas) and the technical description from the same public product page.
- Optional **monitor mode** (`lastRunKey`): compares each part with the previous run, adds `previous` and `delta`, and delivers only parts whose price or stock changed. Unchanged checks are billed 0.
- Parts that are not found, are filtered out, or are unchanged in monitor mode are written to run notes, never to the dataset, so they are never charged.
- Plain HTTP only: no browser, no login, no paywall, no CAPTCHA bypass and no proxies.

### Source and compliance

- Product pages: `https://www.lcsc.com/product-detail/C<code>.html`
- Catalogue search: `https://wmsc.lcsc.com/ftps/wm/search/v3/global`
- LCSC `robots.txt` (checked 2026-10-24) only disallows `/cart/`, `/checkout/`, `/order/`, `/personalCenter/`, their mobile equivalents and `/product-detail-v2/`. This Actor requests only the two public endpoints above; a hard allow-list rejects any other URL at runtime and in CI.
- LCSC terms of use contain no anti-scraping clause for these public catalogue pages.
- No personal data: only public component prices, stock and technical descriptions. Contact fields are never extracted.
- At least 2 seconds between effective requests, with a descriptive User-Agent that identifies Steadfetch.

### Input

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `queries` | array of strings | Yes | `["C25804"]` | Manufacturer part numbers and/or LCSC part codes. Duplicates are removed and values are normalized to uppercase without spaces. |
| `warehouse` | string | No | `any` | Keep parts with stock in `china`, `overseas` or `any` warehouse. |
| `lastRunKey` | string | No | empty | Key-value store key for monitor mode. When set, only changed parts are delivered. |
| `maxItems` | integer | No | `100` | Maximum priced parts pushed to the dataset (1-1000). |
| `strictSchema` | boolean | No | `true` | Fail the run when a row does not match the output schema. Keep enabled. |

Empty `queries` falls back to the documented example part `C25804`, so the Store daily test always runs.

#### Example input

Matches the declared `exampleRunInput`:

```json
{
  "queries": ["C25804"],
  "warehouse": "any",
  "maxItems": 10
}
```

### Output

#### Example output

One dataset item (truncated ladder):

```json
{
  "url": "https://www.lcsc.com/product-detail/C25804.html",
  "title": "RES 10k ohm +/-1% 100mW 0603",
  "scrapedAt": "2026-10-24T19:42:00.000Z",
  "mpn": "0603WAF1002T5E",
  "distributor": "lcsc",
  "partNumber": "C25804",
  "description": "RES 10k ohm +/-1% 100mW 0603",
  "warehouse": "China (main) and overseas",
  "stock": 1108500,
  "priceBreaks": [
    { "qty": 100, "unitPrice": 0.0022 },
    { "qty": 1000, "unitPrice": 0.0018 },
    { "qty": 5000, "unitPrice": 0.0016 }
  ],
  "currency": "USD",
  "previous": { "unitPrice": 0.0022, "stock": 12300 },
  "delta": { "priceChanged": false, "stockChanged": true },
  "fetchedAt": "2026-10-24T19:42:00.000Z"
}
```

#### Output fields

| Field | Type | Description |
| --- | --- | --- |
| `url` | string | Public LCSC product page used for the row. |
| `title` | string | Product name as listed by LCSC. |
| `scrapedAt` | date-time | ISO 8601 UTC timestamp of the run. |
| `mpn` | string | Manufacturer part number, uppercase without spaces. |
| `distributor` | string | Always `lcsc`. |
| `partNumber` | string | LCSC catalogue code, for example `C25804`. |
| `description` | string or null | Short technical description. |
| `warehouse` | string or null | `China (main)`, `Overseas`, both, or null when unknown. |
| `stock` | integer or null | Total units in stock. |
| `priceBreaks` | array | `{ "qty": integer, "unitPrice": number }`, ascending by quantity. |
| `currency` | string | ISO 4217 currency code of the ladder (`USD`). |
| `previous` | object | Previous `unitPrice` and `stock`; null values on a first run. |
| `delta` | object | `priceChanged` and `stockChanged` against the previous run. |
| `fetchedAt` | date-time | ISO 8601 UTC timestamp of the product page retrieval. |

New fields are additive and required fields never change, so downstream code can rely on the documented contract.

#### Monitor mode

Pass a stable `lastRunKey` (for example `acme-bom-daily`) on every scheduled run:

```json
{
  "queries": ["STM32F103C8T6", "C25804"],
  "lastRunKey": "acme-bom-daily",
  "maxItems": 100
}
```

The first run delivers every priced part and saves one state entry per LCSC code in the `lcsc-parts-price-extractor-state` key-value store. Later runs deliver only parts whose smallest-tier unit price or stock changed, and bill 0 for unchanged checks. A check that fails or finds no price delivers no rows.

### Pricing

Pay-per-event with the two synthetic platform events:

- `apify-actor-start`: 0.00005 USD per run (Apify-recommended default, includes the first 5 seconds of compute).
- `apify-default-dataset-item`: **0.002 USD per row = 2.00 USD per 1,000 results**.

There is no custom per-item event, so users are never billed twice for the same part. Not-found parts and unchanged monitor checks are notes, not dataset rows, and are never charged.

Measured locally: 2 parts in 9.2 s (one MPN search plus two page fetches) at the 256 MB memory floor, with at least 2 s between requests. Estimated platform cost is about **0.03 USD per 1,000 MPNs** (two requests each) and below **0.10 USD per 1,000 parts** for direct LCSC codes: static HTML, no browser, no proxies. The price keeps a wide margin above cost.

**Works on the Apify free plan**: with the 5 USD monthly credit, about **2,499 priced parts** can be delivered per month (N = floor((5.00 - 0.00005) / 0.002)).

### Usage with the API

```bash
curl -X POST "https://api.apify.com/v2/acts/steadfetch~lcsc-parts-price-extractor/runs?token=<YOUR_API_TOKEN>" \
  -H 'Content-Type: application/json' \
  -d '{"queries":["C25804","STM32F103C8T6"],"maxItems":10}'
```

Then read the default dataset of the run.

### FAQ

**Do I need an LCSC account or an API key?** No. The Actor reads public catalogue pages and the public catalogue search endpoint. It never logs in and never bypasses a paywall, CAPTCHA or account.

**Can I pass a manufacturer part number instead of an LCSC code?** Yes. The Actor resolves exact manufacturer part numbers through the public search endpoint and falls back to the LCSC code when you already have one.

**Are quantity tiers billed separately?** No. One part is one row and one charge. The whole ladder is inside `priceBreaks`.

**Why is a part missing from the output?** Parts without a public price (not listed or out of catalogue) are written to run notes with `notFound: true` and are not billed. Check the `lcsc-parts-price-extractor-notes` key-value store of the run.

**What changes in monitor mode?** With `lastRunKey`, each row also carries `previous` and `delta`, and only changed parts are delivered. A no-change check costs only the run start.

**Does the Actor use a browser?** No. HTTP plus parsing is roughly 10x cheaper than a browser, and LCSC serves the product data in the page payload.

**Is the output schema stable?** Yes. New fields are added additively and required fields never change.

### Maintenance

The Actor is **tested daily** through the Steadfetch catalogue QA and the monorepo CI (`npm test` and `npm run publish:check` on every push). Repairs take priority over new features. Schema changes are announced through repository releases.

### Support

Report bugs or request features through the Apify Store page (Issues tab) of this Actor, or through the Steadfetch actors repository issues. Include the run ID and the input used.

# Actor input Schema

## `queries` (type: `array`):

Manufacturer part numbers and/or LCSC part codes (C followed by digits). Duplicates are removed and values are normalized to uppercase without spaces. When empty, the documented example part C25804 is used so the Store test always runs.

## `warehouse` (type: `string`):

Keep parts that have stock in the selected warehouse. any does not filter. The output always reports the warehouse split found on the source page.

## `lastRunKey` (type: `string`):

Optional key-value store key. When set, the Actor compares each part with the previous run, adds previous and delta to every row and only delivers parts whose price or stock changed (unchanged checks are billed 0). Leave empty for a full listing.

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

Maximum number of priced parts pushed to the dataset. Parts not found are reported as run notes and never billed.

## `strictSchema` (type: `boolean`):

Fail the run when a row does not match the output schema. Keep enabled: Steadfetch never publishes Actors without output-schema validation.

## Actor input object example

```json
{
  "queries": [
    "C25804"
  ],
  "warehouse": "any",
  "maxItems": 10,
  "strictSchema": true
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items validated against the item schema in dataset_schema.json (fields).

# 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 = {
    "queries": [
        "C25804"
    ],
    "warehouse": "any",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadfetch/lcsc-parts-price-extractor").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 = {
    "queries": ["C25804"],
    "warehouse": "any",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("steadfetch/lcsc-parts-price-extractor").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 '{
  "queries": [
    "C25804"
  ],
  "warehouse": "any",
  "maxItems": 10
}' |
apify call steadfetch/lcsc-parts-price-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,steadfetch/lcsc-parts-price-extractor"
        }
    }
}
```

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/eUslSFxri8YBGCYPh/builds/yGoCTzjl9BMhGyg6O/openapi.json
