# StockX Sales History Scraper (`xtracto/stockx-sales-history-scraper`) Actor

Pull aggregate sales statistics by time bucket (annual / 90d / 72h / all-time) plus per-size 72-hour activity for any StockX product.

- **URL**: https://apify.com/xtracto/stockx-sales-history-scraper.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** E-commerce, Automation, Lead generation
- **Stats:** 3 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.50 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## StockX Sales History Scraper

Extract multi-bucket sales statistics for any StockX product — annual, 90-day, and 72-hour averages, volatility, price premium, and per-size activity — all in one structured dataset.

### Why use this actor

- **No account required** — reads public StockX product pages; no login or API key needed.
- **Four time buckets in one run** — annual, last-90-days, last-72-hours, and all-time stats are fetched together so you don't need separate requests per window.
- **Per-size breakdowns** — one PER\_VARIANT row per size with its own 72-hour sales count, annual average price, and annual sales count.
- **Stable two-record schema** — an AGGREGATE summary row followed by PER\_VARIANT rows; import directly into a spreadsheet, database, or ML pipeline without transformation.
- **Batch-friendly** — supply a list of product URLs and all results are collected in Apify's default dataset, exportable as JSON, CSV, or Excel.
- **Localized pricing** — configure ship-to country and display currency per run.

### How it works

1. You provide a list of StockX product URLs in the `productUrls` field.
2. For each product, the actor fetches the full market detail page, which includes statistics across all time windows.
3. An AGGREGATE record is saved per product with the last sale price, and the annual, 90-day, 72-hour, and all-time buckets — each including average price, sales count, volatility, price premium, high, and low where available.
4. One PER\_VARIANT record is saved per size with its 72-hour sales count, last sale, annual average price, and annual sales count.
5. All records land in Apify's default dataset, exportable as JSON, CSV, or Excel.

You don't need to manage any browsers or scrapers.

### Input

```json
{
    "productUrls": [
        { "url": "https://stockx.com/air-jordan-1-retro-high-og-chicago-reimagined-lost-and-found" },
        { "url": "https://stockx.com/nike-dunk-low-panda" }
    ],
    "country": "US",
    "currency": "USD",
    "maxConcurrency": 2,
    "maxRequestRetries": 6,
    "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `productUrls` | URL\[] | — | **Required.** StockX product URLs (`https://stockx.com/<slug>`). |
| `country` | string | `"US"` | Two-letter ISO country code for pricing locale. |
| `currency` | string | `"USD"` | ISO currency code (e.g. `USD`, `EUR`, `GBP`). |
| `maxConcurrency` | integer | `2` | Number of parallel workers. |
| `maxRequestRetries` | integer | `6` | Retry budget per request before skipping. |
| `proxyConfiguration` | object | RESIDENTIAL | Apify Proxy or custom proxy list. RESIDENTIAL group recommended. |

### Output

One AGGREGATE row followed by one PER\_VARIANT row per size:

```json
{
    "recordType": "AGGREGATE",
    "productId": "...",
    "urlKey": "nike-dunk-low-panda",
    "title": "Nike Dunk Low Retro White Black Panda (2021)",
    "variantCount": 19,
    "sources": ["graphql", "search"],
    "matchScore": 0.8,
    "searchEdge": {
        "market": {
            "statistics": {
                "annual": {
                    "averagePrice": 293,
                    "salesCount": 5814,
                    "volatility": 0.093861,
                    "pricePremium": 0.594,
                    "high": 488,
                    "low": 140
                },
                "last90Days": {
                    "averagePrice": 278,
                    "salesCount": 1138
                },
                "last72Hours": {
                    "salesCount": 24
                }
            }
        }
    }
}
```

Each PER\_VARIANT row surfaces the size's headline sales numbers flat at the top — **last sale** and **72-hour velocity** pre-extracted — and keeps the complete raw size object under `variant`:

