Inventory
3 endpoints. Each needs an API key or OAuth token with the scope shown; the key already names its store, so paths start at /v1/store. Generated from the live contract; also in openapi.json.
Stock for every product and option, with key pool health
GET
/v1/store/inventoryOr name the store: GET /v1/stores/{storeId}/inventory
Parameters
filter"all" | "low" | "out" | "pools" | "counted"queryqstring | nullquerylimitinteger | string | nullquerycursorstring | nullquerysort"health" | "product" | "type" | "available" | "sold" | "cover" | "alert"querydir"asc" | "desc"query
Response ListInventoryResponse
rowsInventoryRow[]requirednextCursorstringrequiredtotalintegerrequiredcountedUnitsintegerrequiredcountsobjectrequiredallintegerrequiredlowintegerrequiredoutintegerrequiredpoolsintegerrequiredcountedintegerrequired
poolsobjectrequiredkeysAvailableintegerrequiredkeysAssigned30dintegerrequiredproductsLowintegerrequired
Example
curl "https://api.shopfa.st/v1/store/inventory" \
-H "Authorization: Bearer $SHOPFAST_API_KEY"const res = await fetch('https://api.shopfa.st/v1/store/inventory', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SHOPFAST_API_KEY}`,
},
});
if (!res.ok) throw new Error((await res.json()).detail);
const data = await res.json();import os, requests
res = requests.request(
"GET",
"https://api.shopfa.st/v1/store/inventory",
headers={"Authorization": f"Bearer {os.environ['SHOPFAST_API_KEY']}"},
)
res.raise_for_status()
data = res.json()req, _ := http.NewRequest("GET", "https://api.shopfa.st/v1/store/inventory", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SHOPFAST_API_KEY"))
res, err := http.DefaultClient.Do(req)Try it with your key
Change a counted stock and record why
POST
/v1/store/inventory/adjustOr name the store: POST /v1/stores/{storeId}/inventory/adjust
Body
productIdprd_…requiredvariantIdvar_… | nullrequiredmode"add" | "set"requiredamountintegerrequiredreason"restock" | "correction" | "damaged" | "returned"requirednotestringrequired
Response AdjustStockResponse
rowInventoryRowrequiredadjustmentStockAdjustmentrequired
Example
curl -X POST "https://api.shopfa.st/v1/store/inventory/adjust" \
-H "Authorization: Bearer $SHOPFAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"productId": "prd_0123456789abcdefghjk",
"variantId": "var_0123456789abcdefghjk",
"mode": "add",
"amount": 0,
"reason": "restock",
"note": "string"
}'const res = await fetch('https://api.shopfa.st/v1/store/inventory/adjust', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SHOPFAST_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"productId": "prd_0123456789abcdefghjk",
"variantId": "var_0123456789abcdefghjk",
"mode": "add",
"amount": 0,
"reason": "restock",
"note": "string"
}),
});
if (!res.ok) throw new Error((await res.json()).detail);
const data = await res.json();import os, requests
res = requests.request(
"POST",
"https://api.shopfa.st/v1/store/inventory/adjust",
headers={"Authorization": f"Bearer {os.environ['SHOPFAST_API_KEY']}"},
json={
"productId": "prd_0123456789abcdefghjk",
"variantId": "var_0123456789abcdefghjk",
"mode": "add",
"amount": 0,
"reason": "restock",
"note": "string"
},
)
res.raise_for_status()
data = res.json()req, _ := http.NewRequest("POST", "https://api.shopfa.st/v1/store/inventory/adjust", strings.NewReader(`{
"productId": "prd_0123456789abcdefghjk",
"variantId": "var_0123456789abcdefghjk",
"mode": "add",
"amount": 0,
"reason": "restock",
"note": "string"
}`))
req.Header.Set("Authorization", "Bearer "+os.Getenv("SHOPFAST_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)Try it with your key
Every stock change, newest first
GET
/v1/store/inventory/historyOr name the store: GET /v1/stores/{storeId}/inventory/history
Parameters
productIdprd_… | nullquerycursorstring | nullquerylimitinteger | stringquery
Response ListStockHistoryResponse
itemsStockAdjustment[]requirednextCursorCursor | nullrequired
Example
curl "https://api.shopfa.st/v1/store/inventory/history" \
-H "Authorization: Bearer $SHOPFAST_API_KEY"const res = await fetch('https://api.shopfa.st/v1/store/inventory/history', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SHOPFAST_API_KEY}`,
},
});
if (!res.ok) throw new Error((await res.json()).detail);
const data = await res.json();import os, requests
res = requests.request(
"GET",
"https://api.shopfa.st/v1/store/inventory/history",
headers={"Authorization": f"Bearer {os.environ['SHOPFAST_API_KEY']}"},
)
res.raise_for_status()
data = res.json()req, _ := http.NewRequest("GET", "https://api.shopfa.st/v1/store/inventory/history", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SHOPFAST_API_KEY"))
res, err := http.DefaultClient.Do(req)