Guides
Sync dealer stock (bulk)
Keep quantities on SiteSwap in step with your own inventory.
A dealer posts each product once, keeps the listing ids next to its own stock numbers, and then sends what is on hand, up to 100 listings a call.
curl -X POST "https://dev.siteswap.pro/api/v1/listings/stock" \
-H "Authorization: Bearer ssk_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"items":[{"id":"1042","quantity":35},{"id":"1043","quantity":0}]}'const items = inventory.map((row) => ({ id: row.siteswapId, quantity: row.onHand }));
for (let i = 0; i < items.length; i += 100) {
const res = await fetch("https://dev.siteswap.pro/api/v1/listings/stock", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.SITESWAP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ items: items.slice(i, i + 100) }),
});
for (const line of (await res.json()).data) if (!line.ok) console.warn(line.id, line.error);
}import os, requests
items = [{"id": r["siteswap_id"], "quantity": r["on_hand"]} for r in inventory]
for i in range(0, len(items), 100):
r = requests.post("https://dev.siteswap.pro/api/v1/listings/stock", headers={"Authorization": "Bearer " + os.environ["SITESWAP_KEY"]},
json={"items": items[i:i + 100]})
for line in r.json()["data"]:
if not line["ok"]:
print(line["id"], line["error"])What a quantity means
quantity is what you have open to sell now. SiteSwap adds what is already promised to accepted offers, so a promise is never taken back.
0pauses the listing. A paused listing is not found by search.- A positive quantity never puts a paused listing live again: send
POST /listings/{id}/statuswithactivewhen you want it back. - Raising the quantity tells people with a matching saved search that it is back in stock.
- Each line is checked on its own: a listing that is not yours, closed or removed fails that line only, with its reason.
SiteSwap API v1Support