Skip to main content

Update Product Inventory

Sets the stock level of several products or variants in a single request.

HTTP Request​

  • URL: /products/inventory
  • Method: PUT
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_PRODUCT

Request Body​

Send a JSON array with one item for each product or variant.

FieldTypeRequiredDescription
productIdStringYesThe ID of the product.
variantIdStringNoThe ID of a variant of the product. Send it to set the variant's stock.
stockNumberNoThe new stock level.

cURL Example​

curl --location --request PUT '<BASE_URL>/products/inventory' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '[
{
"productId": "67bb23803b6220fb83f2a1c2",
"variantId": "67bb23803b6220fb83f2a1dc",
"stock": 500
},
{
"productId": "6703a2d9e1d2f3a4b5c6d812",
"stock": 400
}
]'

Response​

  • 200 OK: The stock levels were updated successfully.
  • 400 Bad Request: The access token is missing or invalid, or an item has a missing or invalid ID.

Sample JSON Response​

{
"success": true,
"message": "Inventory updated successfully"
}

Response Details​

FieldTypeDescription
successBooleantrue when the request succeeded.
messageStringConfirmation message.

Notes​

  • For products without variants, send only productId and stock.
  • Updating stock turns on inventory tracking (trackInventory) for the product.
  • You can find variant IDs in the variants list returned by Get Product.