{"openapi":"3.1.0","info":{"title":"PUT /api/v1/inventory/products/variants/{id}","version":"1.0.0","description":"Update product variant"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/inventory/products/variants/{id}":{"put":{"tags":["inventory:products"],"summary":"Update product variant","description":"Update an existing variant.","operationId":"update_variant_api_v1_inventory_products_variants__id__put","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariantUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariantResponse"}}}},"400":{"description":"Bad request - invalid data"},"404":{"description":"Business or variant not found"},"422":{"description":"Validation error"}}}}},"components":{"schemas":{"InventorySummary":{"properties":{"on_hand":{"type":"number","minimum":0.0,"title":"On Hand","description":"Total physical inventory quantity in your possession.","default":0},"available":{"type":"number","minimum":0.0,"title":"Available","description":"Quantity available for allocation.","default":0},"in_transit":{"type":"number","minimum":0.0,"title":"In Transit","description":"Quantity currently being shipped to your location.","default":0},"ordered":{"type":"number","minimum":0.0,"title":"Ordered","description":"Quantity ordered from suppliers but not yet shipped.","default":0}},"type":"object","title":"InventorySummary","description":"Summary of inventory quantities for a product variant.\n\nTracks different inventory states to support proper stock management\nand prevent overselling.","example":{"available":100,"in_transit":25,"on_hand":100,"ordered":50}},"VariantResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Variant UUID."},"product_id":{"type":"string","title":"Product Id","description":"Parent product UUID."},"business_id":{"type":"string","title":"Business Id","description":"Business UUID."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Last update timestamp."},"name":{"type":"string","title":"Name","description":"Variant name."},"sku":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sku","description":"Stock Keeping Unit."},"manufacturer_sku":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Manufacturer Sku","description":"Manufacturer's SKU."},"archived":{"type":"boolean","title":"Archived","description":"Whether variant is archived.","default":false},"price":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Price","description":"Unit price in dollars (legacy field, prefer unit_price)."},"cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cost","description":"Unit cost in dollars (legacy field, prefer unit_cost)."},"inventory_quantity":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Inventory Quantity","description":"Current inventory quantity (legacy, prefer inventory.on_hand)."},"shopify_variant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shopify Variant Id","description":"Shopify variant ID if synced from Shopify."},"stripe_price_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Price Id","description":"Stripe price ID if synced to Stripe."},"stripe_product_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Product Id","description":"Stripe product ID if synced to Stripe."},"unit_price":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Unit Price","description":"Sale price in cents."},"unit_cost":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Unit Cost","description":"Cost price in cents."},"unit_cost_precise":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Unit Cost Precise","description":"Precise unit cost in dollars with sub-cent precision."},"uom":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uom","description":"Unit of measure: EA, LB, G, KG, OZ, etc."},"default_vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Vendor Id","description":"Preferred vendor UUID."},"inventory":{"anyOf":[{"$ref":"#/components/schemas/InventorySummary"},{"type":"null"}],"description":"Detailed inventory breakdown."},"product_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Product Name","description":"Parent product name (resolved)."},"margin_cents":{"type":"integer","title":"Margin Cents","description":"Profit margin in cents (unit_price - unit_cost).","readOnly":true},"margin_percentage":{"type":"number","title":"Margin Percentage","description":"Profit margin as percentage of sale price.","readOnly":true}},"additionalProperties":true,"type":"object","required":["id","product_id","business_id","created_at","updated_at","name","margin_cents","margin_percentage"],"title":"VariantResponse","description":"Response schema for a product variant.\n\nContains pricing, inventory, and margin information.\nIncludes computed fields for profit margin calculations.","example":{"archived":false,"business_id":"019ab37c-bus1-7000-8000-000000000001","created_at":"2024-01-10T10:30:00Z","id":"019ab37c-var1-7000-8000-000000000001","inventory":{"available":50,"in_transit":0,"on_hand":50,"ordered":0},"manufacturer_sku":"MFR-12345","margin_cents":1799,"margin_percentage":60.02,"name":"Large - Blue","product_id":"019ab37c-prod-7000-8000-000000000001","product_name":"Premium Widget","sku":"WIDGET-PRO-LG-BLU","unit_cost":1200,"unit_price":2999,"updated_at":"2024-01-15T14:00:00Z"}},"VariantUpdateRequest":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Variant UUID (set from URL path)."},"unit_price":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Unit Price","description":"Sale price in cents (e.g., 2999 = $29.99)."},"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name","description":"Variant name (e.g., 'Large - Blue')."},"sku":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Sku","description":"Stock Keeping Unit for inventory tracking."},"manufacturer_sku":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Manufacturer Sku","description":"Manufacturer's SKU for ordering from suppliers."},"unit_cost":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Unit Cost","description":"Cost price in cents for margin calculations."},"unit_cost_precise":{"anyOf":[{"type":"number","minimum":0.0},{"type":"null"}],"title":"Unit Cost Precise","description":"Precise unit cost in dollars with sub-cent precision (e.g. 0.0478)."},"uom":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Uom","description":"Unit of measure: EA, LB, G, KG, OZ, L, ML, etc."},"default_vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Vendor Id","description":"UUID of the preferred vendor for this variant."},"archived":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Archived","description":"Set to true to archive (hide) the variant."},"initial_inventory_quantity":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Initial Inventory Quantity","description":"Set initial inventory count (use when first setting up)."},"initial_inventory_quantity_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Initial Inventory Quantity Date","description":"Date for the initial inventory count (ISO 8601)."}},"type":"object","title":"VariantUpdateRequest","description":"Request schema for updating a product variant.\n\nAll fields are optional - only include fields you want to change.","example":{"sku":"WIDGET-PRO-LG-BLU","unit_cost":1500,"unit_price":3499}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}