```json
{
    "recordType": "PER_VARIANT",
    "variantId": "481f6d55-a8ea-4209-8cf6-358e01aeefbf",
    "variantIndex": 1,
    "lastSale": 520,
    "salesLast72Hours": 1,
    "lastSaleChangePercentage": 0.1942,
    "lastSaleChangeValue": 97,
    "lowestAsk": 316,
    "highestBid": 194,
    "spread": 122,
    "spreadPct": 38.61,
    "numberOfAsks": 33,
    "numberOfBids": 9,
    "variant": {
        "id": "481f6d55-a8ea-4209-8cf6-358e01aeefbf",
        "market": {
            "salesInformation": { "lastSale": 520, "salesLast72Hours": 1 },
            "statistics": { "lastSale": { "amount": 499, "changePercentage": 0.1942 } }
        }
    }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `recordType` | string | `"AGGREGATE"` for the product summary, `"PER_VARIANT"` for per-size rows. |
| `productId` | string | StockX UUID for the product (on AGGREGATE rows). |
| `urlKey` | string | StockX slug. |
| `title` | string | Product display title. |
| `variantCount` | integer | Total number of size variants (on AGGREGATE rows). |
| `sources` | string\[] | Data sources used, e.g. `["graphql", "search"]`. |
| `matchScore` | number | Confidence that the resolved product matches the input URL (1.0 = exact). |
| `searchEdge` | object | Market statistics object with time-bucketed averages, counts, and volatility. |
| `variantId` | string | StockX UUID for the size variant (on PER\_VARIANT rows). |
| `variantIndex` | integer | 1-based position of this size in the product's size run. |
| `lastSale` | number | Most recent sale price for this size. |
| `salesLast72Hours` | integer | Number of sales of this size in the last 72 hours (velocity). |
| `lastSaleChangePercentage` / `lastSaleChangeValue` | number | Change of the last sale vs the prior trend. |
| `lowestAsk` / `highestBid` | number | Current lowest ask / highest bid for this size. |
| `spread` / `spreadPct` | number | Bid/ask gap for this size (`lowestAsk - highestBid`) and that gap as a percent of the ask. |
| `numberOfAsks` / `numberOfBids` | integer | How many asks / bids stand on the book for this size. |
| `variant` | object | The complete raw size object (market state, sales information, statistics) — kept intact. |

### Other StockX Scrapers

| Actor | What it does |
| --- | --- |
| [StockX Search Scraper](https://apify.com/stockx-search-scraper) | Search keywords or categories; get every result tile with live market data. |
| [StockX Product Scraper](https://apify.com/stockx-product-scraper) | Full product detail — market snapshot, traits, stats — from a list of product URLs. |
| [StockX Orderbook Scraper](https://apify.com/stockx-orderbook-scraper) | Live per-size bid/ask orderbook with spread and 72-hour velocity for any product. |
| [StockX Sales History Scraper](https://apify.com/stockx-sales-history-scraper) | Multi-bucket sales statistics (annual, 90-day, 72-hour) plus per-size breakdowns. |
| [StockX Release Calendar Scraper](https://apify.com/stockx-release-calendar-scraper) | Upcoming and recent drops with release dates and pre-release bid/ask signals. |

# Actor input Schema

## `productUrls` (type: `array`):

List of StockX product URLs (https://stockx.com/<slug>).

## `country` (type: `string`):

Two-letter ISO country code (drives marketplace pricing).

## `currency` (type: `string`):

ISO currency code returned in `lastSale`, `averagePrice`, etc.

## `maxConcurrency` (type: `integer`):

Parallel workers. Each product fans out into a GraphQL + HTML pair.

## `maxRequestRetries` (type: `integer`):

Per-request retry budget; profile rotation kicks in on each retry.

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

Apify Proxy or your own list. RESIDENTIAL is recommended.

## Actor input object example

```json
{
  "productUrls": [
    {
      "url": "https://stockx.com/jordan-1-retro-low-og-banned"
    }
  ],
  "country": "US",
  "currency": "USD",
  "maxConcurrency": 2,
  "maxRequestRetries": 6,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "productUrls": [
        {
            "url": "https://stockx.com/jordan-1-retro-low-og-banned"
        }
    ],
    "country": "US",
    "currency": "USD",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/stockx-sales-history-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 = {
    "productUrls": [{ "url": "https://stockx.com/jordan-1-retro-low-og-banned" }],
    "country": "US",
    "currency": "USD",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("xtracto/stockx-sales-history-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 '{
  "productUrls": [
    {
      "url": "https://stockx.com/jordan-1-retro-low-og-banned"
    }
  ],
  "country": "US",
  "currency": "USD",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call xtracto/stockx-sales-history-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cxK2R5fPqXxR8JEa7/builds/OR7wFyjHWG76MYvb3/openapi.json
