{"openapi":"3.1.0","info":{"title":"POST /api/v1/inventory/production/runs","version":"1.0.0","description":"Create production run"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/inventory/production/runs":{"post":{"tags":["inventory:production"],"summary":"Create production run","description":"Create a new production run from a recipe.  Costs are computed immediately.","operationId":"create_run_api_v1_inventory_production_runs_post","parameters":[{"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/RunCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunResponse"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error - Invalid data format","content":{"application/json":{"example":{"detail":[{"loc":["body","field"],"msg":"field required","type":"value_error.missing"}]}}}}}}}},"components":{"schemas":{"CostBreakdown":{"properties":{"materials_by_category":{"additionalProperties":{"type":"integer"},"type":"object","title":"Materials By Category","description":"Cost per category in cents."},"processing_steps_by_type":{"additionalProperties":{"type":"integer"},"type":"object","title":"Processing Steps By Type","description":"Cost per step_type in cents."},"material_line_items":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Material Line Items"},"step_line_items":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Step Line Items"},"total_cost":{"type":"integer","title":"Total Cost","default":0},"cost_per_unit":{"type":"integer","title":"Cost Per Unit","default":0},"sales_potential":{"type":"integer","title":"Sales Potential","default":0},"gross_profit":{"type":"integer","title":"Gross Profit","default":0},"gross_margin_pct":{"type":"number","title":"Gross Margin Pct","default":0.0},"total_weight":{"type":"number","title":"Total Weight","default":0.0},"total_weight_unit":{"type":"string","title":"Total Weight Unit","default":""}},"type":"object","title":"CostBreakdown","description":"Structured cost breakdown returned by the calculation engine."},"RunCreateRequest":{"properties":{"recipe_id":{"type":"string","title":"Recipe Id","description":"Recipe to base the run on."},"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"total_units":{"type":"integer","exclusiveMinimum":0.0,"title":"Total Units","description":"Number of finished units to produce."},"unit_sale_price":{"type":"integer","minimum":0.0,"title":"Unit Sale Price","description":"Expected sale price per unit in cents.","default":0}},"type":"object","required":["recipe_id","total_units"],"title":"RunCreateRequest"},"RunResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"recipe_id":{"type":"string","title":"Recipe Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"total_units":{"type":"integer","title":"Total Units"},"unit_sale_price":{"type":"integer","title":"Unit Sale Price"},"status":{"type":"string","title":"Status"},"cost_snapshot":{"anyOf":[{"$ref":"#/components/schemas/CostBreakdown"},{"type":"null"}]},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","business_id","recipe_id","total_units","unit_sale_price","status","created_at","updated_at"],"title":"RunResponse"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}