# Mercari Japan Underpriced Deals — Live vs Sold Comps (`jpmarketdata/mercari-japan-underpriced-deals`) Actor

Which listings on Mercari Japan are cheap right now? Builds the sold-comp median for your keyword, then scores every live listing against it and returns the ones below your discount threshold, with the discount distribution and the sold-comp basis. For resellers and proxy buyers. From $0.02.

- **URL**: https://apify.com/jpmarketdata/mercari-japan-underpriced-deals.md
- **Developed by:** [h ichi](https://apify.com/jpmarketdata) (community)
- **Categories:** E-commerce, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 keyword scanned for deals

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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Mercari Japan Underpriced Deals — Live vs Sold Comps

"What is it worth?" is a solved question — plenty of Actors return Mercari price statistics. The question that makes money is **"what is mispriced right now?"**, and answering it needs both sides in the same call: the sold-comp median *and* the live book, scored against each other.

### How the score is built

1. Sample sold (`sold_out`) listings for the keyword → **the basis**: median and quartiles.
2. Sample live (`on_sale`) listings.
3. `discountPct = (1 - price / soldMedian) x 100` for each live listing.
4. Return every listing at or below your threshold, plus the distribution.

### Two guards, because a basis can lie in two ways

**Too few comps.** A median built on three sold listings is noise, and a "70% discount" against noise is a bad trade. `minComps` (default 8) refuses to score such a keyword.

**Too many kinds of thing.** This one we found by running it. Search Mercari for `Nikon Z6` and you get the camera *and* its batteries, cases and manuals: sold comps from ¥375 to ¥150,000, median ¥7,240 — an accessory median. Scored against that, a ¥490 product catalogue booklet came back as the best deal at "93.2% off". Arithmetically perfect, completely fabricated.

So the basis must also be **coherent**. `maxCompSpread` (default 4.0) compares the p75/p25 ratio of the sold comps; a keyword that mixes price tiers is refused with the spread quoted and a pointer to the fix:

```json
{ "keywords": ["Nikon Z6"], "priceMinJpy": 50000 }
```

`priceMinJpy` / `priceMaxJpy` bound **both** sides of the comparison, so the camera is scored against camera comps.

In both cases the Actor returns `basisUsable: false` with `basisUnusableReason`, and **is not charged**. The basis is always reported next to the deals (`soldMedianJpy`, `soldCompCount`, `compSpread`, quartiles) so you can see what the discount was measured against.

### Output

Per keyword, one `deal_summary`:

| field | meaning |
|---|---|
| `soldMedianJpy`, `soldPriceJpy` | the basis and its quartiles |
| `basisUsable` / `basisUnusableReason` | whether the basis held, and why not |
| `compSpread` | p75/p25 of the comps — how mixed the keyword is |
| `soldCompCount` / `liveListingCount` | sample sizes on both sides |
| `dealCount` | live listings at or below the threshold |
| `dealRatePct` | share of the live book that is underpriced |
| `discountPctStats` | quartiles of the discount across deals |
| `bestDeal` | the single largest discount, with its URL |

Plus, optionally, each deal as its own record.

### Pricing

From **$0.02** per keyword scanned, $0.002 per individual deal. **A keyword with an unusable basis is never charged.**

Read-only public data, no login, throttled requests. Nothing is stored between runs.

# Actor input Schema

## `keywords` (type: `array`):

Search terms, e.g. "Nikon Z6". Each keyword gets its own sold-comp basis.

## `dealThresholdPct` (type: `integer`):

A live listing counts as a deal when its price is at or below this percentage of the sold-comp median. 80 means "20% under the going rate".

## `maxSoldComps` (type: `integer`):

How many sold listings to sample for the basis. More comps mean a steadier median.

## `maxLiveListings` (type: `integer`):

How many on-sale listings to score against the basis.

## `minComps` (type: `integer`):

Refuse to score a keyword with fewer sold comps than this. Guards against a median built on two data points.

## `maxCompSpread` (type: `string`):

Coherence ceiling for the basis. A keyword whose sold comps span more than this ratio from p25 to p75 is mixing price tiers (a camera search also returns its batteries and manuals) and is refused rather than scored. Raise it only if you know the keyword is one product tier.

## `priceMinJpy` (type: `integer`):

Applied to both the sold comps and the live listings. The way to pin a wide keyword to one product tier.

## `priceMaxJpy` (type: `integer`):

Applied to both sides, like the minimum.

## `includeIndividualDeals` (type: `boolean`):

Also return each matching listing (charged per deal).

## `convertToUsd` (type: `boolean`):

Add USD figures alongside JPY.

## Actor input object example

```json
{
  "keywords": [
    "Nikon Z6"
  ],
  "dealThresholdPct": 80,
  "maxSoldComps": 120,
  "maxLiveListings": 120,
  "minComps": 8,
  "maxCompSpread": "4.0",
  "includeIndividualDeals": true,
  "convertToUsd": 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 = {
    "keywords": [
        "Nikon Z6"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("jpmarketdata/mercari-japan-underpriced-deals").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 = { "keywords": ["Nikon Z6"] }

# Run the Actor and wait for it to finish
run = client.actor("jpmarketdata/mercari-japan-underpriced-deals").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 '{
  "keywords": [
    "Nikon Z6"
  ]
}' |
apify call jpmarketdata/mercari-japan-underpriced-deals --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jpmarketdata/mercari-japan-underpriced-deals"
        }
    }
}

```

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/zaGvkroLwFnvqiQTC/builds/R0jeJnhydC27Jh3pq/openapi.json
