{"openapi":"3.0.3","info":{"title":"Zapinner API","version":"1.0.0","description":"Plug intelligence into your software. Zapinner is a capability layer: send data, invoke a capability, and receive a structured result. One API key and account share a single account-level monthly record allowance across the full Zapinner capability catalog. Product families: Lead Recovery (prioritize stale leads), Reconciliation (compare datasets, plus normalize/match/compare/dedupe/anomalies/score/explain, the transform and validate data-prep utilities, and the analyze orchestrator), Verification (check claims against evidence), Revenue Leakage (detect commercial discrepancies), and Extraction (pull structured fields from unstructured text or a public web page). A limited-preview orchestration layer (workflows, execute) chains capabilities into one call and is gated per account by a feature flag. Every financial conclusion traces to supplied numeric evidence; customer text is always treated as data. Authentication is handled automatically by RapidAPI: your subscription is your credential and RapidAPI attaches the required headers on every request. Do not add a separate API key.","contact":{"name":"Zapinner","url":"https://zapinner.com"}},"servers":[{"url":"https://zapinner.com","description":"Production"}],"tags":[{"name":"Data Preparation","description":"Deterministic normalization, matching, comparison, and deduplication"},{"name":"Intelligence","description":"Anomaly detection, scoring, and explanation"},{"name":"Orchestration","description":"Run multiple operations over one payload"},{"name":"Async Jobs","description":"Submit large batches and poll for results out of band"},{"name":"Extraction","description":"Structured extraction from unstructured text and public web pages"},{"name":"Lead Recovery","description":"Lead recovery scoring"},{"name":"Reconciliation","description":"Dataset reconciliation and financial exposure"},{"name":"Verification","description":"Claim verification against supplied evidence"},{"name":"Revenue Leakage","description":"Revenue-leakage detection across commercial records"},{"name":"System","description":"Health and status"}],"paths":{"/api/v1/normalize":{"post":{"tags":["Data Preparation"],"summary":"Normalize messy business fields","description":"Standardizes names, companies, emails, phones, dates, currencies, and monetary values into consistent structured values. Returns both the original and normalized value for every field. Deterministic; no AI. Cost: 1 credit per record.","operationId":"normalize","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"description":"A single record object, or an array of records (max 1000).","oneOf":[{"type":"object","additionalProperties":true},{"type":"array","items":{"type":"object","additionalProperties":true}}]},"types":{"type":"object","additionalProperties":{"type":"string","enum":["auto","string","company","email","phone","number","currency","date"]},"description":"Optional per-field normalization strategy. Inferred from the field name when omitted."}}},"examples":{"singleRecord":{"summary":"Normalize one record","value":{"data":{"company":" ACME, INC. ","amount":"$1,245.00","date":"9/6/26"}}}}}}},"responses":{"200":{"description":"Normalized record(s)","content":{"application/json":{"schema":{"type":"object"},"examples":{"singleRecord":{"summary":"Normalized output","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","normalized":{"company":"acme","amount":1245,"date":"2026-09-06"},"fields":{"company":{"original":" ACME, INC. ","normalized":"acme","type":"company","changed":true}},"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/match":{"post":{"tags":["Data Preparation"],"summary":"Match two records","description":"Determines whether two records represent the same underlying entity or transaction, with a weighted, per-field explanation and a 0..1 confidence. Deterministic; no AI. Cost: 1 credit.","operationId":"match","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["left","right"],"properties":{"left":{"type":"object","additionalProperties":true},"right":{"type":"object","additionalProperties":true},"threshold":{"type":"number","minimum":0,"maximum":1,"description":"Match cutoff (default 0.85)."},"weights":{"type":"object","additionalProperties":{"type":"number"},"description":"Per-field weight overrides."}}},"examples":{"customer":{"summary":"Two customer records","value":{"left":{"customer_name":"Acme Incorporated","email":"billing@acme.com","invoice_number":"INV-1002"},"right":{"customer_name":"ACME Inc.","email":"billing@acme.com","invoice_number":"INV1002"}}}}}}},"responses":{"200":{"description":"Match result","content":{"application/json":{"schema":{"type":"object"},"examples":{"matched":{"summary":"Records represent the same customer","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","match":true,"confidence":0.97,"threshold":0.85,"matched_fields":["customer_name","email","invoice_number"],"different_fields":[],"reasons":["email matches (normalized)","customer_name is highly similar (0.94)"],"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/compare":{"post":{"tags":["Data Preparation"],"summary":"Compare two records","description":"Returns deterministic field-level differences between two records, including signed deltas for numeric fields and distinct missing-field classification. Cost: 1 credit.","operationId":"compare","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["left","right"],"properties":{"left":{"type":"object","additionalProperties":true},"right":{"type":"object","additionalProperties":true}}},"examples":{"amounts":{"summary":"Compare two invoice amounts","value":{"left":{"amount":1250,"status":"open"},"right":{"amount":1200,"status":"open"}}}}}}},"responses":{"200":{"description":"Comparison result","content":{"application/json":{"schema":{"type":"object"},"examples":{"diff":{"summary":"One amount differs","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","equal":false,"differences":[{"field":"amount","left":1250,"right":1200,"kind":"amount_changed","difference":-50}],"fields_compared":2,"fields_equal":1,"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/dedupe":{"post":{"tags":["Data Preparation"],"summary":"Find duplicate records","description":"Finds likely duplicate records within a supplied dataset, grouped transitively with an explanation per group. Identifies only — never merges or deletes. Deterministic; no AI. Cost: 1 credit per record (max 500 records).","operationId":"dedupe","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"type":"object","additionalProperties":true},"minItems":1,"maxItems":500},"fields":{"type":"array","items":{"type":"string"},"description":"Restrict comparison to these fields."},"threshold":{"type":"number","minimum":0,"maximum":1,"description":"Duplicate cutoff (default 0.9)."},"weights":{"type":"object","additionalProperties":{"type":"number"}}}},"examples":{"customers":{"summary":"Dedupe a small customer list","value":{"records":[{"email":"billing@acme.com","company":"Acme Incorporated"},{"email":"sales@globex.com","company":"Globex"},{"email":"billing@acme.com","company":"ACME Inc."}]}}}}}},"responses":{"200":{"description":"Duplicate groups","content":{"application/json":{"schema":{"type":"object"},"examples":{"found":{"summary":"One duplicate group","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","duplicate_groups":[{"records":[0,2],"confidence":0.96,"reasons":["email matches","company matches"]}],"summary":{"records_checked":3,"possible_duplicates":2,"groups":1},"usage":{"credits_used":3,"credits_remaining":997}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/anomalies":{"post":{"tags":["Intelligence"],"summary":"Detect anomalous records","description":"Flags unusual or inconsistent records using robust statistics (median/MAD outliers), coverage-based missing values, rare categorical values, currency inconsistency, and possible duplicates. Neutral language; every anomaly cites evidence. Deterministic; no AI. Cost: 3 credits; metered per record (max 1000).","operationId":"anomalies","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"type":"object","additionalProperties":true},"minItems":1,"maxItems":1000},"fields":{"type":"array","items":{"type":"string"},"description":"Restrict checks to these fields."},"zThreshold":{"type":"number","minimum":1,"maximum":20,"description":"Modified z-score cutoff (default 3.5)."}}},"examples":{"invoices":{"summary":"Invoice list with one outlier","value":{"records":[{"id":"INV-1","amount":100,"currency":"USD"},{"id":"INV-2","amount":105,"currency":"USD"},{"id":"INV-3","amount":98000,"currency":"USD"}]}}}}}},"responses":{"200":{"description":"Detected anomalies","content":{"application/json":{"schema":{"type":"object"},"examples":{"outlier":{"summary":"One amount outlier","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","anomalies":[{"type":"amount_outlier","severity":"high","confidence":0.93,"record_index":2,"field":"amount","explanation":"amount of 98000 is 950.5x the median (103) for comparable records.","evidence":{"field":"amount","value":98000,"median":103,"modified_z_score":41.2}}],"summary":{"records_analyzed":3,"anomalies_found":1,"by_type":{"amount_outlier":1}},"usage":{"credits_used":3,"credits_remaining":997}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/score":{"post":{"tags":["Intelligence"],"summary":"Score a finding or factors","description":"Assigns an explainable 0..1 score (with a low/medium/high level) from either explicit weighted factors or a Zapinner finding. Every score is backed by the factors that produced it. Deterministic. Cost: 1 credit.","operationId":"score","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"score_type":{"type":"string","enum":["match_confidence","finding_confidence","anomaly_confidence","reconciliation_confidence","data_quality","review_priority","generic"]},"factors":{"type":"array","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"number","minimum":0,"maximum":1},"weight":{"type":"number","minimum":0},"note":{"type":"string"}}}},"finding":{"type":"object","additionalProperties":true,"description":"A Zapinner finding to derive factors from."}},"description":"Provide either `factors` or a `finding`."},"examples":{"factors":{"summary":"Score from explicit factors","value":{"score_type":"match_confidence","factors":[{"name":"email_match","value":1,"weight":2,"note":"Email matches exactly"},{"name":"name_similarity","value":0.9,"note":"Names are highly similar"}]}}}}}},"responses":{"200":{"description":"Score result","content":{"application/json":{"schema":{"type":"object"},"examples":{"high":{"summary":"High-confidence score","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","score":0.97,"level":"high","score_type":"match_confidence","reasons":["Email matches exactly (100%, weight 2)","Names are highly similar (90%)"],"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/explain":{"post":{"tags":["Intelligence"],"summary":"Explain a finding","description":"Produces a plain-English explanation of a Zapinner finding, referencing ONLY the evidence present on the supplied finding — it never invents evidence, and states explicitly when evidence is missing. Deterministic. Cost: 1 credit.","operationId":"explain","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["finding"],"properties":{"finding":{"type":"object","additionalProperties":true,"description":"A finding from reconcile, verify, match, dedupe, anomalies, revenue-leak, or score."}}},"examples":{"conflict":{"summary":"Explain an amount conflict","value":{"finding":{"result":"conflict","confidence":0.94,"evidence":[{"field":"amount","expected":12500,"actual":11750}]}}}}}}},"responses":{"200":{"description":"Explanation","content":{"application/json":{"schema":{"type":"object"},"examples":{"explained":{"summary":"Explanation with evidence","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","explanation":"This result was classified as \"conflict\". For amount, the expected value was 12500 while the actual value was 11750. Confidence in this result is 94%.","evidence":[{"field":"amount","expected":12500,"actual":11750}],"fields":["amount"],"confidence":0.94,"missing_evidence":[],"alternative_explanations":[],"recommended_next_step":"Evidence supports this result; no further review is required.","usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/analyze":{"post":{"tags":["Orchestration"],"summary":"Run multiple operations","description":"Runs several Zapinner operations over one payload, reusing the same service logic as the dedicated endpoints. Operations run independently (partial failure is reported per-operation) and only operations that actually executed are charged. Supported operations: normalize, match, compare, dedupe, anomalies, reconcile. Cost: the combined credit cost of the operations that ran.","operationId":"analyze","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["operations","data"],"properties":{"operations":{"type":"array","minItems":1,"maxItems":12,"items":{"type":"string","enum":["normalize","match","compare","dedupe","anomalies","reconcile"]}},"data":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Dataset for normalize/dedupe/anomalies."},"left":{"description":"Record or array of records (match/compare/reconcile)."},"right":{"description":"Record or array of records (match/compare/reconcile)."}}},"options":{"type":"object","additionalProperties":true,"description":"Per-operation options keyed by operation name."}}},"examples":{"prepAndInspect":{"summary":"Normalize, dedupe, and scan for anomalies in one call","value":{"operations":["normalize","dedupe","anomalies"],"data":{"records":[{"email":"a@acme.com","company":"Acme Inc","amount":100},{"email":"a@acme.com","company":"ACME Incorporated","amount":100},{"email":"b@globex.com","company":"Globex","amount":100000}]}}}}}}},"responses":{"200":{"description":"Combined results","content":{"application/json":{"schema":{"type":"object"},"examples":{"combined":{"summary":"Three operations executed","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","results":{"normalize":{"normalized":[],"fields":[]},"dedupe":{"duplicate_groups":[{"records":[0,1],"confidence":0.95,"reasons":["email matches"]}],"summary":{"records_checked":3,"possible_duplicates":2,"groups":1}},"anomalies":{"anomalies":[{"type":"amount_outlier","severity":"high","confidence":0.9,"record_index":2,"field":"amount","explanation":"amount is far above the median.","evidence":{}}],"summary":{"records_analyzed":3,"anomalies_found":1,"by_type":{"amount_outlier":1}}}},"operations_run":["normalize","dedupe","anomalies"],"summary":{"requested":3,"succeeded":3,"failed":0,"records_processed":3},"usage":{"credits_used":5,"credits_remaining":995}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/repair":{"post":{"tags":["Orchestration"],"summary":"Repair messy data in one call","description":"Send messy data, get production-ready data back. Inspects records, infers a schema, reconciles equivalent field names, normalizes and safely repairs values, detects and (at high confidence) merges duplicates, flags anomalies, and returns clean records plus a complete audit trail of every change. Deterministic; reuses the normalize, dedupe, and anomaly engines. Billed ONCE per input record for the whole operation — never separately for the internal steps. Cost: metered per input record (max 500).","operationId":"repair","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"type":"object","additionalProperties":true},"minItems":1,"maxItems":500,"description":"Messy records to repair. Field names, casing, and value formats may be inconsistent across records."},"options":{"type":"object","description":"Optional configuration. Sensible defaults deliver a full one-call repair with no configuration.","properties":{"normalize":{"type":"boolean","default":true,"description":"Normalize and safely repair values."},"dedupe":{"type":"boolean","default":true,"description":"Detect duplicate records."},"merge_duplicates":{"type":"boolean","default":true,"description":"Merge high-confidence duplicates (never merges low-confidence matches)."},"detect_anomalies":{"type":"boolean","default":true,"description":"Flag unusual or inconsistent records."},"infer_schema":{"type":"boolean","default":true,"description":"Infer a typed schema for the canonical fields."},"strict":{"type":"boolean","default":false,"description":"Only apply high-confidence fixes; send ambiguous cases to review_required."},"dry_run":{"type":"boolean","default":false,"description":"Return proposed changes without modifying the returned dataset."}}}}},"examples":{"messyCustomers":{"summary":"Repair two messy customer records that describe the same company","value":{"records":[{"Company Name":"ACME, INC.","Email":" JOHN@ACME.COM ","Revenue":"$1.2M","signup":"3/7/26"},{"company":"Acme Inc","email_address":"john@acme.com","revenue":"1200000","created":"2026-03-07"}]}},"dryRun":{"summary":"Preview proposed changes without modifying the dataset","value":{"records":[{"Email":" JANE@GLOBEX.COM ","Revenue":"$450K"}],"options":{"dry_run":true}}}}}}},"responses":{"200":{"description":"Repaired data with schema, field mappings, changes, duplicates, anomalies, and review items","content":{"application/json":{"schema":{"type":"object"},"examples":{"repaired":{"summary":"Two records merged into one clean record","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","success":true,"data":[{"company":"ACME, INC.","email":"john@acme.com","revenue":1200000,"signup_date":"2026-03-07"}],"schema":{"company":{"type":"company","nullable":false,"confidence":0.95},"email":{"type":"email","nullable":false,"confidence":0.98},"revenue":{"type":"currency","nullable":false,"confidence":1},"signup_date":{"type":"date","nullable":false,"confidence":0.9,"format":"YYYY-MM-DD"}},"field_mappings":[{"inputs":["Company Name","company"],"canonical":"company","confidence":0.95,"concept":"company"},{"inputs":["Email","email_address"],"canonical":"email","confidence":0.98,"concept":"email"}],"changes":[{"record":0,"field":"email","from":" JOHN@ACME.COM ","to":"john@acme.com","action":"normalized","reason":"email trimmed and lowercased","confidence":0.99},{"record":0,"field":"revenue","from":"$1.2M","to":1200000,"action":"normalized","reason":"currency value parsed to a numeric amount","confidence":0.97}],"duplicates":[{"source_records":[0,1],"result_record":0,"confidence":0.97,"reason":"company matches; email matches","action":"merge"}],"anomalies":[],"review_required":[],"summary":{"records_received":2,"records_returned":1,"issues_found":6,"issues_fixed":6,"duplicates_found":1,"duplicates_merged":1,"anomalies_found":0,"review_required":0,"dry_run":false,"strict":false},"usage":{"records_processed":2,"credits_used":2,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/map":{"post":{"tags":["Orchestration"],"summary":"Map data into a target schema","description":"Turn incoming data into the exact shape your application expects. Supply source records and the target schema; Map infers the field mapping (direct, alias, name-similarity, first+last name combination, safe splitting), converts each value to the target type, and returns data in your shape plus the inferred mappings, unresolved fields, and review items. Every mapping carries a confidence and a plain-language reason; low-confidence mappings go to review instead of being applied silently. Deterministic; reuses the shared data-intelligence primitives and (optionally) the /repair engine. Billed ONCE per input record (max 500).","operationId":"map","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["records","target_schema"],"properties":{"records":{"type":"array","items":{"type":"object","additionalProperties":true},"minItems":1,"maxItems":500,"description":"Source records to transform."},"target_schema":{"type":"object","description":"The schema your application expects. Each value is either a type string (\"string\") or an object { type, required }. Supported types: string, integer, float, number, boolean, email, phone, url, date, datetime, currency, percentage, company, name, country, state, postal_code, identifier.","additionalProperties":true},"options":{"type":"object","properties":{"strict":{"type":"boolean","default":false,"description":"Only apply very high-confidence mappings; ambiguous ones go to review."},"repair_before_mapping":{"type":"boolean","default":false,"description":"Clean values with the /repair engine before mapping. Billed once."},"drop_unmapped":{"type":"boolean","default":true,"description":"Drop source fields that do not map to any target field."}}}}},"examples":{"crmToAppSchema":{"summary":"Map a CRM export into an application schema","value":{"records":[{"firstname":"Mike","lastname":"Perkins","annualrevenue":"$2.4M","phone":"(704) 555-1234","company":"Acme, LLC"}],"target_schema":{"full_name":{"type":"string","required":true},"company_name":{"type":"string"},"annual_revenue":{"type":"number"},"phone_number":{"type":"phone"}}}}}}}},"responses":{"200":{"description":"Mapped data plus inferred mappings, unresolved fields, and review items","content":{"application/json":{"schema":{"type":"object"},"examples":{"mapped":{"summary":"Source mapped into the target schema","value":{"request_id":"req_2b7f4c9e1a3d5f8b0c2e4a6d","success":true,"data":[{"full_name":"Mike Perkins","company_name":"Acme, LLC","annual_revenue":2400000,"phone_number":"+17045551234"}],"mappings":[{"source_fields":["firstname","lastname"],"target_field":"full_name","target_type":"string","transformation":"concatenate_with_space","confidence":0.98,"reason":"target expects a full name and the source provides separate first and last name columns"},{"source_fields":["company"],"target_field":"company_name","target_type":"string","transformation":"alias_match","confidence":0.95,"reason":"source field \"company\" and target \"company_name\" both represent \"company\""},{"source_fields":["annualrevenue"],"target_field":"annual_revenue","target_type":"number","transformation":"alias_match","confidence":0.95,"reason":"source field \"annualrevenue\" and target \"annual_revenue\" both represent \"revenue\""},{"source_fields":["phone"],"target_field":"phone_number","target_type":"phone","transformation":"alias_match","confidence":0.95,"reason":"source field \"phone\" and target \"phone_number\" both represent \"phone\""}],"unmapped_source_fields":[],"unresolved_target_fields":[],"review_required":[],"summary":{"records_received":1,"records_mapped":1,"records_with_review_items":0,"fields_mapped":4,"unresolved_fields":0,"repaired_before_mapping":false,"strict":false},"usage":{"records_processed":1,"credits_used":1,"credits_remaining":999}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/guard":{"post":{"tags":["Orchestration"],"summary":"Guard data before it enters your application","description":"Stop bad data before it reaches your application. Validates each incoming record against a schema, repairs safe issues, and returns a per-record decision — pass, repair, review, or reject — with clear reasons and confidence. Configurable policy controls what is repaired versus rejected. Optimized for real-time ingestion (forms, webhooks, CRM syncs). Deterministic; reuses the shared validation and repair primitives and (optionally) the dedupe and anomaly engines. Billed ONCE per input record (max 500).","operationId":"guard","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["records","schema"],"properties":{"records":{"type":"array","items":{"type":"object","additionalProperties":true},"minItems":1,"maxItems":500,"description":"Incoming records to validate/repair/reject."},"schema":{"type":"object","description":"The schema each record must satisfy. Each value is either a type string (\"string\") or an object { type, required }.","additionalProperties":true},"policy":{"type":"object","properties":{"repair_safe_issues":{"type":"boolean","default":true,"description":"Repair safe issues automatically."},"reject_invalid_required_fields":{"type":"boolean","default":true,"description":"Reject records whose required fields are invalid and unrepairable."},"reject_low_confidence_repairs":{"type":"boolean","default":false,"description":"Reject rather than apply low-confidence repairs."},"reject_unknown_fields":{"type":"boolean","default":false,"description":"Reject records containing fields not in the schema."},"allow_null_optional_fields":{"type":"boolean","default":true,"description":"Allow null/empty optional fields."},"detect_duplicates":{"type":"boolean","default":false,"description":"Flag likely duplicate records for review."},"detect_anomalies":{"type":"boolean","default":false,"description":"Flag anomalous records for review."},"strict":{"type":"boolean","default":false,"description":"Only auto-apply high-confidence repairs; send the rest to review."}}}}},"examples":{"ingestionGate":{"summary":"Guard three incoming records against a schema","value":{"records":[{"email":" JOHN@ACME.COM ","company":"Acme Inc","revenue":"$1.2M"},{"email":"not-an-email","company":"","revenue":"1200000"},{"email":"jane@globex.com","company":"Globex","revenue":"450000"}],"schema":{"email":{"type":"email","required":true},"company":{"type":"string","required":true},"revenue":{"type":"number"}},"policy":{"repair_safe_issues":true,"reject_invalid_required_fields":true}}}}}}},"responses":{"200":{"description":"Per-record decisions (pass / repair / review / reject) with reasons and a summary","content":{"application/json":{"schema":{"type":"object"},"examples":{"decisions":{"summary":"One repaired, one rejected, one passed","value":{"request_id":"req_5e1a2b3c4d5e6f7a8b9c0d1e","success":true,"results":[{"record_index":0,"decision":"repair","confidence":0.98,"issues_found":0,"repairs_applied":2,"data":{"email":"john@acme.com","company":"Acme Inc","revenue":1200000},"changes":[{"field":"email","from":" JOHN@ACME.COM ","to":"john@acme.com","reason":"email trimmed and lowercased","confidence":0.99},{"field":"revenue","from":"$1.2M","to":1200000,"reason":"currency value parsed to a numeric amount","confidence":0.97}],"issues":[]},{"record_index":1,"decision":"reject","confidence":1,"issues_found":2,"repairs_applied":0,"data":null,"changes":[],"issues":[{"field":"email","issue":"invalid_email","reason":"\"not-an-email\" is not a valid email for \"email\" and cannot be safely repaired."},{"field":"company","issue":"missing_required_field","reason":"Required field \"company\" is missing or empty."}]},{"record_index":2,"decision":"pass","confidence":1,"issues_found":0,"repairs_applied":0,"data":{"email":"jane@globex.com","company":"Globex","revenue":"450000"},"changes":[],"issues":[]}],"summary":{"records_received":3,"passed":1,"repaired":1,"review":0,"rejected":1},"usage":{"records_processed":3,"credits_used":3,"credits_remaining":997}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/leads/recovery":{"post":{"tags":["Lead Recovery"],"summary":"Score a single lead","description":"Analyze a single lead (or a { leads: [] } batch as a convenience) and return a Recovery Score with a recommended next action.","operationId":"recoverLead","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadInput"},"examples":{"single":{"summary":"High-value roofing estimate","value":{"lead_id":"lead_123","industry":"roofing","status":"estimate_sent","lead_age_days":28,"last_contact_days":19,"estimate_value":12000,"explicit_rejection":false}}}}}},"responses":{"200":{"description":"Recovery result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecoveryResult"},"examples":{"highPriority":{"summary":"High-priority follow-up","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","lead_id":"lead_123","recovery_score":78,"priority":"high","recommended_action":"follow_up","recommended_channel":"phone","recommended_timing":"today","reason":"High-value estimate sent 19 days ago with no explicit rejection.","confidence":0.82,"scoring_version":"1.0.0"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/leads/recovery/batch":{"post":{"tags":["Lead Recovery"],"summary":"Score a batch of leads","description":"Analyze up to 1000 leads and return per-lead results plus an aggregated summary.","operationId":"recoverLeadsBatch","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchInput"}}}},"responses":{"200":{"description":"Batch recovery result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/reconcile":{"post":{"tags":["Reconciliation"],"summary":"Reconcile two datasets","description":"Compare two datasets (e.g. CRM vs billing) using configurable primary/secondary keys and comparison fields. Returns exact/probable/unmatched classifications, conflicts, duplicates, needs_review items, and evidence-backed financial exposure. Metered by total records processed (source_a + source_b).","operationId":"reconcile","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconcileInput"},"examples":{"crmVsInvoices":{"summary":"CRM opportunities vs issued invoices","value":{"source_a":{"name":"crm","records":[{"email":"acme@example.com","customer":"Acme Co","amount":25000,"status":"won"}]},"source_b":{"name":"billing","records":[{"email":"acme@example.com","customer":"Acme Co","amount":22000,"status":"paid"}]},"matching":{"primary_keys":["email"],"secondary_keys":["customer"],"compare_fields":["amount","status"],"amount_field":"amount"}}}}}}},"responses":{"200":{"description":"Reconciliation result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconcileResult"},"examples":{"amountConflict":{"summary":"Matched on email with an amount conflict","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","status":"completed","summary":{"source_a_name":"crm","source_b_name":"billing","source_a_count":1,"source_b_count":1,"records_processed":2,"exact_matches":0,"probable_matches":0,"conflicts":1,"duplicates":0,"unmatched_source_a":0,"unmatched_source_b":0,"needs_review":1,"processing_time_ms":3},"financial_exposure":{"field":"amount","currency":null,"net_difference":3000,"absolute_exposure":3000,"items":[]},"usage":{"records_processed":2}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/verify":{"post":{"tags":["Verification"],"summary":"Verify a claim against evidence","description":"Determine whether a claim is supported by supplied evidence. Deterministic (no LLM required); customer text is treated strictly as data and injection attempts are ignored. Returns verified | unsupported | contradicted | insufficient_evidence with the supporting/contradicting evidence and a confidence score.","operationId":"verify","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyInput"},"examples":{"verifiedBalance":{"summary":"A balance claim confirmed by an invoice amount","value":{"claim":"Customer owes $47,250","evidence":[{"source":"billing","record_id":"inv_881","field":"amount","value":47250}]}}}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResult"},"examples":{"verified":{"summary":"Claim supported by evidence","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","result":"verified","supported":true,"confidence":1,"evidence":[{"source":"billing","record_id":"inv_881","field":"amount","value":47250}],"contradictions":[],"missing_evidence":[],"injection_detected":false,"reasoning":"Claimed balance matches the supplied invoice amount exactly."}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/revenue-leak":{"post":{"tags":["Revenue Leakage"],"summary":"Detect possible revenue leakage","description":"Analyze orders, invoices, payments, and credits for possible revenue leakage: missing invoices, amount mismatches, underpayments, duplicates, and status conflicts. Every monetary conclusion traces to supplied numbers; exposure is reported cautiously as potential vs verified.","operationId":"revenueLeak","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevenueLeakInput"},"examples":{"orderWithoutInvoice":{"summary":"A won order that was never invoiced","value":{"orders":[{"order_id":"ORD-1","amount":18000,"status":"won"}],"invoices":[],"payments":[]}}}}}},"responses":{"200":{"description":"Revenue-leak analysis result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevenueLeakResult"},"examples":{"missingInvoice":{"summary":"A won order that was never invoiced","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","status":"completed","summary":{"records_analyzed":1,"findings":1,"processing_time_ms":2},"financial_exposure":{"potential":18000,"verified":0,"currency":null},"findings":[{"type":"missing_invoice","message":"Order ORD-1 is marked won but has no matching invoice.","monetary_class":"potential","amount":18000,"currency":null,"confidence":0.9,"evidence":[{"source":"orders","record_id":"ORD-1","field":"amount","value":18000}],"challenges":[]}]}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/transform":{"post":{"tags":["Data Preparation"],"summary":"Reshape records with declarative operations","description":"Runs an ordered list of deterministic operations — trim, lowercase, uppercase, rename, pick, omit, default, coalesce, to_number, to_boolean, replace — over a record or array of records. No AI; no user-supplied regular expressions. Cost: 1 credit per record.","operationId":"transform","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["data","operations"],"properties":{"data":{"description":"A single record object, or an array of records.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array","items":{"type":"object","additionalProperties":true}}]},"operations":{"type":"array","minItems":1,"description":"Ordered operations. Each item has an `op` plus its parameters.","items":{"type":"object","required":["op"],"properties":{"op":{"type":"string"}},"additionalProperties":true}}}},"examples":{"clean":{"summary":"Trim and lowercase a field","value":{"data":{"name":"  Acme, Inc. "},"operations":[{"op":"trim","fields":["name"]},{"op":"lowercase","fields":["name"]}]}}}}}},"responses":{"200":{"description":"Transformed record(s)","content":{"application/json":{"schema":{"type":"object"},"examples":{"transformed":{"summary":"Reshaped output","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","transformed":{"name":"acme, inc."},"operations_applied":2,"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/validate":{"post":{"tags":["Data Preparation"],"summary":"Validate records against a ruleset","description":"Checks a record or array of records against per-field rules (type, required, numeric min/max, length, and allowed values), returning every failed rule with a stable code. Deterministic; no user-supplied regular expressions. Cost: 1 credit per record.","operationId":"validate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["data","rules"],"properties":{"data":{"description":"A single record object, or an array of records.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array","items":{"type":"object","additionalProperties":true}}]},"rules":{"type":"object","description":"Field name to rule. Rule keys: type, required, min, max, minLength, maxLength, enum.","additionalProperties":{"type":"object","additionalProperties":true}}}},"examples":{"email":{"summary":"Require a valid email","value":{"data":{"email":"not-an-email"},"rules":{"email":{"type":"email","required":true}}}}}}}},"responses":{"200":{"description":"Validation result","content":{"application/json":{"schema":{"type":"object"},"examples":{"invalid":{"summary":"One field fails validation","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","valid":false,"errors":[{"field":"email","code":"invalid_type","message":"email must be a valid email address."}],"summary":{"records_checked":1,"records_valid":0,"errors":1},"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/extract":{"post":{"tags":["Extraction"],"summary":"Extract structured fields from text","description":"Extracts a caller-declared set of fields from unstructured text using the Zapinner AI layer. The text is treated as untrusted data: fields with no clear value come back null rather than fabricated. Cost: 1 credit per request.","operationId":"extract","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text","fields"],"properties":{"text":{"type":"string","maxLength":20000,"description":"Unstructured text to extract from."},"fields":{"type":"array","minItems":1,"items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number","integer","boolean","date"]},"description":{"type":"string"},"optional":{"type":"boolean"}}}}}},"examples":{"invoice":{"summary":"Pull invoice fields from a line of text","value":{"text":"Invoice #INV-1042 dated 2026-09-06 for $1,245.00","fields":[{"name":"invoice_number"},{"name":"amount","type":"number"}]}}}}}},"responses":{"200":{"description":"Extracted fields","content":{"application/json":{"schema":{"type":"object"},"examples":{"extracted":{"summary":"Two fields extracted","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","extracted":{"invoice_number":"INV-1042","amount":1245},"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/web/extract":{"post":{"tags":["Extraction"],"summary":"Fetch a web page and extract structured fields","description":"Fetches a public web page over an SSRF-hardened client (no private, loopback, or link-local addresses; no redirects; size and time capped), reduces it to text, and extracts caller-declared structured fields. Cost: 1 credit per request.","operationId":"webExtract","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","fields"],"properties":{"url":{"type":"string","format":"uri","description":"Public http(s) URL to fetch."},"fields":{"type":"array","minItems":1,"items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number","integer","boolean","date"]},"description":{"type":"string"},"optional":{"type":"boolean"}}}}}},"examples":{"pricing":{"summary":"Extract structured fields from a public page","value":{"url":"https://example.com/","fields":[{"name":"page_title","description":"The main heading of the page"},{"name":"summary","description":"A one-sentence summary of the page"}]}}}}}},"responses":{"200":{"description":"Extracted fields","content":{"application/json":{"schema":{"type":"object"},"examples":{"extracted":{"summary":"Fields extracted from the page","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","url":"https://example.com/","extracted":{"page_title":"Example Domain","summary":"This domain is for use in illustrative examples in documents."},"usage":{"credits_used":1,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/process":{"post":{"tags":["Orchestration"],"summary":"Chain data operations over one record set","description":"The universal operation orchestrator. Chains any record-stream operations from the catalog (those that take a `data` array, plus the two-dataset comparisons) into one synchronous request over a single working set — no internal HTTP calls, the same auth and metering as every endpoint. All steps are validated before any runs. Record-transforming steps (e.g. impute, rank, normalize-address, normalize-url) rewrite the working set; analysis steps attach their result under `artifacts` keyed by operation id and pass the records through unchanged. Two-dataset ops (schema-diff, link) take the working set as source_a and the step's `against` array as source_b. Text-scalar, text-pair, document, series, and single-string operations are NOT chainable here — call their own endpoints. Cost: the sum of each step's records_in × the operation's per-record weight.","operationId":"processOperations","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["data","steps"],"properties":{"data":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":true}},"steps":{"type":"array","minItems":1,"items":{"type":"object","required":["operation"],"properties":{"operation":{"type":"string","enum":["change-points","cluster","convert","correlations","distributions","flatten","impute","link","missing","normalize-address","normalize-phone","normalize-url","patterns","pii-detect","profile","quality-score","rank","schema-diff","schema-validate","segment","similarity","statistics","trends","unflatten","validate-email"]},"options":{"type":"object","additionalProperties":true},"against":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Second dataset for two-dataset ops (schema-diff, link)."}},"additionalProperties":false}}}},"examples":{"imputeThenAnalyze":{"summary":"Impute missing values, then score quality and detect PII","value":{"data":[{"name":"John","email":"john@example.com","score":10},{"name":"jane","email":"nope","score":null}],"steps":[{"operation":"impute","options":{"strategy":"mean","fields":["score"]}},{"operation":"quality-score"},{"operation":"pii-detect"}]}}}}}},"responses":{"200":{"description":"Final records, per-step reports, and analysis artifacts.","content":{"application/json":{"schema":{"type":"object"},"examples":{"ran":{"summary":"Impute (transform) + two analysis steps","value":{"success":true,"operation":"process","records_processed":6,"data":{"records":[{"name":"John","email":"john@example.com","score":10},{"name":"jane","email":"nope","score":10}],"steps":[{"operation":"impute","transforms_records":true,"records_in":2,"records_out":2,"billable_units":2},{"operation":"quality-score","transforms_records":false,"records_in":2,"records_out":2,"billable_units":2},{"operation":"pii-detect","transforms_records":false,"records_in":2,"records_out":2,"billable_units":2}],"artifacts":{"quality-score":{},"pii-detect":{}}},"usage":{"records_processed":6,"credits_used":6,"credits_remaining":994},"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/api/v1/pipeline":{"post":{"tags":["Orchestration"],"summary":"Chain record-in/record-out capabilities into one ordered call.","description":"Runs an ordered chain of record-in / record-out capabilities (standardize, transform, redact, mask, normalize) over one record set, feeding each step's output into the next. The whole pipeline is validated before any step runs, and steps call each capability's pure engine directly. Deterministic; billed records × steps. Cost: metered per record.","operationId":"pipeline","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"company":{"type":"string"},"note":{"type":"string"}},"required":["company","note"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"steps":{"type":"array","items":{"type":"object","properties":{"operation":{"type":"string"}},"required":["operation"],"additionalProperties":true}}},"required":["data","steps"],"additionalProperties":true},"examples":{"pipeline":{"summary":"Pipeline","value":{"data":{"records":[{"company":" ACME, INC. ","note":"call me at 704-555-1234"}]},"steps":[{"operation":"standardize"},{"operation":"redact"}]}}}}}},"responses":{"200":{"description":"Pipeline result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/usage":{"get":{"tags":["System"],"summary":"Get current usage","description":"Returns the calling workspace's authoritative monthly record usage, plan allowance, billing window, and a per-API records breakdown. Read-only: never metered and never blocked by the record quota.","operationId":"getUsage","responses":{"200":{"description":"Current usage snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"401":{"$ref":"#/components/responses/Error"}}}},"/api/v1/jobs":{"post":{"tags":["Async Jobs"],"summary":"Submit an async batch job","description":"Queues a batch job that runs ONE deterministic capability (normalize, transform, validate, dedupe, or anomalies) over up to 10,000 records outside the request/response cycle. Returns immediately with a queued job handle; poll GET /api/v1/jobs/{id} for status and result. The batch is billed up front against your account-level monthly record allowance (1 credit per record) — polling is free. Use this instead of the synchronous endpoints for large batches that would otherwise exceed a single request's time budget.","operationId":"submitJob","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["capability","records"],"properties":{"capability":{"type":"string","enum":["normalize","transform","validate","dedupe","anomalies"],"description":"The single capability to run over every record."},"records":{"type":"array","items":{"type":"object","additionalProperties":true},"minItems":1,"maxItems":10000},"params":{"type":"object","additionalProperties":true,"description":"Optional per-capability parameters (e.g. `operations` for transform, `rules` for validate, `fields`/`threshold` for dedupe, `zThreshold` for anomalies). Only the field relevant to `capability` is read."}}},"examples":{"dedupeBatch":{"summary":"Dedupe a large batch asynchronously","value":{"capability":"dedupe","records":[{"email":"billing@acme.com","company":"Acme Incorporated"},{"email":"billing@acme.com","company":"ACME Inc."}],"params":{"threshold":0.9}}}}}}},"responses":{"202":{"description":"Job accepted and queued","content":{"application/json":{"schema":{"type":"object"},"examples":{"queued":{"summary":"Queued job handle","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","job":{"id":"job_2b8c1a7b3e5d4c8f0a1b2c3d","status":"queued","capability":"dedupe","record_count":2,"status_url":"/api/v1/jobs/job_2b8c1a7b3e5d4c8f0a1b2c3d"},"usage":{"credits_used":2,"credits_remaining":998}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/jobs/{id}":{"get":{"tags":["Async Jobs"],"summary":"Get async job status and result","description":"Returns the current status of a submitted job and, once it reaches `completed`, the full capability result (or an `error` string when `failed`). Strictly scoped to your organization: another org's job is indistinguishable from a nonexistent one. Read-only and never billable — poll as often as your rate limit allows.","operationId":"getJob","parameters":[{"name":"id","in":"path","required":true,"description":"The job id returned by POST /api/v1/jobs.","schema":{"type":"string"}}],"responses":{"200":{"description":"Current job status","content":{"application/json":{"schema":{"type":"object"},"examples":{"completed":{"summary":"A finished job","value":{"request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","job":{"id":"job_2b8c1a7b3e5d4c8f0a1b2c3d","status":"completed","capability":"dedupe","record_count":2,"attempts":1,"result":{"capability":"dedupe","records_processed":2,"result":{"duplicate_groups":[{"records":[0,1],"confidence":0.96}]}},"error":null,"created_at":"2026-09-08T12:00:00.000Z","started_at":"2026-09-08T12:00:03.000Z","completed_at":"2026-09-08T12:00:03.400Z"}}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/health":{"get":{"tags":["System"],"summary":"Health check","description":"Unauthenticated liveness/readiness probe. Returns service status and non-sensitive config readiness (names only, never secret values). Not billable.","operationId":"getHealth","security":[],"responses":{"200":{"description":"Service health","content":{"application/json":{"schema":{"type":"object"}}}},"503":{"description":"Service degraded (e.g. database unavailable)","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/standardize":{"post":{"tags":["Data Preparation"],"summary":"Coerce every value into the canonical form for its column's type.","description":"Infers each column's type from its values (or takes an explicit type) and coerces every value into the canonical form for that type, so a whole dataset comes back type-consistent. Reuses the shared coercion + type-inference engines. Deterministic; billed per record. Cost: metered per record.","operationId":"standardize","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"amount":{"type":"string"},"created":{"type":"string"},"active":{"type":"string"}},"required":["amount","created","active"],"additionalProperties":true}},"required":["data"],"additionalProperties":true},"examples":{"standardize":{"summary":"Standardize","value":{"data":{"amount":"$1,245.00","created":"3/7/26","active":"yes"}}}}}}},"responses":{"200":{"description":"Standardize result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/parse":{"post":{"tags":["Data Preparation"],"summary":"Parse declared string fields into typed values and name components.","description":"Pulls typed values (and, for full names, structured first/middle/last components) out of caller-declared string fields. Deterministic: a value that cannot be parsed into the declared target comes back null with parsed:false rather than being guessed at. Billed per record. Cost: metered per record.","operationId":"parse","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"name":{"type":"string"},"when":{"type":"string"}},"required":["name","when"],"additionalProperties":true},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"as":{"type":"string"}},"required":["name","as"],"additionalProperties":true}}},"required":["data","fields"],"additionalProperties":true},"examples":{"parse":{"summary":"Parse","value":{"data":{"name":"Mike J Perkins","when":"3/7/26"},"fields":[{"name":"name","as":"full_name"},{"name":"when","as":"date"}]}}}}}},"responses":{"200":{"description":"Parse result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/type-infer":{"post":{"tags":["Data Preparation"],"summary":"Infer each column's data type by majority vote over its values.","description":"Infers each column's type by majority vote over its non-blank values, with confidence and nullable/required flags. Types come from value evidence only, never field names. Deterministic; billed per record. Cost: metered per record.","operationId":"typeInfer","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string"},"active":{"type":"string"}},"required":["amount","active"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"examples":{"type_infer":{"summary":"Type Inference","value":{"records":[{"amount":"100","active":"yes"},{"amount":"250","active":"no"}]}}}}}},"responses":{"200":{"description":"Type Inference result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/completeness":{"post":{"tags":["Data Preparation"],"summary":"Report per-field fill rate and an overall completeness score.","description":"Reports per-field fill rate (the share of records where a field is present and non-blank) plus an overall completeness score. Deterministic; billed per record. Cost: metered per record.","operationId":"completeness","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"phone":{"type":"string"}},"required":["email","phone"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"examples":{"completeness":{"summary":"Completeness","value":{"records":[{"email":"a@x.com","phone":""},{"email":"","phone":"555-1234"}]}}}}}},"responses":{"200":{"description":"Completeness result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/fuzzy-match":{"post":{"tags":["Data Preparation"],"summary":"Per-field string-similarity comparison of two records.","description":"Pure per-field string-similarity comparison of two records, with an overall score and a match decision against a threshold. Distinct from /match (a weighted entity decision): this exposes the raw similarity so you can build your own thresholds. Reuses the shared similarity primitives. Deterministic. Cost: metered per record.","operationId":"fuzzyMatch","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"left":{"type":"object","properties":{"company":{"type":"string"}},"required":["company"],"additionalProperties":true},"right":{"type":"object","properties":{"company":{"type":"string"}},"required":["company"],"additionalProperties":true}},"required":["left","right"],"additionalProperties":true},"examples":{"fuzzy_match":{"summary":"Fuzzy Match","value":{"left":{"company":"Acme Inc"},"right":{"company":"ACME Incorporated"}}}}}}},"responses":{"200":{"description":"Fuzzy Match result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/entity-resolution":{"post":{"tags":["Data Preparation"],"summary":"Cluster records into entities and emit one canonical record each.","description":"Clusters records that refer to the same real-world entity and emits one canonical record per entity. Reuses the deterministic dedupe engine for clustering and the shared merge engine for the canonical record. Billed per record. Cost: metered per record.","operationId":"entityResolution","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email","name"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"examples":{"entity_resolution":{"summary":"Entity Resolution","value":{"records":[{"email":"a@acme.com","name":"Acme"},{"email":"A@ACME.com","name":"ACME Inc"}]}}}}}},"responses":{"200":{"description":"Entity Resolution result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/conflicts":{"post":{"tags":["Data Preparation"],"summary":"Find fields whose values disagree across records sharing a key.","description":"Within groups of records that share the same key, finds fields whose non-blank values disagree — the survivorship decisions you need before /merge or /survivorship. Deterministic; billed per record. Cost: metered per record.","operationId":"conflicts","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"}},"required":["id","email"],"additionalProperties":true}},"key_fields":{"type":"array","items":{"type":"string"}}},"required":["records","key_fields"],"additionalProperties":true},"examples":{"conflicts":{"summary":"Conflicts","value":{"records":[{"id":"1","email":"a@x.com"},{"id":"1","email":"b@y.com"}],"key_fields":["id"]}}}}}},"responses":{"200":{"description":"Conflicts result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/merge":{"post":{"tags":["Data Preparation"],"summary":"Collapse duplicate records into one golden record with provenance.","description":"Collapses several records for the same entity into one golden record using explicit per-field survivorship rules (most_complete, longest, highest, most_common, and more), with provenance for every chosen value. Reuses the shared merge engine. Deterministic; billed per record. Cost: metered per record.","operationId":"merge","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"}},"required":["name","phone"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"examples":{"merge":{"summary":"Merge","value":{"records":[{"name":"Acme","phone":""},{"name":"Acme Inc","phone":"555-1234"}]}}}}}},"responses":{"200":{"description":"Merge result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/survivorship":{"post":{"tags":["Data Preparation"],"summary":"Collapse keyed groups into golden records with survivorship rules.","description":"Groups records by a shared key and collapses each group into one golden record using explicit per-field survivorship rules, with full provenance. Reuses the shared merge engine. Deterministic; billed per record. Cost: metered per record.","operationId":"survivorship","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"}},"required":["id","email"],"additionalProperties":true}},"key_fields":{"type":"array","items":{"type":"string"}}},"required":["records","key_fields"],"additionalProperties":true},"examples":{"survivorship":{"summary":"Survivorship","value":{"records":[{"id":"1","email":"a@x.com"},{"id":"1","email":""}],"key_fields":["id"]}}}}}},"responses":{"200":{"description":"Survivorship result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/consistency":{"post":{"tags":["Intelligence"],"summary":"Report each column's dominant type and how much data agrees.","description":"Reports per-field type consistency: each column's dominant type and the share of values that agree with it, flagging columns that mix types (e.g. numbers and free text). Deterministic; billed per record. Cost: metered per record.","operationId":"consistency","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string"}},"required":["amount"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"examples":{"consistency":{"summary":"Consistency","value":{"records":[{"amount":"100"},{"amount":"abc"}]}}}}}},"responses":{"200":{"description":"Consistency result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/data-quality":{"post":{"tags":["Intelligence"],"summary":"A composite 0-100 quality score with an explainable breakdown.","description":"A composite 0..100 quality score with a letter grade, built from explainable completeness, type-consistency, and uniqueness dimensions. Reuses the shared quality primitives. Deterministic; billed per record. Cost: metered per record.","operationId":"dataQuality","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"amount":{"type":"string"}},"required":["email","amount"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"examples":{"data_quality":{"summary":"Data Quality","value":{"records":[{"email":"a@x.com","amount":"100"},{"email":"","amount":"200"}]}}}}}},"responses":{"200":{"description":"Data Quality result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/schema-detect":{"post":{"tags":["Intelligence"],"summary":"Infer a typed schema object ready to feed into map or validate.","description":"Produces a compact schema object ({ field: { type, required, nullable, confidence } }) inferred from the records — ready to feed straight into /map, /guard, or /validate. Types come from value evidence only. Deterministic; billed per record. Cost: metered per record.","operationId":"schemaDetect","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string"},"active":{"type":"string"}},"required":["amount","active"],"additionalProperties":true}}},"required":["records"],"additionalProperties":true},"examples":{"schema_detect":{"summary":"Schema Detect","value":{"records":[{"amount":"100","active":"yes"},{"amount":"250","active":"no"}]}}}}}},"responses":{"200":{"description":"Schema Detect result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/schema-map":{"post":{"tags":["Data Preparation"],"summary":"Map source records onto a target schema with per-field confidence.","description":"A named alias for the canonical schema-mapping engine: infers the field mapping from source records to a target schema, converts values to the target types, and returns data in your shape with a confidence and reason per field. Shares the exact /map request contract and engine. Deterministic; billed per record. Cost: metered per record.","operationId":"schemaMap","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"firstname":{"type":"string"},"company":{"type":"string"}},"required":["firstname","company"],"additionalProperties":true}},"target_schema":{"type":"object","properties":{"full_name":{"type":"object","properties":{"type":{"type":"string"},"required":{"type":"boolean"}},"required":["type","required"],"additionalProperties":true},"company_name":{"type":"object","properties":{"type":{"type":"string"}},"required":["type"],"additionalProperties":true}},"required":["full_name","company_name"],"additionalProperties":true}},"required":["records","target_schema"],"additionalProperties":true},"examples":{"schema_map":{"summary":"Schema Map","value":{"records":[{"firstname":"Mike","company":"Acme, LLC"}],"target_schema":{"full_name":{"type":"string","required":true},"company_name":{"type":"string"}}}}}}}},"responses":{"200":{"description":"Schema Map result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/classify":{"post":{"tags":["Data Preparation"],"summary":"Single-label classification into caller-declared categories.","description":"Single-label classification of each record into one of the caller's declared categories, by keyword evidence (or description similarity). A record with no evidence is returned uncategorized rather than forced into a bucket. Deterministic; billed per record. Cost: metered per record.","operationId":"classify","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"subject":{"type":"string"}},"required":["subject"],"additionalProperties":true},"field":{"type":"string"},"categories":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"keywords":{"type":"array","items":{"type":"string"}}},"required":["name","keywords"],"additionalProperties":true}}},"required":["data","field","categories"],"additionalProperties":true},"examples":{"classify":{"summary":"Classify","value":{"data":{"subject":"Refund request for an overcharge on my invoice"},"field":"subject","categories":[{"name":"billing","keywords":["refund","charge","invoice"]},{"name":"support","keywords":["error","bug","broken"]}]}}}}}},"responses":{"200":{"description":"Classify result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/tag":{"post":{"tags":["Data Preparation"],"summary":"Multi-label tagging: apply every tag whose keywords match.","description":"Multi-label tagging: applies every tag whose keywords appear in the record's text, so a record can carry many tags or none. Deterministic; billed per record. Cost: metered per record.","operationId":"tag","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"note":{"type":"string"}},"required":["note"],"additionalProperties":true},"field":{"type":"string"},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"keywords":{"type":"array","items":{"type":"string"}}},"required":["name","keywords"],"additionalProperties":true}}},"required":["data","field","tags"],"additionalProperties":true},"examples":{"tag":{"summary":"Tag","value":{"data":{"note":"urgent refund needed today"},"field":"note","tags":[{"name":"urgent","keywords":["urgent","asap","today"]},{"name":"billing","keywords":["refund","invoice"]}]}}}}}},"responses":{"200":{"description":"Tag result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/drift":{"post":{"tags":["Intelligence"],"summary":"Compare a baseline to current data and report per-field drift.","description":"Compares a baseline record set against a current one and reports per-field drift: change in fill rate, change in type agreement, and numeric mean shift. Reuses the shared completeness and consistency primitives. Deterministic; billed per record across both sets. Cost: metered per record.","operationId":"drift","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"baseline":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string"}},"required":["amount"],"additionalProperties":true}},"current":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string"}},"required":["amount"],"additionalProperties":true}}},"required":["baseline","current"],"additionalProperties":true},"examples":{"drift":{"summary":"Drift","value":{"baseline":[{"amount":"100"},{"amount":"110"}],"current":[{"amount":"500"},{"amount":"520"}]}}}}}},"responses":{"200":{"description":"Drift result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/change-detect":{"post":{"tags":["Intelligence"],"summary":"A keyed diff: added, removed, changed, and unchanged records.","description":"A keyed diff between two snapshots of a dataset: classifies each keyed record as added, removed, changed, or unchanged, with field-level changes from the shared compare engine. Deterministic; billed per record across both snapshots. Cost: metered per record.","operationId":"changeDetect","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"before":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}},"required":["id","status"],"additionalProperties":true}},"after":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}},"required":["id","status"],"additionalProperties":true}},"key_fields":{"type":"array","items":{"type":"string"}}},"required":["before","after","key_fields"],"additionalProperties":true},"examples":{"change_detect":{"summary":"Change Detect","value":{"before":[{"id":"1","status":"open"}],"after":[{"id":"1","status":"paid"}],"key_fields":["id"]}}}}}},"responses":{"200":{"description":"Change Detect result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/redact":{"post":{"tags":["Data Preparation"],"summary":"Remove detected PII from string fields, replaced with placeholders.","description":"Removes detected PII (email, phone, SSN, credit card, IP, URL) from the string fields of your records, replacing each with a typed placeholder or a fixed marker. Card numbers must pass a Luhn check to be redacted. Deterministic; billed per record. Cost: metered per record.","operationId":"redact","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"note":{"type":"string"}},"required":["note"],"additionalProperties":true}},"required":["data"],"additionalProperties":true},"examples":{"redact":{"summary":"Redact","value":{"data":{"note":"email me at john@acme.com or call 704-555-1234"}}}}}}},"responses":{"200":{"description":"Redact result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/mask":{"post":{"tags":["Data Preparation"],"summary":"Mask detected PII while preserving recognizable shape.","description":"Masks detected PII in the string fields of your records while preserving enough shape to stay recognizable (jo•••@acme.com, ••••1234), so masked data stays format-safe. Deterministic; billed per record. Cost: metered per record.","operationId":"mask","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"note":{"type":"string"}},"required":["note"],"additionalProperties":true}},"required":["data"],"additionalProperties":true},"examples":{"mask":{"summary":"Mask","value":{"data":{"note":"card 4111 1111 1111 1111 on file"}}}}}}},"responses":{"200":{"description":"Mask result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/rules":{"post":{"tags":["Orchestration"],"summary":"Evaluate a data-only rule set against every record.","description":"Evaluates a data-only rule set against every record and returns the rules that matched, each with its opaque `then` payload. The engine has no code evaluation and a fixed operator set, so rules can never execute arbitrary logic. Deterministic; billed per record. Cost: metered per record.","operationId":"rules","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"amount":{"type":"string"},"region":{"type":"string"}},"required":["amount","region"],"additionalProperties":true},"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"when":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"op":{"type":"string"},"value":{"type":"integer"}},"required":["field","op","value"],"additionalProperties":true}},"then":{"type":"object","properties":{"tier":{"type":"string"}},"required":["tier"],"additionalProperties":true}},"required":["name","when","then"],"additionalProperties":true}}},"required":["data","rules"],"additionalProperties":true},"examples":{"rules":{"summary":"Rules","value":{"data":{"amount":"1500","region":"US"},"rules":[{"name":"high_value","when":[{"field":"amount","op":"gt","value":1000}],"then":{"tier":"priority"}}]}}}}}},"responses":{"200":{"description":"Rules result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/route":{"post":{"tags":["Orchestration"],"summary":"Assign each record a destination by first-match-wins rules.","description":"Assigns each record a destination using first-match-wins over an ordered rule set, falling back to a default when nothing matches. Reuses the shared safe rule engine. Deterministic and total — every record gets a destination. Billed per record. Cost: metered per record.","operationId":"route","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"region":{"type":"string"}},"required":["region"],"additionalProperties":true},"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"when":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"op":{"type":"string"},"value":{"type":"string"}},"required":["field","op","value"],"additionalProperties":true}},"then":{"type":"object","properties":{"destination":{"type":"string"}},"required":["destination"],"additionalProperties":true}},"required":["name","when","then"],"additionalProperties":true}},"fallback":{"type":"string"}},"required":["data","rules","fallback"],"additionalProperties":true},"examples":{"route":{"summary":"Route","value":{"data":{"region":"EU"},"rules":[{"name":"eu","when":[{"field":"region","op":"eq","value":"EU"}],"then":{"destination":"eu-queue"}}],"fallback":"default-queue"}}}}}},"responses":{"200":{"description":"Route result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/profile":{"post":{"tags":["Intelligence"],"summary":"Get a per-field profile of any record set in one call.","description":"Profiles a record set: row and field counts, duplicate rows, per-field inferred type with confidence, null counts, and distinct-value counts. A deterministic overview you can run before any other operation. Cost: metered per record.","operationId":"profile","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"age":{"type":"integer"}},"required":["name","email","age"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"profile":{"summary":"Profile","value":{"data":[{"name":"John","email":"john@example.com","age":42},{"name":"Jane","email":"jane@example.com","age":30}]}}}}}},"responses":{"200":{"description":"Profile result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/statistics":{"post":{"tags":["Intelligence"],"summary":"Descriptive statistics for every numeric field.","description":"Computes count, min, max, sum, mean, median, mode, variance, standard deviation, and percentiles (p25/p50/p75/p90/p95/p99) for each numeric field in the record set. Cost: metered per record.","operationId":"statistics","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"revenue":{"type":"integer"}},"required":["revenue"],"additionalProperties":true}},"options":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"string"}}},"required":["fields"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"statistics":{"summary":"Statistics","value":{"data":[{"revenue":1200},{"revenue":900},{"revenue":1500}],"options":{"fields":["revenue"]}}}}}}},"responses":{"200":{"description":"Statistics result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/missing":{"post":{"tags":["Intelligence"],"summary":"Find and quantify missing values per field.","description":"Reports total missing values and a per-field breakdown (missing count and percentage), treating null, undefined, and empty string as missing. Use it to target imputation or reject incomplete uploads. Cost: metered per record.","operationId":"missing","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"missing":{"summary":"Missing","value":{"data":[{"name":"John","email":"john@example.com"},{"name":"Jane","email":""}]}}}}}},"responses":{"200":{"description":"Missing result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/distributions":{"post":{"tags":["Intelligence"],"summary":"Histogram, skew, and outliers for numeric fields.","description":"Bins each numeric field into a histogram and reports median-based skewness plus possible outliers by Tukey's rule (1.5x IQR beyond the quartiles) — robust on small or skewed columns where a sigma rule fails. Cost: metered per record.","operationId":"distributions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"v":{"type":"integer"}},"required":["v"],"additionalProperties":true}},"options":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"string"}},"bins":{"type":"integer"}},"required":["fields","bins"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"distributions":{"summary":"Distributions","value":{"data":[{"v":10},{"v":11},{"v":12},{"v":40}],"options":{"fields":["v"],"bins":4}}}}}}},"responses":{"200":{"description":"Distributions result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/quality-score":{"post":{"tags":["Intelligence"],"summary":"A composite 0-100 data-quality score with components.","description":"Combines completeness, validity, consistency, and uniqueness into a single 0-100 score with each component surfaced, so you can gate an import on a quality threshold. Cost: metered per record.","operationId":"qualityScore","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"quality_score":{"summary":"Quality Score","value":{"data":[{"name":"John","email":"john@example.com"},{"name":"Jane","email":"invalid"}]}}}}}},"responses":{"200":{"description":"Quality Score result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/correlations":{"post":{"tags":["Intelligence"],"summary":"Pairwise Pearson correlation across numeric fields.","description":"Computes the Pearson correlation coefficient for every pair of numeric fields and labels each pair's strength and direction. Deterministic and dependency-free. Cost: metered per record.","operationId":"correlations","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"x":{"type":"integer"},"y":{"type":"integer"}},"required":["x","y"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"correlations":{"summary":"Correlations","value":{"data":[{"x":1,"y":2},{"x":2,"y":4},{"x":3,"y":6}]}}}}}},"responses":{"200":{"description":"Correlations result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/trends":{"post":{"tags":["Intelligence"],"summary":"Ordinary-least-squares trend, growth, and volatility.","description":"Orders a numeric field by an optional date field and fits an OLS line to report slope, direction, total growth, and volatility. A transparent, reproducible trend read — no black-box model. Cost: metered per record.","operationId":"trends","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"sales":{"type":"integer"}},"required":["month","sales"],"additionalProperties":true}},"options":{"type":"object","properties":{"field":{"type":"string"},"date_field":{"type":"string"}},"required":["field","date_field"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"trends":{"summary":"Trends","value":{"data":[{"month":"2024-01","sales":100},{"month":"2024-02","sales":130},{"month":"2024-03","sales":170}],"options":{"field":"sales","date_field":"month"}}}}}}},"responses":{"200":{"description":"Trends result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/change-points":{"post":{"tags":["Intelligence"],"summary":"Detect level shifts in a numeric series.","description":"Scans a numeric series for mean shifts, scoring each candidate against a robust noise floor (median absolute consecutive difference) so a genuine level change is not masked by the variance it introduces. Distinct from keyed row diffing (change-detect). Cost: metered per record.","operationId":"changePoints","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"v":{"type":"integer"}},"required":["v"],"additionalProperties":true}},"options":{"type":"object","properties":{"field":{"type":"string"}},"required":["field"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"change_points":{"summary":"Change Points","value":{"data":[{"v":10},{"v":11},{"v":10},{"v":40},{"v":41},{"v":39}],"options":{"field":"v"}}}}}}},"responses":{"200":{"description":"Change Points result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/patterns":{"post":{"tags":["Intelligence"],"summary":"Discover character-class format patterns per field.","description":"Masks each value into a character-class pattern (letters, digits, punctuation) and reports the most frequent formats per field with their share — ideal for spotting inconsistent phone or code formats. Cost: metered per record.","operationId":"patterns","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string"}},"required":["phone"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"patterns":{"summary":"Patterns","value":{"data":[{"phone":"555-123-4567"},{"phone":"5551234567"}]}}}}}},"responses":{"200":{"description":"Patterns result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/schema-diff":{"post":{"tags":["Intelligence"],"summary":"Compare inferred schemas of two record sets.","description":"Infers a schema for each of two record sets and reports added fields, removed fields, and per-field type changes — a fast guard against silent upstream schema drift. Cost: metered per record.","operationId":"schemaDiff","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source_a":{"type":"array","items":{"type":"object","properties":{"first_name":{"type":"string"},"age":{"type":"integer"}},"required":["first_name","age"],"additionalProperties":true}},"source_b":{"type":"array","items":{"type":"object","properties":{"firstName":{"type":"string"},"age":{"type":"string"}},"required":["firstName","age"],"additionalProperties":true}}},"required":["source_a","source_b"],"additionalProperties":true},"examples":{"schema_diff":{"summary":"Schema Diff","value":{"source_a":[{"first_name":"Jane","age":30}],"source_b":[{"firstName":"Jane","age":"thirty"}]}}}}}},"responses":{"200":{"description":"Schema Diff result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/schema-validate":{"post":{"tags":["Intelligence"],"summary":"Validate records against a declared field schema.","description":"Checks every record against a declared schema (per-field type and required flag) and splits the set into valid and invalid records with per-record reasons. Deterministic; no data is mutated. Cost: metered per record.","operationId":"schemaValidate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"age":{"type":"integer"}},"required":["email","age"],"additionalProperties":true}},"options":{"type":"object","properties":{"schema":{"type":"object","properties":{"email":{"type":"object","properties":{"type":{"type":"string"},"required":{"type":"boolean"}},"required":["type","required"],"additionalProperties":true},"age":{"type":"object","properties":{"type":{"type":"string"}},"required":["type"],"additionalProperties":true}},"required":["email","age"],"additionalProperties":true}},"required":["schema"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"schema_validate":{"summary":"Schema Validate","value":{"data":[{"email":"a@b.com","age":30},{"email":"nope","age":"x"}],"options":{"schema":{"email":{"type":"email","required":true},"age":{"type":"integer"}}}}}}}}},"responses":{"200":{"description":"Schema Validate result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/validate-email":{"post":{"tags":["Intelligence"],"summary":"Syntax + structural email validation with normalization.","description":"Validates each email for syntax and structure, extracts the domain, flags common disposable domains, and returns a normalized form. Deterministic — it does not send network probes. Cost: metered per record.","operationId":"validateEmail","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"}},"required":["email"],"additionalProperties":true}},"options":{"type":"object","properties":{"field":{"type":"string"}},"required":["field"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"validate_email":{"summary":"Validate Email","value":{"data":[{"email":"John@Example.com"},{"email":"bad@"}],"options":{"field":"email"}}}}}}},"responses":{"200":{"description":"Validate Email result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/pii-detect":{"post":{"tags":["Data Preparation"],"summary":"Locate PII without ever echoing the sensitive values.","description":"Scans records for emails, phone numbers, SSNs, credit cards, and other PII, returning counts and the field/record locations of each finding. Never returns the sensitive value itself — safe to log. Cost: metered per record.","operationId":"piiDetect","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"note":{"type":"string"}},"required":["note"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"pii_detect":{"summary":"PII Detect","value":{"data":[{"note":"reach me at jane@example.com or 555-123-4567"}]}}}}}},"responses":{"200":{"description":"PII Detect result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/similarity":{"post":{"tags":["Data Preparation"],"summary":"Score pairwise similarity within one record set.","description":"Compares records field-by-field (numeric closeness and string edit distance) and returns pairs above a similarity threshold. Use it to surface fuzzy duplicates before merging. Cost: metered per record.","operationId":"similarity","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":true}},"options":{"type":"object","properties":{"threshold":{"type":"number"}},"required":["threshold"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"similarity":{"summary":"Similarity","value":{"data":[{"name":"Acme Inc"},{"name":"ACME, Inc."},{"name":"Globex"}],"options":{"threshold":0.6}}}}}}},"responses":{"200":{"description":"Similarity result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/link":{"post":{"tags":["Data Preparation"],"summary":"Record linkage across two datasets.","description":"Links records across two datasets by field-level similarity, returning matched pairs with their score and matching fields plus the unmatched rows on each side. Deterministic greedy matching above a threshold. Cost: metered per record.","operationId":"link","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source_a":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email","name"],"additionalProperties":true}},"source_b":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email","name"],"additionalProperties":true}},"options":{"type":"object","properties":{"threshold":{"type":"number"}},"required":["threshold"],"additionalProperties":true}},"required":["source_a","source_b","options"],"additionalProperties":true},"examples":{"link":{"summary":"Link","value":{"source_a":[{"email":"alan@example.com","name":"Alan"}],"source_b":[{"email":"alan@example.com","name":"Alan"}],"options":{"threshold":0.8}}}}}}},"responses":{"200":{"description":"Link result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/impute":{"post":{"tags":["Data Preparation"],"summary":"Fill missing values with a chosen strategy.","description":"Fills missing values using mean, median, mode, a constant, or forward/backward fill, and reports how many values were filled. Returns the completed record set — the input is never mutated in place. Cost: metered per record.","operationId":"impute","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"v":{"type":"integer"}},"required":["v"],"additionalProperties":true}},"options":{"type":"object","properties":{"strategy":{"type":"string"}},"required":["strategy"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"impute":{"summary":"Impute","value":{"data":[{"v":10},{"v":null},{"v":20}],"options":{"strategy":"mean"}}}}}}},"responses":{"200":{"description":"Impute result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/normalize-phone":{"post":{"tags":["Data Preparation"],"summary":"Normalize phone numbers to E.164 format.","description":"Strips formatting and normalizes phone numbers to E.164 using a default country code for local numbers, flagging values that cannot be normalized. Deterministic and offline. Cost: metered per record.","operationId":"normalizePhone","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string"}},"required":["phone"],"additionalProperties":true}},"options":{"type":"object","properties":{"field":{"type":"string"},"default_country_code":{"type":"string"}},"required":["field","default_country_code"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"normalize_phone":{"summary":"Normalize Phone","value":{"data":[{"phone":"(555) 123-4567"}],"options":{"field":"phone","default_country_code":"1"}}}}}}},"responses":{"200":{"description":"Normalize Phone result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/normalize-address":{"post":{"tags":["Data Preparation"],"summary":"Canonicalize address strings to a consistent form.","description":"Standardizes address casing, whitespace, and common abbreviations (St, Ave, Blvd) to a consistent form for grouping and matching. Deterministic string normalization, not a postal-validation lookup. Cost: metered per record.","operationId":"normalizeAddress","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"}},"required":["address"],"additionalProperties":true}},"options":{"type":"object","properties":{"field":{"type":"string"}},"required":["field"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"normalize_address":{"summary":"Normalize Address","value":{"data":[{"address":"123 main st.  APT 4"}],"options":{"field":"address"}}}}}}},"responses":{"200":{"description":"Normalize Address result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/normalize-url":{"post":{"tags":["Data Preparation"],"summary":"Canonicalize URLs (scheme, host, port, path, query).","description":"Lowercases scheme and host, drops default ports, resolves dot segments, and optionally sorts query parameters to produce a canonical URL for deduplication. Deterministic. Cost: metered per record.","operationId":"normalizeUrl","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":true}},"options":{"type":"object","properties":{"field":{"type":"string"}},"required":["field"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"normalize_url":{"summary":"Normalize URL","value":{"data":[{"url":"HTTP://Example.com:80/a/../b?z=1&a=2"}],"options":{"field":"url"}}}}}}},"responses":{"200":{"description":"Normalize URL result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/text-clean":{"post":{"tags":["Data Preparation"],"summary":"Normalize whitespace, case, and punctuation in text.","description":"Cleans a text string with optional lowercasing, whitespace collapsing, punctuation stripping, and accent folding. Deterministic and composable with the text-intelligence operations. Cost: metered per record.","operationId":"textClean","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"options":{"type":"object","properties":{"lowercase":{"type":"boolean"},"collapse_whitespace":{"type":"boolean"},"strip_punctuation":{"type":"boolean"}},"required":["lowercase","collapse_whitespace","strip_punctuation"],"additionalProperties":true}},"required":["text","options"],"additionalProperties":true},"examples":{"text_clean":{"summary":"Text Clean","value":{"text":"  Hello,   WORLD!!  ","options":{"lowercase":true,"collapse_whitespace":true,"strip_punctuation":true}}}}}}},"responses":{"200":{"description":"Text Clean result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/cluster":{"post":{"tags":["Data Preparation"],"summary":"Group records into clusters by similarity.","description":"Groups records via single-linkage clustering over field similarity above a threshold, returning a cluster id per record and cluster sizes. Dependency-free — no external ML runtime. Cost: metered per record.","operationId":"cluster","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":true}},"options":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"string"}},"threshold":{"type":"number"}},"required":["fields","threshold"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"cluster":{"summary":"Cluster","value":{"data":[{"name":"Acme Inc"},{"name":"ACME, Inc."},{"name":"Globex"}],"options":{"fields":["name"],"threshold":0.6}}}}}}},"responses":{"200":{"description":"Cluster result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/rank":{"post":{"tags":["Data Preparation"],"summary":"Weighted-score and rank records by chosen fields.","description":"Computes a weighted score from selected numeric fields (with optional normalization and direction) and returns the records with a score and rank attached, ordered best-first. Deterministic. Cost: metered per record.","operationId":"rank","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"revenue":{"type":"integer"},"churn":{"type":"number"}},"required":["name","revenue","churn"],"additionalProperties":true}},"options":{"type":"object","properties":{"weights":{"type":"object","properties":{"revenue":{"type":"integer"},"churn":{"type":"integer"}},"required":["revenue","churn"],"additionalProperties":true}},"required":["weights"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"rank":{"summary":"Rank","value":{"data":[{"name":"A","revenue":1000,"churn":0.1},{"name":"B","revenue":500,"churn":0.5}],"options":{"weights":{"revenue":1,"churn":-1}}}}}}}},"responses":{"200":{"description":"Rank result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/segment":{"post":{"tags":["Data Preparation"],"summary":"Assign records to segments with first-match rules.","description":"Assigns each record to the first matching segment rule (numeric range or equality on a field) with a default bucket for the rest, and reports segment sizes. Deterministic rule evaluation. Cost: metered per record.","operationId":"segment","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"mrr":{"type":"integer"}},"required":["mrr"],"additionalProperties":true}},"options":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"field":{"type":"string"},"min":{"type":"integer"}},"required":["name","field","min"],"additionalProperties":true}}},"required":["rules"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"segment":{"summary":"Segment","value":{"data":[{"mrr":1200},{"mrr":50}],"options":{"rules":[{"name":"enterprise","field":"mrr","min":1000},{"name":"smb","field":"mrr","max":999}]}}}}}}},"responses":{"200":{"description":"Segment result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/json-repair":{"post":{"tags":["Data Preparation"],"summary":"Repair common JSON syntax errors into valid JSON.","description":"Repairs frequently-seen JSON defects — trailing commas, single quotes, and unquoted keys — and returns valid parsed JSON with the list of repairs applied. Bounded and deterministic. Cost: metered per record.","operationId":"jsonRepair","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"string"}},"required":["input"],"additionalProperties":true},"examples":{"json_repair":{"summary":"JSON Repair","value":{"input":"{'a':1, b:2,}"}}}}}},"responses":{"200":{"description":"JSON Repair result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/flatten":{"post":{"tags":["Data Preparation"],"summary":"Flatten nested records into dot-path keys.","description":"Flattens nested objects and arrays into single-level records with dot-path keys. Prototype-pollution safe and depth-bounded. Pairs with unflatten to round-trip. Cost: metered per record.","operationId":"flatten","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"a":{"type":"object","properties":{"b":{"type":"object","properties":{"c":{"type":"integer"}},"required":["c"],"additionalProperties":true}},"required":["b"],"additionalProperties":true},"d":{"type":"array","items":{"type":"integer"}}},"required":["a","d"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"flatten":{"summary":"Flatten","value":{"data":[{"a":{"b":{"c":1}},"d":[1,2]}]}}}}}},"responses":{"200":{"description":"Flatten result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/unflatten":{"post":{"tags":["Data Preparation"],"summary":"Rebuild nested records from dot-path keys.","description":"Rebuilds nested objects from dot-path keys, guarding every path segment against prototype-pollution keys. The inverse of flatten (arrays are rebuilt as index-keyed objects). Cost: metered per record.","operationId":"unflatten","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"a.b.c":{"type":"integer"},"d.0":{"type":"integer"},"d.1":{"type":"integer"}},"required":["a.b.c","d.0","d.1"],"additionalProperties":true}}},"required":["data"],"additionalProperties":true},"examples":{"unflatten":{"summary":"Unflatten","value":{"data":[{"a.b.c":1,"d.0":1,"d.1":2}]}}}}}},"responses":{"200":{"description":"Unflatten result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/convert":{"post":{"tags":["Data Preparation"],"summary":"Convert records between JSON and CSV/TSV.","description":"Converts a record set to CSV/TSV or parses delimited text back into records, following RFC 4180 quoting. Deterministic first-seen column ordering. Cost: metered per record.","operationId":"convert","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"a":{"type":"integer"},"b":{"type":"string"}},"required":["a","b"],"additionalProperties":true}},"options":{"type":"object","properties":{"to":{"type":"string"}},"required":["to"],"additionalProperties":true}},"required":["data","options"],"additionalProperties":true},"examples":{"convert":{"summary":"Convert","value":{"data":[{"a":1,"b":"x,y"},{"a":2,"b":"z"}],"options":{"to":"csv"}}}}}}},"responses":{"200":{"description":"Convert result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/sentiment":{"post":{"tags":["Intelligence"],"summary":"Lexicon-based sentiment with negation handling.","description":"Scores text sentiment with a polarity lexicon and negation handling, returning a label and a normalized score. A transparent heuristic — honestly labeled, not a neural model. Cost: metered per record.","operationId":"sentiment","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"],"additionalProperties":true},"examples":{"sentiment":{"summary":"Sentiment","value":{"text":"The product is great but support was terrible"}}}}}},"responses":{"200":{"description":"Sentiment result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/language":{"post":{"tags":["Intelligence"],"summary":"Detect the dominant language of a text.","description":"Detects the most likely language of a text from stop-word and character-frequency profiles, returning the top guess with a confidence. Deterministic and offline over the supported language set. Cost: metered per record.","operationId":"language","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"],"additionalProperties":true},"examples":{"language":{"summary":"Language","value":{"text":"le chat est sur la table et il est content"}}}}}},"responses":{"200":{"description":"Language result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/entities":{"post":{"tags":["Intelligence"],"summary":"Extract emails, phones, money, dates, and proper nouns.","description":"Extracts entities — email, url, phone, money, date, and capitalized proper-noun spans — from free text using deterministic regex and heuristics. No model calls; every match is traceable. Cost: metered per record.","operationId":"entities","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"],"additionalProperties":true},"examples":{"entities":{"summary":"Entities","value":{"text":"Contact Jane Doe at jane@acme.com by 2024-06-01 for $50"}}}}}},"responses":{"200":{"description":"Entities result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/keywords":{"post":{"tags":["Intelligence"],"summary":"Rank the most salient terms in a text.","description":"Tokenizes text, removes stop words, and ranks terms by frequency to return the top keywords with counts. Deterministic term-frequency scoring. Cost: metered per record.","operationId":"keywords","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"],"additionalProperties":true},"examples":{"keywords":{"summary":"Keywords","value":{"text":"data quality tooling improves data pipelines and data trust"}}}}}},"responses":{"200":{"description":"Keywords result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/text-similarity":{"post":{"tags":["Intelligence"],"summary":"Jaccard and cosine similarity between two texts.","description":"Compares two texts by token-set Jaccard and term-frequency cosine similarity, returning both scores in [0,1]. Deterministic and dependency-free. Cost: metered per record.","operationId":"textSimilarity","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text_a":{"type":"string"},"text_b":{"type":"string"}},"required":["text_a","text_b"],"additionalProperties":true},"examples":{"text_similarity":{"summary":"Text Similarity","value":{"text_a":"the quick brown fox","text_b":"the quick red fox"}}}}}},"responses":{"200":{"description":"Text Similarity result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/summarize":{"post":{"tags":["Intelligence"],"summary":"Extractive summary — pick the most salient sentences.","description":"Produces an extractive summary by scoring sentences on keyword salience and returning the top N in original order. Extractive by design — it never fabricates text, so output is always grounded in the input. Cost: metered per record.","operationId":"summarize","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"options":{"type":"object","properties":{"sentences":{"type":"integer"}},"required":["sentences"],"additionalProperties":true}},"required":["text","options"],"additionalProperties":true},"examples":{"summarize":{"summary":"Summarize","value":{"text":"Data quality matters. Bad data costs money every day. Our tool finds issues fast. It integrates with pipelines easily.","options":{"sentences":2}}}}}}},"responses":{"200":{"description":"Summarize result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/topics":{"post":{"tags":["Intelligence"],"summary":"Surface recurring terms across a document set.","description":"Aggregates term and document frequency across a set of documents to surface the most representative terms per topic bucket. A transparent frequency method, not opaque LDA. Cost: metered per record.","operationId":"topics","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"string"}}},"required":["documents"],"additionalProperties":true},"examples":{"topics":{"summary":"Topics","value":{"documents":["billing invoice payment","payment refund invoice","login password account"]}}}}}},"responses":{"200":{"description":"Topics result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/html-extract":{"post":{"tags":["Intelligence"],"summary":"Extract title, headings, links, and text from HTML.","description":"Parses an HTML string with a dependency-free scanner to return the title, headings, links, and visible text, ignoring script and style content. Deterministic; no network fetch. Cost: metered per record.","operationId":"htmlExtract","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"html":{"type":"string"}},"required":["html"],"additionalProperties":true},"examples":{"html_extract":{"summary":"HTML Extract","value":{"html":"<title>Hi</title><h1>Welcome</h1><p>Read <a href=\"/x\">more</a></p>"}}}}}},"responses":{"200":{"description":"HTML Extract result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/forecast":{"post":{"tags":["Intelligence"],"summary":"Project a numeric series forward with a linear model.","description":"Projects a numeric series forward with an ordinary-least-squares linear trend and residual-based confidence bands. A transparent baseline forecast — the method and its uncertainty are fully inspectable. Cost: metered per record.","operationId":"forecast","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"series":{"type":"array","items":{"type":"integer"}},"options":{"type":"object","properties":{"periods":{"type":"integer"}},"required":["periods"],"additionalProperties":true}},"required":["series","options"],"additionalProperties":true},"examples":{"forecast":{"summary":"Forecast","value":{"series":[100,120,140,160,180],"options":{"periods":3}}}}}}},"responses":{"200":{"description":"Forecast result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}}},"components":{"schemas":{"LeadInput":{"type":"object","required":["status","lead_age_days"],"properties":{"lead_id":{"type":"string","maxLength":200,"description":"Your identifier, echoed back on the response."},"industry":{"type":"string","enum":["hvac","plumbing","electrical","roofing","automotive","b2b_sales","generic"],"default":"generic"},"status":{"type":"string","enum":["new","contacted","quote_requested","estimate_sent","proposal_sent","negotiating","no_response","closed_won","closed_lost","opted_out"]},"lead_age_days":{"type":"integer","minimum":0,"description":"Days since the lead was created."},"last_contact_days":{"type":"integer","minimum":0},"contact_attempts":{"type":"integer","minimum":0},"estimate_value":{"type":"number","minimum":0},"source":{"type":"string","maxLength":120},"explicit_rejection":{"type":"boolean"},"opted_out":{"type":"boolean"},"previous_customer":{"type":"boolean"},"prior_engagement":{"type":"boolean"},"invalid_contact":{"type":"boolean"},"duplicate":{"type":"boolean"},"closed_lost_reason":{"type":"string","maxLength":500},"repeat_service":{"type":"boolean"},"first_name":{"type":"string","maxLength":120}}},"BatchInput":{"type":"object","required":["leads"],"properties":{"leads":{"type":"array","minItems":1,"maxItems":1000,"items":{"$ref":"#/components/schemas/LeadInput"}}}},"RecoveryResult":{"type":"object","properties":{"request_id":{"type":"string"},"lead_id":{"type":"string","nullable":true},"recovery_score":{"type":"integer","minimum":0,"maximum":100},"priority":{"type":"string","enum":["high","medium","low"]},"recommended_action":{"type":"string","enum":["follow_up","nurture","deprioritize","archive"]},"recommended_channel":{"type":"string","enum":["sms","email","phone","none"]},"recommended_timing":{"type":"string","enum":["today","this_week","this_month","none"]},"reason":{"type":"string"},"suggested_message":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1},"factors":{"type":"array","items":{"type":"object","properties":{"factor":{"type":"string"},"impact":{"type":"string","enum":["positive","negative","neutral"]},"score_effect":{"type":"integer"},"detail":{"type":"string"}}}},"scoring_version":{"type":"string"}}},"ReconcileInput":{"type":"object","required":["source_a","source_b","matching"],"properties":{"source_a":{"$ref":"#/components/schemas/ReconcileSource"},"source_b":{"$ref":"#/components/schemas/ReconcileSource"},"matching":{"type":"object","required":["primary_keys"],"properties":{"primary_keys":{"type":"array","items":{"type":"string"},"minItems":1},"secondary_keys":{"type":"array","items":{"type":"string"}},"compare_fields":{"type":"array","items":{"type":"string"}},"amount_field":{"type":"string","description":"Field used to compute financial exposure."},"date_fields":{"type":"array","items":{"type":"string"}},"status_fields":{"type":"array","items":{"type":"string"}}}}}},"ReconcileSource":{"type":"object","required":["name","records"],"properties":{"name":{"type":"string"},"records":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"ReconcileResult":{"type":"object","properties":{"request_id":{"type":"string"},"status":{"type":"string","enum":["completed"]},"summary":{"type":"object","properties":{"source_a_name":{"type":"string"},"source_b_name":{"type":"string"},"source_a_count":{"type":"integer"},"source_b_count":{"type":"integer"},"records_processed":{"type":"integer"},"exact_matches":{"type":"integer"},"probable_matches":{"type":"integer"},"conflicts":{"type":"integer"},"duplicates":{"type":"integer"},"unmatched_source_a":{"type":"integer"},"unmatched_source_b":{"type":"integer"},"needs_review":{"type":"integer"},"processing_time_ms":{"type":"integer"}}},"matches":{"type":"array","items":{"type":"object","properties":{"classification":{"type":"string","enum":["exact_match","probable_match","unmatched","conflict","duplicate","needs_review"]},"confidence":{"type":"number","minimum":0,"maximum":1},"matched_on":{"type":"string","enum":["primary","secondary","none"]},"keys":{"type":"array","items":{"type":"string"}},"key_value":{"type":"string","nullable":true},"source_a_index":{"type":"integer","nullable":true},"source_b_index":{"type":"integer","nullable":true},"field_diffs":{"type":"array","items":{"type":"object"}}}}},"findings":{"type":"array","items":{"type":"object"}},"financial_exposure":{"type":"object","properties":{"field":{"type":"string"},"currency":{"type":"string","nullable":true},"net_difference":{"type":"number"},"absolute_exposure":{"type":"number"},"items":{"type":"array","items":{"type":"object"}}},"nullable":true},"usage":{"type":"object","properties":{"records_processed":{"type":"integer"}}}}},"BatchResult":{"type":"object","properties":{"request_id":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryResult"}},"summary":{"type":"object","properties":{"total_leads":{"type":"integer"},"high_priority_count":{"type":"integer"},"medium_priority_count":{"type":"integer"},"low_priority_count":{"type":"integer"},"total_pipeline_value":{"type":"number"},"high_priority_pipeline_value":{"type":"number"},"processing_time_ms":{"type":"integer"}}}}},"VerifyInput":{"type":"object","required":["claim"],"properties":{"claim":{"type":"string","maxLength":5000,"description":"The claim to verify. Treated as data, never as instructions."},"evidence":{"type":"array","description":"Supplied evidence items. Only these values are ever used; nothing is fabricated.","items":{"type":"object","required":["value"],"properties":{"source":{"type":"string"},"record_id":{"type":"string","nullable":true},"field":{"type":"string"},"value":{}}}}}},"VerifyResult":{"type":"object","properties":{"request_id":{"type":"string"},"result":{"type":"string","enum":["verified","unsupported","contradicted","insufficient_evidence"]},"supported":{"type":"boolean"},"confidence":{"type":"number","minimum":0,"maximum":1},"evidence":{"type":"array","items":{"type":"object"}},"contradictions":{"type":"array","items":{"type":"object"}},"missing_evidence":{"type":"array","items":{"type":"string"}},"injection_detected":{"type":"boolean","description":"True when injection-like content was seen and ignored."},"reasoning":{"type":"string"}}},"RevenueLeakInput":{"type":"object","description":"Provide at least one of orders, invoices, payments, or credits.","properties":{"orders":{"type":"array","items":{"type":"object","additionalProperties":true}},"invoices":{"type":"array","items":{"type":"object","additionalProperties":true}},"payments":{"type":"array","items":{"type":"object","additionalProperties":true}},"credits":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"RevenueLeakResult":{"type":"object","properties":{"request_id":{"type":"string"},"status":{"type":"string","enum":["completed"]},"summary":{"type":"object","properties":{"records_analyzed":{"type":"integer"},"findings":{"type":"integer"},"processing_time_ms":{"type":"integer"}}},"financial_exposure":{"type":"object","properties":{"potential":{"type":"number"},"verified":{"type":"number"},"currency":{"type":"string","nullable":true}},"nullable":true},"findings":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"monetary_class":{"type":"string","nullable":true},"amount":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"confidence":{"type":"number"},"evidence":{"type":"array","items":{"type":"object"}},"challenges":{"type":"array","items":{"type":"string"}}}}}}},"Error":{"type":"object","required":["error"],"description":"Standard error envelope returned by every endpoint. `code` is a stable machine-readable string; `request_id` should be quoted in support requests.","properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string","enum":["invalid_request","invalid_json","payload_too_large","unauthorized","invalid_api_key","revoked_api_key","forbidden","not_found","conflict","usage_limit_exceeded","rate_limit_exceeded","internal_error"]},"message":{"type":"string"},"request_id":{"type":"string","example":"req_9f2c1a7b3e5d4c8f0a1b2c3d"},"details":{"type":"object","description":"Optional structured context. For usage_limit_exceeded this carries records_used, records_limit, records_remaining, upgrade_required, and recommended_plan.","additionalProperties":true}}}}},"Usage":{"type":"object","properties":{"plan":{"type":"string","example":"free"},"period":{"type":"object","properties":{"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"}}},"usage":{"type":"object","properties":{"records_used":{"type":"integer","example":420},"records_limit":{"type":"integer","example":1000},"records_remaining":{"type":"integer","example":580},"percentage":{"type":"number","example":42}}},"by_api":{"type":"object","additionalProperties":{"type":"integer"},"description":"Records processed this period, keyed by product code."}}}},"responses":{"Error":{"description":"Standard error envelope with a request_id for support.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"unauthorized":{"summary":"Missing or invalid API key","value":{"error":{"code":"unauthorized","message":"Missing API key. Provide it as `Authorization: Bearer <key>` or an `X-Zapinner-Key: <key>` header.","request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d"}}},"usageLimit":{"summary":"Monthly record allowance exceeded","value":{"error":{"code":"usage_limit_exceeded","message":"This request would exceed your monthly record allowance.","request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d","details":{"code":"MONTHLY_RECORD_LIMIT_REACHED","records_used":1000,"records_requested":5,"records_limit":1000,"records_remaining":0,"upgrade_required":true,"recommended_plan":"starter"}}}},"rateLimit":{"summary":"Burst rate limit exceeded","value":{"error":{"code":"rate_limit_exceeded","message":"Too many requests. Slow down and retry shortly.","request_id":"req_9f2c1a7b3e5d4c8f0a1b2c3d"}}}}}}}}}}