Update inventory for a specific product variant
PUT/api/v1/sdk/products/variants/:variantId/inventory
This endpoint updates inventory quantity for a specific product variant. Use this for real-time inventory synchronization.
Authentication: Requires Private API Key (sk_*)
Request Fields:
- quantity (required) - New inventory quantity (non-negative integer)
- trackInventory (optional) - Whether to track inventory for this variant
- allowBackorder (optional) - Whether to allow orders when out of stock
Update Behavior:
- Quantity is set to exact value provided (not incremental)
- If quantity goes from 0 to positive, back-in-stock notifications are triggered
- Changes affect cart availability checks immediately
- Inventory history is tracked for auditing
Use Cases:
- Real-time inventory synchronization from external systems
- Webhook-triggered inventory updates
- Manual inventory adjustments
- Restocking operations
Important Notes:
- Back-in-stock notifications sent automatically when transitioning from 0 to positive quantity
- Inventory changes are logged for audit purposes
- Use this endpoint frequently for accurate real-time availability
Error Scenarios:
- 404 NOT FOUND - Variant not found (Error code: VARIANT_NOT_FOUND)
- 400 BAD REQUEST - Invalid quantity or request format (Error code: INVALID_REQUEST or INVALID_QUANTITY)
- 401 UNAUTHORIZED - Invalid or missing API key (Error code: INVALID_API_KEY)
- 403 FORBIDDEN - API key doesn't have access to this store (Error code: NO_STORE_ACCESS)
Request​
Responses​
- 200
- 400
- 401
- 403
- 404
- 500
Inventory updated successfully (back-in-stock notifications sent if applicable)
Invalid request - check quantity and format
Unauthorized - Invalid or missing API key
Forbidden - No access to this store
Variant not found
Internal server error