Update stock for a product
Scope: inventory:products.write https://api.alladdin.com/api/v2/products/{productId}/stock
Adjusts the stock level of a product in a specific warehouse. You can set an absolute value or apply a relative adjustment.
Stock changes are recorded as movements for traceability. If the product has variants, you must specify the variant ID.
Parameters
Path parameters
productId string required
Product ID (24-char hex ObjectId)
Request body
object warehouse_id string required
Warehouse ID
variant_id string | null optional
Variant ID (null for simple products)
stock_variation number<float> required
Stock quantity to add (positive) or remove (negative)
description string | null optional
Reason for stock change
Request
import requests
url = "https://api.alladdin.com/api/v2/products/{productId}/stock"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
payload = {
"warehouse_id": "string",
"variant_id": "string",
"stock_variation": 0,
"description": "string"
}
response = requests.put(url, headers=headers, json=payload)
print(response.json())Responses
Success responses
200 Stock updated
Error responses
400 Bad request application/json 401 Invalid or missing API key application/json 403 Insufficient permissions application/json 404 Product not found application/json 429 Rate limit exceeded application/json
