Skip to main content
metalclub

Stock API

If you keep your inventory somewhere else — your own shop, warehouse software, a spreadsheet your distributor updates — this API keeps metal.club in line with it. Your system reads your catalogue from us and sets quantities. Items match on SKU, the same codes you already use.

There are two endpoints. One returns your items and variants with current stock and SKUs. The other sets quantities, in batches that either fully apply or don’t apply at all. Each update carries a check against sales we’ve seen; if something sold while your sync was running we reject the update and send back the current numbers, so your script can retry with fresh figures rather than overwrite a sale.

When your sync sets a quantity, the public side follows: “2 left” when it’s low, “Sold out” at zero, back on sale when you restock.

To use it you need a seller account with API access switched on (ask us), an API key from Settings in your dashboard, and SKUs on the items you want synced. Every call a key makes is logged in your dashboard, and you can revoke a key at any time.

Most integrations are a short script on a timer. If you’d rather not write it, tell us what your stock lives in and we’ll help — that’s part of onboarding.

The full reference is below: both endpoints, a worked example, error codes, rate limits.


Reference

Quickstart

Every example below runs as-is once you replace YOUR_KEY. Read your catalogue first — it shows you the SKUs and item ids you can address.

curl -X POST https://metal.club/api/seller/v1/get_merch_details \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Authentication

HTTPS only. Send your key as a bearer token on every request. Keys are created in your dashboard under Settings → API access, shown once at creation, and stored only as a hash — if you lose one, revoke it and create another. You can hold up to 3 active keys, which covers rotating one without downtime plus a second system. Keys begin mck_.

Authorization: Bearer mck_your_key_here

A key belongs to exactly one seller account and can never read or write another seller’s data. Revocation takes effect immediately, as does switching API access off for the account.

1. Read your catalogue — get_merch_details

POST /api/seller/v1/get_merch_details. All fields optional: updated_since (ISO 8601) and sku to fetch one item. Draft releases are excluded. Digital items appear with "type": "digital" and no quantities — they are not stock-managed.

{ "items": [ {
    "item_id": "fmt_abc123",
    "release_title": "The Suns of Perdition",
    "artist": "Panzerfaust",
    "format": "LP - black",
    "type": "physical",
    "sku": "EIS-PZF-LP-BLK",
    "price": 2600, "currency": "eur",
    "quantity_available": 9,
    "quantity_sold": 3,
    "release_url": "https://metal.club/artist/panzerfaust/the-suns-of-perdition"
} ] }

2. Set quantities — update_quantities

POST /api/seller/v1/update_quantities. Address each item by sku (how your system matches) or by item_id for items without one. Setting 0 takes the item off sale exactly as it would in your dashboard.

curl -X POST https://metal.club/api/seller/v1/update_quantities \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "updates": [
      { "sku": "EIS-PZF-LP-BLK", "quantity_sold": 3, "quantity_available": 25 },
      { "item_id": "fmt_def456",  "quantity_sold": 0, "quantity_available": 10 }
    ]
  }'

All-or-nothing. If any line fails, nothing is applied and the response lists every failure — so you fix them in one pass rather than one round trip at a time.

Optional idempotency. Send a request_id and a repeat within 24 hours returns the original result without applying anything again — safe to retry after a timeout.

The quantity_sold handshake, worked through

Echo back the quantity_sold you last read. If ours has moved, a copy sold since you read it, so your quantity_available was calculated against a world that no longer exists — and applying it would put stock back on sale that has already gone.

# 1. You read the item. We have sold 3; you have 25 in the warehouse.
{ "sku": "EIS-PZF-LP-BLK", "quantity_sold": 3, "quantity_available": 9 }

# 2. Meanwhile a fan buys one on metal.club. Our sold count is now 4.

# 3. Your sync pushes the figures it read in step 1:
{ "updates": [ { "sku": "EIS-PZF-LP-BLK", "quantity_sold": 3, "quantity_available": 25 } ] }

# 4. REJECTED — nothing is applied, and you are told where we actually are:
{ "success": false,
  "error": "stale_quantity_sold",
  "message": "One or more items changed since you last read them. Re-read and retry.",
  "details": [ { "sku": "EIS-PZF-LP-BLK",
                 "error": "stale_quantity_sold",
                 "current_quantity_sold": 4,
                 "current_quantity_available": 8 } ] }

# 5. Re-read, recalculate, retry with quantity_sold: 4. Applied.

Responses and error codes

Success is { "success": true, ... }. A failure is always the same shape, with a stable code you can branch on — these codes are part of the contract and will not be renamed.

{ "success": false,
  "error": "stale_quantity_sold",
  "message": "a human sentence",
  "details": [ ... ] }
CodeHTTPMeans
invalid_key401The key is missing, malformed, or not recognised.
revoked_key401The key was revoked. Create a new one in your dashboard.
api_access_disabled403API access is not switched on for this account. Ask us to enable it.
rate_limited429More than 60 requests in a minute. Retry after the Retry-After header.
unknown_sku404No item on your account has that SKU.
unknown_item404No item on your account has that item_id.
duplicate_sku_in_request400The same item appears more than once in one request.
stale_quantity_sold409A sale happened since you last read the item. Re-read it and retry.
negative_quantity400Quantities must be whole numbers of 0 or more.
digital_item_not_stock_managed400Digital items have no stock to set.
malformed_request400The request body could not be read, or a field is wrong.

Rate limits

60 requests per minute per key, across both endpoints. Beyond that you get 429 with a Retry-After header in seconds. That is generous for a scheduled sync — if you are close to it, batch more items per call rather than calling more often.

A reference implementation

Most integrations are the same shape: a script on a timer that reads your own stock, works out what changed, and pushes the changed SKUs here. We’ve built and proven one end-to-end against a real self-hosted shop with its own database — polling for changes, matching by SKU, handling the staleness check above, idempotent retries, and clear logging — and we’re happy to share it as a starting point and adapt it to your setup. Ask us.

If your shop has no webhooks (most self-hosted carts don’t), a poll-based sync like this is the normal pattern: a stock change lands here within one poll interval, not instantly. For most sellers a minute or two is unnoticeable; if you need tighter latency, a shorter interval is the only lever a poll-based sync has.

Changelog

  • v1 — read catalogue and set quantities, matched by SKU.

Orders and dispatch are not in v1. If that is what you need next, tell us — it is the first thing on the list after launch.