Commerce · Commerce
Fetches a product's stock. Works with Shopify and WooCommerce accounts.
GET
https://api.pozy.ai/v1/commerce/inventoryShopify and WooCommercelistCommerceInventory
Guides: Products and catalog, Commerce & blogs
Request
Send your API key as Authorization: Bearer pz_live_.... Read-only keys can call it. Keys with the commerce resource group disabled get 403 resource_group_disabled. Authentication
Query parameters
| Name | Type | Notes |
|---|---|---|
accountIdrequired | string | |
productIdrequired | string |
Example
curl -X GET "https://api.pozy.ai/v1/commerce/inventory?accountId=696e0b682d0a31188e7a2ba9&productId=659773d34b353e6821202f21" \
-H "Authorization: Bearer $POZY_API_KEY"const res = await fetch("https://api.pozy.ai/v1/commerce/inventory?accountId=696e0b682d0a31188e7a2ba9&productId=659773d34b353e6821202f21", {
headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);import os
import requests
resp = requests.get(
"https://api.pozy.ai/v1/commerce/inventory",
headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
params={
"accountId": "696e0b682d0a31188e7a2ba9",
"productId": "659773d34b353e6821202f21",
},
timeout=30,
)
resp.raise_for_status()
print(resp.json())Response
200 on success
inventoryarray of objectproductIdstringvariantIdstringskustringCan be null.
trackedbooleanlevelsarray of object5 child fields
locationIdstringavailableintegerCan be null.
onHandintegerCan be null.
committedintegerCan be null.
incomingintegerCan be null.
200 response
{
"inventory": [
{
"productId": "659773d34b353e6821202f21",
"variantId": "64058b146247283881d19961",
"sku": "string",
"tracked": true,
"levels": [
{
"locationId": "6e99c3dd69982b334a43b0b2",
"available": 1,
"onHand": 1,
"committed": 1,
"incoming": 1
}
]
}
]
}Errors
Errors use one shape: { error, type, code, param?, details? }. The ones you are most likely to see here:
| 400 | invalid_request_error | A parameter or body field is missing or invalid. param names it. |
| 401 | authentication_error | The API key is missing, revoked or expired. |
| 403 | permission_error | The key is scoped to other profiles or has this resource group disabled. |
| 429 | rate_limit_error | Too many requests this minute. Wait for Retry-After seconds. |
Every code is listed in Errors.
More in Commerce
GETGet a storeGETList ordersGETGet an orderGETList productsPOSTCreate a productPOSTActivate, deactivate, archive or delete productsGETGet a productPATCHUpdate a productPOSTUpdate variant pricesGETList collectionsPOSTCreate a collectionGETGet a collectionPATCHUpdate a collectionDELDelete a collectionPOSTAdd or remove products in a collectionPOSTAdd variantsDELDelete variantsPOSTAdd optionsDELDelete optionsPOSTAdd imagesDELRemove imagesPOSTReorder imagesPOSTDuplicate a productGETList product metafieldsPUTSet product metafieldsDELDelete product metafieldsPOSTPublish or unpublish a productGETList collection metafieldsPUTSet collection metafieldsDELDelete collection metafieldsPOSTPublish or unpublish a collectionPOSTAdd or remove tags in bulkPOSTReorder products in a collectionGETList pagesPOSTCreate a pageGETGet a pagePATCHUpdate a pageDELDelete a pageGETList locationsPOSTSet or adjust stockGETList sales channelsGETList discountsPOSTCreate a discountGETGet a discountPATCHUpdate a discountDELDelete a discountPOSTActivate or deactivate a discountPOSTAdd codes to a discountGETList URL redirectsPOSTCreate a URL redirectPATCHUpdate a URL redirectDELDelete a URL redirectGETList navigation menusPOSTCreate a navigation menuGETGet a navigation menuPUTReplace a navigation menuDELDelete a navigation menuGETList metaobject definitionsGETList metaobjects of a typePOSTCreate a metaobjectGETGet a metaobjectPATCHUpdate a metaobjectDELDelete a metaobjectGETList marketsGETList price listsPUTSet fixed pricesDELRemove fixed pricesPUTRecord a marketing activityDELDelete a marketing activityPOSTReport daily engagementGETList catalog syncsPOSTSync a store into a Meta catalogGETGet a catalog syncDELStop a catalog syncPOSTRun a catalog sync now