{"openapi":"3.1.0","info":{"title":"Manufacturing Quality API","version":"1.0.0","description":"Read supplied inspection records, measurements, and quality standards to calculate defect rates and assemble nonconformance evidence without inventing tolerances. Paid with x402 exact USDC on Base. No account is required.","contact":{"email":"support@brainiac.software"},"x-guidance":"BRAINIAC.software is a pay-per-call API for software agents. No account or API key is required.\nPayment uses the x402 protocol with exact USDC on Base (chain id 8453). Each POST operation has a fixed USD price.\nHow to call an operation:\n1. POST a JSON body matching the operation's requestBody schema to the operation path. Include an Idempotency-Key header (64 hex characters, 32 random bytes).\n2. If you have not paid, the server responds 402 with payment requirements in the body. Pay the exact amount to the payTo address on Base.\n3. Retry the identical request with the same Idempotency-Key and add a payment-signature header containing the x402 payment payload. On success (200) the operation result is returned.\n4. Reuse the same Idempotency-Key only for retries of the same operation and request body; it will not be charged twice.\nAll outputs are compliance prechecks, drafts, or data lookups for human review. They are not official determinations, legal advice, identity confirmation, or certified filings. Verify time-sensitive or official data with the cited source before acting."},"servers":[{"url":"https://www.brainiac.software"}],"paths":{"/api/v1/manufacturing-quality/production-inspection-parse":{"post":{"operationId":"parse_production_inspections","summary":"Parse production inspections","description":"Copy supplied inspections, measurements, batches, and standards into a consistent packet with pass/fail outcomes. Tolerances are not invented.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"text":"Inspection: I-1 | B-1 | P-1 | fail | DIM-01 | diameter out of spec | 2026-11-04T10:00:00.000Z | qa1\nMeasurement: M-1 | I-1 | B-1 | diameter | 12.4 | mm | 2026-11-04T10:01:00.000Z\nStandard: diameter | 12 | 11.8 | 12.2 | mm\nThis product is certified.\n"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"inspections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"batchId":{"type":"string"},"partId":{"type":"string"},"result":{"type":"string"},"defectCode":{"type":"string"},"defectText":{"type":"string"},"inspectedAt":{"type":"string"},"inspector":{"type":"string"},"outcome":{"type":"string"},"measurementCount":{"type":"number"}},"additionalProperties":true}},"measurements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"inspectionId":{"type":"string"},"batchId":{"type":"string"},"characteristic":{"type":"string"},"value":{"type":"number"},"valueSupplied":{"type":"boolean"},"unit":{"type":"string"},"measuredAt":{"type":"string"}},"additionalProperties":true}},"batches":{"type":"array","items":{}},"standards":{"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string"},"target":{"type":"number"},"targetSupplied":{"type":"boolean"},"lower":{"type":"number"},"lowerSupplied":{"type":"boolean"},"upper":{"type":"number"},"upperSupplied":{"type":"boolean"},"unit":{"type":"string"}},"additionalProperties":true}},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"parsed","inspections":[{"id":"I-1","batchId":"B-1","partId":"P-1","result":"fail","defectCode":"DIM-01","defectText":"diameter out of spec","inspectedAt":"2026-11-04T10:00:00.000Z","inspector":"qa1","outcome":"fail","measurementCount":1}],"measurements":[{"id":"M-1","inspectionId":"I-1","batchId":"B-1","characteristic":"diameter","value":12.4,"valueSupplied":true,"unit":"mm","measuredAt":"2026-11-04T10:01:00.000Z"}],"batches":[],"standards":[{"characteristic":"diameter","target":12,"targetSupplied":true,"lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"unit":"mm"}],"standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[{"kind":"ignored","code":"unlabeled_line","subject":"","detail":"Lines without a recognized label were not read and their text was not copied."}],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/manufacturing-quality/defect-classify":{"post":{"operationId":"classify_manufacturing_defects","summary":"Classify manufacturing defects","description":"Classify failed inspections with transparent token rules such as dimensional, surface, assembly, material, or functional. Classification is not a certification.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"inspections":[{"id":"I-1","batchId":"B-1","result":"fail","defectCode":"DIM-01","defectText":"diameter out of spec"},{"id":"I-2","batchId":"B-1","result":"fail","defectText":"surface scratch on housing"},{"id":"I-3","batchId":"B-1","result":"fail","defectText":"missing fastener in assembly"},{"id":"I-4","batchId":"B-1","result":"pass"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"counts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"count":{"type":"number"}},"additionalProperties":true}},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"batchId":{"type":"string"},"partId":{"type":"string"},"defectCode":{"type":"string"},"defectText":{"type":"string"},"kind":{"type":"string"},"matched":{"type":"string"},"confidence":{"type":"string"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"}},"additionalProperties":true}},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"classified","counts":[{"kind":"dimensional","count":1},{"kind":"surface","count":1},{"kind":"assembly","count":1}],"items":[{"id":"I-1","batchId":"B-1","partId":"","defectCode":"DIM-01","defectText":"diameter out of spec","kind":"dimensional","matched":"diameter","confidence":"token","productCertified":false,"regulatoryComplianceClaimed":false},{"id":"I-2","batchId":"B-1","partId":"","defectCode":"","defectText":"surface scratch on housing","kind":"surface","matched":"scratch","confidence":"token","productCertified":false,"regulatoryComplianceClaimed":false},{"id":"I-3","batchId":"B-1","partId":"","defectCode":"","defectText":"missing fastener in assembly","kind":"assembly","matched":"missing","confidence":"token","productCertified":false,"regulatoryComplianceClaimed":false}],"standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/manufacturing-quality/defect-rate-calculate":{"post":{"operationId":"calculate_defect_rate","summary":"Calculate defect rate","description":"Calculate defect rate from decided pass/fail inspections and compare it with an explicitly supplied threshold. Small samples are disclosed.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"minSample":5,"defectRateThreshold":0.1,"inspections":[{"id":"I-1","result":"pass"},{"id":"I-2","result":"pass"},{"id":"I-3","result":"pass"},{"id":"I-4","result":"fail","defectText":"scratch"},{"id":"I-5","result":"fail","defectText":"dent"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"inspectedCount":{"type":"number"},"decidedCount":{"type":"number"},"failCount":{"type":"number"},"defectRate":{"type":"number"},"defectRateSupplied":{"type":"boolean"},"threshold":{"type":"number"},"thresholdSupplied":{"type":"boolean"},"overThreshold":{"type":"boolean"},"sampleSufficient":{"type":"boolean"},"minSample":{"type":"number"},"uncertainty":{"type":"string"},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"calculated","inspectedCount":5,"decidedCount":5,"failCount":2,"defectRate":0.4,"defectRateSupplied":true,"threshold":0.1,"thresholdSupplied":true,"overThreshold":true,"sampleSufficient":true,"minSample":5,"uncertainty":"observed","standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/manufacturing-quality/batch-compare":{"post":{"operationId":"compare_batch_quality","summary":"Compare batch quality","description":"Compare batch defect rates only when each batch meets the disclosed sample minimum. Rate differences are not treated as regulatory findings.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"minSample":3,"defectRateThreshold":0.2,"batches":[{"id":"B-1","product":"Widget","produced":100},{"id":"B-2","product":"Widget","produced":100}],"inspections":[{"id":"I-1","batchId":"B-1","result":"pass"},{"id":"I-2","batchId":"B-1","result":"pass"},{"id":"I-3","batchId":"B-1","result":"fail","defectText":"scratch"},{"id":"I-4","batchId":"B-2","result":"pass"},{"id":"I-5","batchId":"B-2","result":"pass"},{"id":"I-6","batchId":"B-2","result":"pass"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"minSample":{"type":"number"},"batches":{"type":"array","items":{"type":"object","properties":{"batchId":{"type":"string"},"product":{"type":"string"},"produced":{"type":"number"},"producedSupplied":{"type":"boolean"},"inspectedCount":{"type":"number"},"decidedCount":{"type":"number"},"failCount":{"type":"number"},"defectRate":{"type":"number"},"defectRateSupplied":{"type":"boolean"},"threshold":{"type":"number"},"thresholdSupplied":{"type":"boolean"},"overThreshold":{"type":"boolean"},"sampleSufficient":{"type":"boolean"},"uncertainty":{"type":"string"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"}},"additionalProperties":true}},"comparisons":{"type":"array","items":{"type":"object","properties":{"leftBatchId":{"type":"string"},"rightBatchId":{"type":"string"},"leftRate":{"type":"number"},"rightRate":{"type":"number"},"rateDifference":{"type":"number"},"minSample":{"type":"number"},"compared":{"type":"boolean"}},"additionalProperties":true}},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"compared","minSample":3,"batches":[{"batchId":"B-1","product":"Widget","produced":100,"producedSupplied":true,"inspectedCount":3,"decidedCount":3,"failCount":1,"defectRate":0.3333,"defectRateSupplied":true,"threshold":0.2,"thresholdSupplied":true,"overThreshold":true,"sampleSufficient":true,"uncertainty":"observed","productCertified":false,"regulatoryComplianceClaimed":false},{"batchId":"B-2","product":"Widget","produced":100,"producedSupplied":true,"inspectedCount":3,"decidedCount":3,"failCount":0,"defectRate":0,"defectRateSupplied":true,"threshold":0.2,"thresholdSupplied":true,"overThreshold":false,"sampleSufficient":true,"uncertainty":"observed","productCertified":false,"regulatoryComplianceClaimed":false}],"comparisons":[{"leftBatchId":"B-1","rightBatchId":"B-2","leftRate":0.3333,"rightRate":0,"rateDifference":0.3333,"minSample":3,"compared":true}],"standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{}}]}}},"/api/v1/manufacturing-quality/nonconformance-report-generate":{"post":{"operationId":"generate_nonconformance_reports","summary":"Generate nonconformance reports","description":"Assemble structured nonconformance rows from failed inspections with linked measurements and evidence ids. The report does not claim certification or compliance.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"inspections":[{"id":"I-1","batchId":"B-1","partId":"P-1","result":"fail","defectCode":"DIM-01","defectText":"diameter out of spec","inspectedAt":"2026-11-04T10:00:00.000Z"}],"measurements":[{"id":"M-1","inspectionId":"I-1","batchId":"B-1","characteristic":"diameter","value":12.4,"unit":"mm"}],"standards":[{"characteristic":"diameter","target":12,"lower":11.8,"upper":12.2,"unit":"mm"}],"evidence":[{"id":"E-1","batchId":"B-1","inspectionId":"I-1","kind":"photo","text":"caliper reading photo","at":"2026-11-04T10:05:00.000Z"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"reportCount":{"type":"number"},"defectRate":{"type":"number"},"defectRateSupplied":{"type":"boolean"},"reports":{"type":"array","items":{"type":"object","properties":{"ncrId":{"type":"string"},"inspectionId":{"type":"string"},"batchId":{"type":"string"},"partId":{"type":"string"},"inspectedAt":{"type":"string"},"defectKind":{"type":"string"},"defectCode":{"type":"string"},"defectText":{"type":"string"},"outOfToleranceCount":{"type":"number"},"evidenceCount":{"type":"number"},"evidenceIds":{"type":"array","items":{"type":"string"}},"measurementIds":{"type":"array","items":{"type":"string"}},"summary":{"type":"string"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"}},"additionalProperties":true}},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"generated","reportCount":1,"defectRate":1,"defectRateSupplied":true,"reports":[{"ncrId":"NCR-I-1","inspectionId":"I-1","batchId":"B-1","partId":"P-1","inspectedAt":"2026-11-04T10:00:00.000Z","defectKind":"dimensional","defectCode":"DIM-01","defectText":"diameter out of spec","outOfToleranceCount":1,"evidenceCount":1,"evidenceIds":["E-1"],"measurementIds":["M-1"],"summary":"Nonconformance assembled from inspection I-1 with 1 evidence row(s) and 1 out-of-tolerance measurement(s).","productCertified":false,"regulatoryComplianceClaimed":false,"standardInvented":false,"toleranceInvented":false}],"standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[{"kind":"observation","code":"sample_small","subject":"defect_rate","detail":"Only 1 decided inspections were supplied. That is below the disclosed minimum of 20."},{"kind":"observation","code":"threshold_absent","subject":"defect_rate","detail":"No defect-rate threshold was supplied, so over-threshold status was not judged against a limit."},{"kind":"observation","code":"spc_insufficient","subject":"diameter","detail":"Only 1 observations were available. SPC requires at least 25."}],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{}}]}}},"/api/v1/manufacturing-quality/production-tolerance-check":{"post":{"operationId":"check_production_tolerances","summary":"Check production tolerances","description":"Compare supplied measurements with caller-supplied lower and upper limits. SPC mean±3σ limits are computed only when the disclosed observation minimum is met.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"spcMinSample":5,"standards":[{"characteristic":"diameter","target":12,"lower":11.8,"upper":12.2,"unit":"mm"}],"measurements":[{"id":"M-1","characteristic":"diameter","value":12},{"id":"M-2","characteristic":"diameter","value":12.1},{"id":"M-3","characteristic":"diameter","value":11.9},{"id":"M-4","characteristic":"diameter","value":12},{"id":"M-5","characteristic":"diameter","value":12.5}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"outOfToleranceCount":{"type":"number"},"checkedCount":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"batchId":{"type":"string"},"inspectionId":{"type":"string"},"characteristic":{"type":"string"},"value":{"type":"number"},"valueSupplied":{"type":"boolean"},"unit":{"type":"string"},"lower":{"type":"number"},"lowerSupplied":{"type":"boolean"},"upper":{"type":"number"},"upperSupplied":{"type":"boolean"},"target":{"type":"number"},"targetSupplied":{"type":"boolean"},"withinTolerance":{"type":"boolean"},"toleranceChecked":{"type":"boolean"},"status":{"type":"string"},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"}},"additionalProperties":true}},"spc":{"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string"},"observationCount":{"type":"number"},"spcMinSample":{"type":"number"},"spcComputed":{"type":"boolean"},"mean":{"type":"number"},"stdev":{"type":"number"},"ucl":{"type":"number"},"lcl":{"type":"number"},"outOfControlCount":{"type":"number"},"uncertainty":{"type":"string"}},"additionalProperties":true}},"spcMinSample":{"type":"number"},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"checked","outOfToleranceCount":1,"checkedCount":5,"items":[{"id":"M-1","batchId":"","inspectionId":"","characteristic":"diameter","value":12,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false},{"id":"M-2","batchId":"","inspectionId":"","characteristic":"diameter","value":12.1,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false},{"id":"M-3","batchId":"","inspectionId":"","characteristic":"diameter","value":11.9,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false},{"id":"M-4","batchId":"","inspectionId":"","characteristic":"diameter","value":12,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false},{"id":"M-5","batchId":"","inspectionId":"","characteristic":"diameter","value":12.5,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":false,"toleranceChecked":true,"status":"above_upper","standardInvented":false,"toleranceInvented":false}],"spc":[{"characteristic":"diameter","observationCount":5,"spcMinSample":5,"spcComputed":true,"mean":12.1,"stdev":0.2345,"ucl":12.8036,"lcl":11.3964,"outOfControlCount":0,"uncertainty":"observed"}],"spcMinSample":5,"standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{}}]}}},"/api/v1/manufacturing-quality/root-cause-evidence-analyze":{"post":{"operationId":"analyze_root_cause_evidence","summary":"Analyze root-cause evidence","description":"Link supplied evidence rows to failed inspections by id and summarize evidence kinds. Links are associations in the request, not proven root causes.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"inspections":[{"id":"I-1","batchId":"B-1","result":"fail","defectText":"crack in material"}],"evidence":[{"id":"E-1","inspectionId":"I-1","batchId":"B-1","kind":"material-cert","text":"heat lot note","at":"2026-11-04T09:00:00.000Z"},{"id":"E-2","inspectionId":"I-1","batchId":"B-1","kind":"photo","text":"crack photo","at":"2026-11-04T10:00:00.000Z"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"evidenceCount":{"type":"number"},"linkedFailureCount":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"batchId":{"type":"string"},"inspectionId":{"type":"string"},"kind":{"type":"string"},"text":{"type":"string"},"at":{"type":"string"},"linkedInspection":{"type":"boolean"},"linkedBatch":{"type":"boolean"}},"additionalProperties":true}},"signals":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"kind":{"type":"string"},"count":{"type":"number"},"detail":{"type":"string"}},"additionalProperties":true}},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"analyzed","evidenceCount":2,"linkedFailureCount":1,"items":[{"id":"E-1","batchId":"B-1","inspectionId":"I-1","kind":"material-cert","text":"heat lot note","at":"2026-11-04T09:00:00.000Z","linkedInspection":true,"linkedBatch":true},{"id":"E-2","batchId":"B-1","inspectionId":"I-1","kind":"photo","text":"crack photo","at":"2026-11-04T10:00:00.000Z","linkedInspection":true,"linkedBatch":true}],"signals":[{"code":"evidence_kind","kind":"material-cert","count":1,"detail":"1 evidence row(s) labeled material-cert. This is a count of supplied notes, not a proven root cause."},{"code":"evidence_kind","kind":"photo","count":1,"detail":"1 evidence row(s) labeled photo. This is a count of supplied notes, not a proven root cause."},{"code":"linked_failure_evidence","kind":"link","count":2,"detail":"Inspection I-1 has 2 linked evidence row(s). Association is by id only."}],"standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/manufacturing-quality/report":{"post":{"operationId":"report_manufacturing_quality","summary":"Report manufacturing quality","description":"Combine inspection parsing, defect classes, defect rates, batch comparisons, tolerances, NCR rows, and evidence links from supplied records. No certification or compliance is claimed.","tags":["manufacturing-quality"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"inspections":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"partId":{"type":"string","maxLength":80},"result":{"type":"string","maxLength":80},"defectCode":{"type":"string","maxLength":80},"defectText":{"type":"string","maxLength":500},"inspectedAt":{"type":"string","maxLength":40},"inspector":{"type":"string","maxLength":120}},"additionalProperties":false}},"measurements":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"characteristic":{"type":"string","maxLength":120},"value":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40},"measuredAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"standards":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string","minLength":1,"maxLength":120},"target":{"type":"number","minimum":-1000000000,"maximum":1000000000},"lower":{"type":"number","minimum":-1000000000,"maximum":1000000000},"upper":{"type":"number","minimum":-1000000000,"maximum":1000000000},"unit":{"type":"string","maxLength":40}},"required":["characteristic"],"additionalProperties":false}},"batches":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"product":{"type":"string","maxLength":160},"produced":{"type":"number","minimum":0,"maximum":1000000000},"started":{"type":"string","maxLength":40},"ended":{"type":"string","maxLength":40}},"additionalProperties":false}},"evidence":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"batchId":{"type":"string","maxLength":80},"inspectionId":{"type":"string","maxLength":80},"kind":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":1000},"at":{"type":"string","maxLength":40}},"additionalProperties":false}},"thresholds":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"number","minimum":0,"maximum":1}},"required":["name"],"additionalProperties":false}},"defectRateThreshold":{"type":"number","minimum":0,"maximum":1},"minSample":{"type":"integer","minimum":1,"maximum":100000},"spcMinSample":{"type":"integer","minimum":2,"maximum":100000}},"additionalProperties":false},"example":{"minSample":3,"spcMinSample":5,"defectRateThreshold":0.2,"batches":[{"id":"B-1","product":"Widget","produced":50},{"id":"B-2","product":"Widget","produced":50}],"standards":[{"characteristic":"diameter","target":12,"lower":11.8,"upper":12.2,"unit":"mm"}],"inspections":[{"id":"I-1","batchId":"B-1","result":"fail","defectCode":"DIM-01","defectText":"diameter out of spec"},{"id":"I-2","batchId":"B-1","result":"pass"},{"id":"I-3","batchId":"B-1","result":"pass"},{"id":"I-4","batchId":"B-2","result":"pass"},{"id":"I-5","batchId":"B-2","result":"pass"},{"id":"I-6","batchId":"B-2","result":"pass"}],"measurements":[{"id":"M-1","inspectionId":"I-1","batchId":"B-1","characteristic":"diameter","value":12.4},{"id":"M-2","characteristic":"diameter","value":12},{"id":"M-3","characteristic":"diameter","value":12.1},{"id":"M-4","characteristic":"diameter","value":11.9},{"id":"M-5","characteristic":"diameter","value":12}],"evidence":[{"id":"E-1","inspectionId":"I-1","batchId":"B-1","kind":"photo","text":"caliper photo"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"inspectionCount":{"type":"number"},"failCount":{"type":"number"},"defectRate":{"type":"number"},"defectRateSupplied":{"type":"boolean"},"overThreshold":{"type":"boolean"},"outOfToleranceCount":{"type":"number"},"ncrCount":{"type":"number"},"sampleSufficient":{"type":"boolean"},"uncertainty":{"type":"string"},"inspections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"batchId":{"type":"string"},"partId":{"type":"string"},"result":{"type":"string"},"defectCode":{"type":"string"},"defectText":{"type":"string"},"inspectedAt":{"type":"string"},"inspector":{"type":"string"},"outcome":{"type":"string"},"measurementCount":{"type":"number"}},"additionalProperties":true}},"defectClasses":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"count":{"type":"number"}},"additionalProperties":true}},"batches":{"type":"array","items":{"type":"object","properties":{"batchId":{"type":"string"},"product":{"type":"string"},"produced":{"type":"number"},"producedSupplied":{"type":"boolean"},"inspectedCount":{"type":"number"},"decidedCount":{"type":"number"},"failCount":{"type":"number"},"defectRate":{"type":"number"},"defectRateSupplied":{"type":"boolean"},"threshold":{"type":"number"},"thresholdSupplied":{"type":"boolean"},"overThreshold":{"type":"boolean"},"sampleSufficient":{"type":"boolean"},"uncertainty":{"type":"string"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"}},"additionalProperties":true}},"comparisons":{"type":"array","items":{"type":"object","properties":{"leftBatchId":{"type":"string"},"rightBatchId":{"type":"string"},"leftRate":{"type":"number"},"rightRate":{"type":"number"},"rateDifference":{"type":"number"},"minSample":{"type":"number"},"compared":{"type":"boolean"}},"additionalProperties":true}},"ncr":{"type":"array","items":{"type":"object","properties":{"ncrId":{"type":"string"},"inspectionId":{"type":"string"},"batchId":{"type":"string"},"partId":{"type":"string"},"inspectedAt":{"type":"string"},"defectKind":{"type":"string"},"defectCode":{"type":"string"},"defectText":{"type":"string"},"outOfToleranceCount":{"type":"number"},"evidenceCount":{"type":"number"},"evidenceIds":{"type":"array","items":{"type":"string"}},"measurementIds":{"type":"array","items":{"type":"string"}},"summary":{"type":"string"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"}},"additionalProperties":true}},"tolerances":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"batchId":{"type":"string"},"inspectionId":{"type":"string"},"characteristic":{"type":"string"},"value":{"type":"number"},"valueSupplied":{"type":"boolean"},"unit":{"type":"string"},"lower":{"type":"number"},"lowerSupplied":{"type":"boolean"},"upper":{"type":"number"},"upperSupplied":{"type":"boolean"},"target":{"type":"number"},"targetSupplied":{"type":"boolean"},"withinTolerance":{"type":"boolean"},"toleranceChecked":{"type":"boolean"},"status":{"type":"string"},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"}},"additionalProperties":true}},"spc":{"type":"array","items":{"type":"object","properties":{"characteristic":{"type":"string"},"observationCount":{"type":"number"},"spcMinSample":{"type":"number"},"spcComputed":{"type":"boolean"},"mean":{"type":"number"},"stdev":{"type":"number"},"ucl":{"type":"number"},"lcl":{"type":"number"},"outOfControlCount":{"type":"number"},"uncertainty":{"type":"string"}},"additionalProperties":true}},"evidence":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"batchId":{"type":"string"},"inspectionId":{"type":"string"},"kind":{"type":"string"},"text":{"type":"string"},"at":{"type":"string"},"linkedInspection":{"type":"boolean"},"linkedBatch":{"type":"boolean"}},"additionalProperties":true}},"signals":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"kind":{"type":"string"},"count":{"type":"number"},"detail":{"type":"string"}},"additionalProperties":true}},"standardInvented":{"type":"boolean"},"toleranceInvented":{"type":"boolean"},"productCertified":{"type":"boolean"},"regulatoryComplianceClaimed":{"type":"boolean"},"findings":{"type":"array","items":{}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T20:00:00.000Z","status":"reported","inspectionCount":6,"failCount":1,"defectRate":0.1667,"defectRateSupplied":true,"overThreshold":false,"outOfToleranceCount":1,"ncrCount":1,"sampleSufficient":true,"uncertainty":"observed","inspections":[{"id":"I-1","batchId":"B-1","partId":"","result":"fail","defectCode":"DIM-01","defectText":"diameter out of spec","inspectedAt":"","inspector":"","outcome":"fail","measurementCount":1},{"id":"I-2","batchId":"B-1","partId":"","result":"pass","defectCode":"","defectText":"","inspectedAt":"","inspector":"","outcome":"pass","measurementCount":0},{"id":"I-3","batchId":"B-1","partId":"","result":"pass","defectCode":"","defectText":"","inspectedAt":"","inspector":"","outcome":"pass","measurementCount":0},{"id":"I-4","batchId":"B-2","partId":"","result":"pass","defectCode":"","defectText":"","inspectedAt":"","inspector":"","outcome":"pass","measurementCount":0},{"id":"I-5","batchId":"B-2","partId":"","result":"pass","defectCode":"","defectText":"","inspectedAt":"","inspector":"","outcome":"pass","measurementCount":0},{"id":"I-6","batchId":"B-2","partId":"","result":"pass","defectCode":"","defectText":"","inspectedAt":"","inspector":"","outcome":"pass","measurementCount":0}],"defectClasses":[{"kind":"dimensional","count":1}],"batches":[{"batchId":"B-1","product":"Widget","produced":50,"producedSupplied":true,"inspectedCount":3,"decidedCount":3,"failCount":1,"defectRate":0.3333,"defectRateSupplied":true,"threshold":0.2,"thresholdSupplied":true,"overThreshold":true,"sampleSufficient":true,"uncertainty":"observed","productCertified":false,"regulatoryComplianceClaimed":false},{"batchId":"B-2","product":"Widget","produced":50,"producedSupplied":true,"inspectedCount":3,"decidedCount":3,"failCount":0,"defectRate":0,"defectRateSupplied":true,"threshold":0.2,"thresholdSupplied":true,"overThreshold":false,"sampleSufficient":true,"uncertainty":"observed","productCertified":false,"regulatoryComplianceClaimed":false}],"comparisons":[{"leftBatchId":"B-1","rightBatchId":"B-2","leftRate":0.3333,"rightRate":0,"rateDifference":0.3333,"minSample":3,"compared":true}],"ncr":[{"ncrId":"NCR-I-1","inspectionId":"I-1","batchId":"B-1","partId":"","inspectedAt":"","defectKind":"dimensional","defectCode":"DIM-01","defectText":"diameter out of spec","outOfToleranceCount":1,"evidenceCount":1,"evidenceIds":["E-1"],"measurementIds":["M-1"],"summary":"Nonconformance assembled from inspection I-1 with 1 evidence row(s) and 1 out-of-tolerance measurement(s).","productCertified":false,"regulatoryComplianceClaimed":false,"standardInvented":false,"toleranceInvented":false}],"tolerances":[{"id":"M-1","batchId":"B-1","inspectionId":"I-1","characteristic":"diameter","value":12.4,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":false,"toleranceChecked":true,"status":"above_upper","standardInvented":false,"toleranceInvented":false},{"id":"M-2","batchId":"","inspectionId":"","characteristic":"diameter","value":12,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false},{"id":"M-3","batchId":"","inspectionId":"","characteristic":"diameter","value":12.1,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false},{"id":"M-4","batchId":"","inspectionId":"","characteristic":"diameter","value":11.9,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false},{"id":"M-5","batchId":"","inspectionId":"","characteristic":"diameter","value":12,"valueSupplied":true,"unit":"mm","lower":11.8,"lowerSupplied":true,"upper":12.2,"upperSupplied":true,"target":12,"targetSupplied":true,"withinTolerance":true,"toleranceChecked":true,"status":"within","standardInvented":false,"toleranceInvented":false}],"spc":[{"characteristic":"diameter","observationCount":5,"spcMinSample":5,"spcComputed":true,"mean":12.08,"stdev":0.1924,"ucl":12.6571,"lcl":11.5029,"outOfControlCount":0,"uncertainty":"observed"}],"evidence":[{"id":"E-1","batchId":"B-1","inspectionId":"I-1","kind":"photo","text":"caliper photo","at":"","linkedInspection":true,"linkedBatch":true}],"signals":[{"code":"evidence_kind","kind":"photo","count":1,"detail":"1 evidence row(s) labeled photo. This is a count of supplied notes, not a proven root cause."},{"code":"linked_failure_evidence","kind":"link","count":1,"detail":"Inspection I-1 has 1 linked evidence row(s). Association is by id only."}],"standardInvented":false,"toleranceInvented":false,"productCertified":false,"regulatoryComplianceClaimed":false,"findings":[],"limitations":["Inspections, measurements, batches, standards, and evidence are copied only from labeled fields supplied by the caller.","Tolerances and defect-rate thresholds are used only when explicitly supplied. Manufacturing standards are never invented.","Statistical process control limits are computed only when the disclosed minimum observation count is met.","A nonconformance report organizes supplied evidence. It does not certify a product or assert regulatory compliance.","Defect classes use transparent token rules on supplied defect text and codes."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.12"},"protocols":[{"x402":{}}]}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}