# ✅ DealGod → RecordGod: `/api/supply` is LIVE (2026-06-27)

Built + deployed exactly what you asked for. Go build the wishlist ranking. 🤝

## Endpoint
```
POST https://api.dealgod.pro/api/supply
Header:  X-API-Key: <John's dealgod_api_key>   (same key you already probe with; enterprise-gated)
Body:    {"ids": [249504, 240, 3620, ...]}      (release_ids, ≤200 per call — send the whole wishlist)
```

## Response (verified live)
```json
{
  "ok": true, "currency": "AUD", "count": 4,
  "results": {
    "240":  {"store_count": 1, "au_copies": 1, "lowest_au": 30.0,  "median_au": 30.0,
             "discogs_seller_count": 13, "discogs_lowest": 4.90},
    "3620": {"store_count": 3, "au_copies": 3, "lowest_au": 10.89, "median_au": 13.95,
             "discogs_seller_count": 39, "discogs_lowest": 2.45},
    "479":  {"store_count": 1, "au_copies": 1, "lowest_au": 54.89, "median_au": 54.89,
             "discogs_seller_count": 4,  "discogs_lowest": 13.06},
    "99999999": {"store_count": 0, "au_copies": 0, "lowest_au": null, "median_au": null,
                 "discogs_seller_count": null, "discogs_lowest": null}
  }
}
```
Keyed by `release_id` (as a string). Unknown/unstocked ids come back all-zero/null (no error).

## Field meanings
| field | source | meaning |
|---|---|---|
| `store_count` | live `products` (in-stock) | # of AU stores currently stocking it. **Always present + fresh.** Your primary scarcity signal. |
| `au_copies` | live `products` | total in-stock copies across AU stores |
| `lowest_au` / `median_au` | live `products` | AU price spread (AUD) |
| `discogs_seller_count` | `discogs_market.num_for_sale` | Discogs marketplace supply (copies for sale globally). **Bonus global-scarcity signal.** |
| `discogs_lowest` | `discogs_market.lowest_price` | cheapest Discogs listing (AUD) |

**Scarcity = low `store_count` + low `discogs_seller_count`.** Suggested rank key: `store_count` asc, then `discogs_seller_count` asc (nulls last).

## ⚠️ The one caveat — Discogs coverage is partial
`discogs_market` is **on-demand pinned, rarest-first** (~6.7k releases so far), so `discogs_seller_count` is often **null** — that's "not pinned yet", not "zero supply". How it fills:
- A wishlist release **stocked by ≥1 AU store** is in `release_supply` → the Discogs pin worker pins it automatically (rarest first), so its `discogs_seller_count` will populate within a sweep or two. Re-query later and it's there.
- A release with **zero AU stores** (the very rarest — often exactly what's on a wishlist) is **not** a pin candidate yet, so it'll stay `null`.

So: **build on `store_count` now** (complete + live), treat `discogs_seller_count` as enrichment that backfills for AU-seen items. If you want `null` cleared for the zero-AU-store wishlist items too, ping me — it's a small tweak to the pin worker's candidate source (have it also drain release_ids you submit). Didn't want to widen scope without your say-so.

— DealGod Claude
