# StockX Orderbook Scraper (per-size bid/ask) (`xtracto/stockx-orderbook-scraper`) Actor

Pull the live per-size orderbook (lowest ask, highest bid, spread, last sale, sales-72h) for any StockX product.

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

## Pricing

from $4.00 / 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 Orderbook Scraper

Pull the live per-size bid/ask orderbook for any StockX product — every size variant with its current lowest ask, highest bid, spread, and 72-hour sales velocity in structured JSON.

### Why use this actor

- **No account required** — reads public StockX product pages; no login or API key needed.
- **Per-size granularity** — one VARIANT row per size, not just a product-level summary, so you can pinpoint the most liquid or profitable size instantly.
- **Stable two-record schema** — a PRODUCT summary row followed by VARIANT rows; import directly into a spreadsheet or database with no transformation.
- **Spread computed for you** — `ask - bid` is pre-calculated on every VARIANT row so you can sort by margin without post-processing.
- **Graceful fallback** — if detailed per-size data is unavailable, the actor still emits a PRODUCT row with available market data rather than failing silently.
- **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 including all size variants.
3. A PRODUCT record is saved with the top-level market summary (overall lowest ask, highest bid, last sale, variant count).
4. One VARIANT record is saved per size, each containing the size's own ask, bid, spread, express ask count, last sale, and annual statistics.
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-4-retro-bred-reimagined" },
        { "url": "https://stockx.com/jordan-1-retro-low-og-banned" }
    ],
    "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 PRODUCT row followed by one VARIANT row per size:

```json
{
    "recordType": "PRODUCT",
    "productId": "...",
    "urlKey": "air-jordan-4-retro-bred-reimagined",
    "title": "Jordan 4 Retro Bred Reimagined",
    "variantCount": 26,
    "sources": ["graphql", "search"],
    "graphql": {
        "market": {
            "state": {
                "lowestAsk": { "amount": 218 },
                "highestBid": { "amount": 180 },
                "lastSale": { "amount": 195 }
            }
        }
    }
}
```

Each VARIANT row surfaces the most-used market numbers flat at the top level — including the **spread** and **72-hour sales**, pre-computed so you can sort by margin or velocity with no post-processing — and keeps the complete raw size object under `variant`:

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

| Field | Type | Description |
| --- | --- | --- |
| `recordType` | string | `"PRODUCT"` for the summary row, `"VARIANT"` for per-size rows. |
| `productId` | string | StockX UUID for the product (on PRODUCT rows). |
| `urlKey` | string | StockX slug. |
| `title` | string | Product display title. |
| `variantCount` | integer | Total number of size variants (on PRODUCT rows). |
| `sources` | string\[] | Data sources used, e.g. `["graphql", "search"]`. |
| `graphql` | object | Full market data object on PRODUCT rows. |
| `variantId` | string | StockX UUID for the size variant (on VARIANT rows). |
| `variantIndex` | integer | 1-based position of this size in the product's size run. |
| `lowestAsk` | number | Current lowest ask for this size. |
| `highestBid` | number | Current highest bid for this size. |
| `spread` | number | `lowestAsk - highestBid` for this size — the bid/ask gap, pre-computed. |
| `spreadPct` | number | The spread as a percentage of the lowest ask. |
| `numberOfAsks` / `numberOfBids` | integer | How many asks / bids stand on the book for this size. |
| `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. |
| `variant` | object | The complete raw size object (market state, ask service tiers, statistics) — kept intact for anyone who needs every field. |

### 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 that drives marketplace pricing (e.g. US, GB, DE, ID).

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

ISO currency code returned in `lowestAsk`, `highestBid`, `lastSale`.

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

Parallel workers. Keep low â€” 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 strongly 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-orderbook-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-orderbook-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-orderbook-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/hwtpolTHwC18281mh/builds/9mQ7L7pi5ZJaxEhde/openapi.json
