{"openapi":"3.1.0","info":{"title":"Redact Standalone Service","description":"Offline PII redaction — extract text from documents and anonymize with Presidio. No external APIs.","version":"0.1.0"},"paths":{"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Health Health Get"}}}}}}},"/entities":{"get":{"summary":"List Entities","operationId":"list_entities_entities_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntitiesResponse"}}}}}}},"/languages":{"get":{"summary":"List Languages","operationId":"list_languages_languages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LanguagesResponse"}}}}}}},"/redact":{"post":{"summary":"Redact","operationId":"redact_redact_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedactRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedactResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/process":{"post":{"summary":"Process File Endpoint","description":"Extract + redact. Streams NDJSON: one ``extracted_page`` line per page,\nthen a single ``redacted`` line, then ``done``.","operationId":"process_file_endpoint_process_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_process_file_endpoint_process_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/extract":{"post":{"summary":"Extract Endpoint","description":"Stream extracted text. NDJSON: one ``page`` line per page, then a ``summary``.","operationId":"extract_endpoint_extract_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_endpoint_extract_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patterns":{"get":{"summary":"List Patterns","operationId":"list_patterns_patterns_get","parameters":[{"name":"unit","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatternListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Pattern","operationId":"create_pattern_patterns_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatternCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatternResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patterns/units":{"get":{"summary":"List Units","operationId":"list_units_patterns_units_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessUnitsResponse"}}}}}}},"/patterns/{pattern_id}":{"delete":{"summary":"Delete Pattern","operationId":"delete_pattern_patterns__pattern_id__delete","parameters":[{"name":"pattern_id","in":"path","required":true,"schema":{"type":"string","title":"Pattern Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patterns/test":{"post":{"summary":"Test Pattern","operationId":"test_pattern_patterns_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatternTestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatternTestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_extract_endpoint_extract_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_extract_endpoint_extract_post"},"Body_process_file_endpoint_process_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"operator":{"type":"string","title":"Operator","default":"replace"},"language":{"type":"string","title":"Language","default":"auto"},"entities":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entities"}},"type":"object","required":["file"],"title":"Body_process_file_endpoint_process_post"},"BusinessUnit":{"properties":{"id":{"type":"string","enum":["construction","agriculture","geospatial","hr_legal"],"title":"Id"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description"}},"type":"object","required":["id","label","description"],"title":"BusinessUnit"},"BusinessUnitsResponse":{"properties":{"units":{"items":{"$ref":"#/components/schemas/BusinessUnit"},"type":"array","title":"Units"}},"type":"object","required":["units"],"title":"BusinessUnitsResponse"},"EntitiesResponse":{"properties":{"entities":{"items":{"$ref":"#/components/schemas/EntityInfo"},"type":"array","title":"Entities"}},"type":"object","required":["entities"],"title":"EntitiesResponse"},"EntityFound":{"properties":{"type":{"type":"string","title":"Type"},"start":{"type":"integer","title":"Start"},"end":{"type":"integer","title":"End"},"score":{"type":"number","title":"Score"},"original":{"type":"string","title":"Original"}},"type":"object","required":["type","start","end","score","original"],"title":"EntityFound"},"EntityInfo":{"properties":{"id":{"type":"string","title":"Id"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description"}},"type":"object","required":["id","label","description"],"title":"EntityInfo"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LanguageInfo":{"properties":{"code":{"type":"string","title":"Code"},"label":{"type":"string","title":"Label"},"installed":{"type":"boolean","title":"Installed"}},"type":"object","required":["code","label","installed"],"title":"LanguageInfo"},"LanguagesResponse":{"properties":{"languages":{"items":{"$ref":"#/components/schemas/LanguageInfo"},"type":"array","title":"Languages"}},"type":"object","required":["languages"],"title":"LanguagesResponse"},"PatternCreateRequest":{"properties":{"entity_type":{"type":"string","minLength":2,"pattern":"^[A-Z][A-Z0-9_]{1,}$","title":"Entity Type","description":"Uppercase entity identifier, e.g. EMPLOYEE_ID."},"label":{"type":"string","maxLength":80,"minLength":2,"title":"Label"},"description":{"type":"string","maxLength":200,"title":"Description","default":""},"unit":{"type":"string","enum":["construction","agriculture","geospatial","hr_legal"],"title":"Unit"},"patterns":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Patterns"},"context":{"items":{"type":"string"},"type":"array","title":"Context"},"score":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Score","default":0.8}},"type":"object","required":["entity_type","label","unit","patterns"],"title":"PatternCreateRequest"},"PatternListResponse":{"properties":{"patterns":{"items":{"$ref":"#/components/schemas/PatternResponse"},"type":"array","title":"Patterns"}},"type":"object","required":["patterns"],"title":"PatternListResponse"},"PatternMatch":{"properties":{"match":{"type":"string","title":"Match"},"start":{"type":"integer","title":"Start"},"end":{"type":"integer","title":"End"},"pattern":{"type":"string","title":"Pattern"}},"type":"object","required":["match","start","end","pattern"],"title":"PatternMatch"},"PatternResponse":{"properties":{"id":{"type":"string","title":"Id"},"entity_type":{"type":"string","title":"Entity Type"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description","default":""},"unit":{"type":"string","title":"Unit"},"patterns":{"items":{"type":"string"},"type":"array","title":"Patterns"},"context":{"items":{"type":"string"},"type":"array","title":"Context"},"score":{"type":"number","title":"Score"},"builtin":{"type":"boolean","title":"Builtin"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["id","entity_type","label","unit","patterns","context","score","builtin"],"title":"PatternResponse"},"PatternTestRequest":{"properties":{"patterns":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Patterns"},"sample_text":{"type":"string","minLength":1,"title":"Sample Text"}},"type":"object","required":["patterns","sample_text"],"title":"PatternTestRequest"},"PatternTestResponse":{"properties":{"matches":{"items":{"$ref":"#/components/schemas/PatternMatch"},"type":"array","title":"Matches"},"match_count":{"type":"integer","title":"Match Count"}},"type":"object","required":["matches","match_count"],"title":"PatternTestResponse"},"RedactRequest":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Plain text to redact."},"operator":{"type":"string","enum":["replace","redact","mask","hash"],"title":"Operator","default":"replace"},"language":{"type":"string","title":"Language","description":"ISO 639-1 (e.g. 'en') or 'auto'.","default":"auto"},"entities":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Entities","description":"Restrict detection to these entity types."},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id","description":"Correlation id echoed to logs."}},"type":"object","required":["text"],"title":"RedactRequest"},"RedactResponse":{"properties":{"original_text":{"type":"string","title":"Original Text"},"redacted_text":{"type":"string","title":"Redacted Text"},"entities_found":{"items":{"$ref":"#/components/schemas/EntityFound"},"type":"array","title":"Entities Found"},"entity_counts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Entity Counts"},"detected_language":{"type":"string","title":"Detected Language"}},"type":"object","required":["original_text","redacted_text","entities_found","entity_counts","detected_language"],"title":"RedactResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}