{"openapi":"3.0.3","info":{"title":"SICura API","version":"0.1.0","description":"Classify broker free text to SICura codes, and Harmonise codes across Stats SA SIC 7, ISIC Rev.4, NACE Rev.2, NAICS 2022, and UK SIC 2007."},"servers":[{"url":"/api/v1"}],"paths":{"/classify":{"post":{"summary":"Classify a free-text industry description","description":"Hybrid retrieval (BM25 + dense embeddings + RRF) with optional AI Gateway LLM rerank. Returns ranked `candidates[]` (SICura leaves, backward compatible), `groups[]` (Stats SA SIC 7 subclasses with member SICura codes — preferred for insurer UI), decision, optional underwriter `reason`, optional `clarify` chips, and `engine`. Falls back to BM25/hybrid if the LLM is unavailable — never fails the request.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["description"],"properties":{"description":{"type":"string","description":"Activity description only (no personal data). Sent to the LLM when Gateway is configured."},"top_k":{"type":"integer","default":8},"mode":{"type":"string","enum":["bm25","hybrid","full"],"description":"Optional eval mode. Default full = hybrid + LLM when available."}}}}}},"responses":{"200":{"description":"Classification result with candidates[] (SICura), groups[] ({ sic7, title, confidence, breadcrumb, match_titles, members[] }), decision, decision_reason, optional reason (Why this code), optional clarify[], engine.retrieval / engine.rerank / engine.embed / engine.llm (used|skipped:<reason>|error:<code>) / engine.llm_latency_ms"}}}},"/waitlist":{"post":{"summary":"Join the early-access waitlist","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","email","company","segment"],"properties":{"name":{"type":"string"},"email":{"type":"string","format":"email"},"company":{"type":"string"},"segment":{"type":"string","enum":["insurer","UMA","broker","bank","software","other"]},"message":{"type":"string"},"source_path":{"type":"string"},"website":{"type":"string","description":"Honeypot — leave empty"}}}}}},"responses":{"200":{"description":"Stored (or honeypot no-op)"},"400":{"description":"Validation error"},"503":{"description":"Supabase env not configured"}}}},"/convert":{"post":{"summary":"Convert a code between classification systems (Harmonise)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","from"],"properties":{"code":{"type":"string","example":"47212"},"from":{"type":"string","enum":["sicura","sic7","isic4","nace2","naics2022","uksic2007"],"example":"sic7"},"to":{"type":"array","items":{"type":"string"},"example":["isic4","nace2","naics2022","uksic2007"]},"limit_per_system":{"type":"integer","default":8}}}}}},"responses":{"200":{"description":"Normalised source + matches per target system"},"404":{"description":"Unknown code"}}}},"/convert/batch":{"post":{"summary":"Batch-convert up to 1000 codes","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["from","codes"],"properties":{"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"codes":{"type":"array","items":{"type":"string"},"maxItems":1000}}}}}},"responses":{"200":{"description":"Batch results"}}}},"/codes/sicura/{code}":{"get":{"summary":"SICura code hierarchy + optional risk_profile (editorial draft)","description":"Accepts a full SICura code (e.g. C10710002) or a 5-digit Stats SA subclass (e.g. 10710). Returns rollup levels, siblings, SARS note, and `risk_profile` when a draft exists (top ~50 SME subclasses). Hazard grades are indicative editorial ratings — not actuarial. Carbon intensity is mapped via Harmonise to US EPA USEEIO / supply-chain GHG factors when an open NAICS match exists; otherwise `kg_co2e_per_usd` is null with note `no open data`.","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"example":"10710"}],"responses":{"200":{"description":"sicura_code, current, levels, siblings, sars, risk_profile (or null), risk_coverage"},"400":{"description":"Invalid code"}}}},"/codes/{system}/{code}":{"get":{"summary":"Lookup a code and its direct equivalents","parameters":[{"name":"system","in":"path","required":true,"schema":{"type":"string"}},{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Code title + equivalents"}}}}}}