{"openapi":"3.1.0","info":{"title":"ScanForAI API","description":"Detect AI-written text and clean it up. Public endpoints: **scan** a document for AI-writing signals, and **cleanup** (strip machine typography, no rewriting). Authenticate with an `at_sk_` API key: `Authorization: Bearer <key>`. The score is a signal, not a verdict.","version":"0.4.14"},"paths":{"/api/scan":{"post":{"tags":["scan"],"summary":"Scan Endpoint","operationId":"scan_endpoint_api_scan_post","parameters":[{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"json","title":"Format"}},{"name":"use_model","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Use Model"}},{"name":"include_fixes","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Include Fixes"}},{"name":"background","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Background"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/extract":{"post":{"tags":["scan"],"summary":"Extract Endpoint","description":"Pull plain text out of an uploaded file so the client can drop it INTO the\ntextarea and review it before scanning (not an auto-scan). Nothing is stored.","operationId":"extract_endpoint_api_extract_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/fetch-url":{"post":{"tags":["scan"],"summary":"Fetch Url Endpoint","description":"Fetch a public web page's text for the textarea (review before scanning).\nSSRF-guarded (see services/urlfetch); nothing is stored.","operationId":"fetch_url_endpoint_api_fetch_url_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/config":{"get":{"tags":["scan"],"summary":"Config","description":"Limits the UI needs (counter cap, min-words hint, monthly quota) - no secrets.","operationId":"config_api_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/cleanup":{"post":{"tags":["cleanup"],"summary":"Cleanup","operationId":"cleanup_api_cleanup_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"get":{"tags":["cleanup"],"summary":"List Humanizations","operationId":"list_humanizations_api_cleanup_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"mode","in":"query","required":false,"schema":{"type":"string","default":"light","title":"Mode"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["cleanup"],"summary":"Delete All","operationId":"delete_all_api_cleanup_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/cleanup/file":{"post":{"tags":["cleanup"],"summary":"Cleanup File","description":"Clean an uploaded document IN PLACE and stream the cleaned file back — .docx\nand .odt keep their full structure/formatting; .pdf degrades to cleaned .txt.\nThis is the fix for 'cleaned file comes back as broken plain text'.","operationId":"cleanup_file_api_cleanup_file_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/cleanup/{hid}":{"get":{"tags":["cleanup"],"summary":"Get Humanization","operationId":"get_humanization_api_cleanup__hid__get","parameters":[{"name":"hid","in":"path","required":true,"schema":{"type":"string","title":"Hid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["cleanup"],"summary":"Delete Humanization","operationId":"delete_humanization_api_cleanup__hid__delete","parameters":[{"name":"hid","in":"path","required":true,"schema":{"type":"string","title":"Hid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rewrite/stream":{"post":{"tags":["rewrite"],"summary":"Rewrite Stream","operationId":"rewrite_stream_api_rewrite_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/report":{"post":{"tags":["report"],"summary":"Report","operationId":"report_api_report_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feedback":{"post":{"tags":["feedback"],"summary":"Give Feedback","operationId":"give_feedback_api_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/health":{"get":{"summary":"Health","operationId":"health_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"FeedbackIn":{"properties":{"verdict":{"type":"string","enum":["right","wrong"],"title":"Verdict"},"expected":{"anyOf":[{"type":"string","enum":["human","ai"]},{"type":"null"}],"title":"Expected"},"scan_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Id"},"score":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Score"},"band":{"anyOf":[{"type":"string","maxLength":12},{"type":"null"}],"title":"Band"},"profile":{"anyOf":[{"type":"string","maxLength":12},{"type":"null"}],"title":"Profile"},"genre":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Genre"},"word_count":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Word Count"},"text":{"anyOf":[{"type":"string","maxLength":200000},{"type":"null"}],"title":"Text"},"consent_text":{"type":"boolean","title":"Consent Text","default":false}},"type":"object","required":["verdict"],"title":"FeedbackIn"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ReportIn":{"properties":{"result":{"additionalProperties":true,"type":"object","title":"Result"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"source_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Text"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"scan_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Id"}},"type":"object","required":["result"],"title":"ReportIn"},"SentenceIn":{"properties":{"id":{"type":"string","maxLength":24,"title":"Id"},"text":{"type":"string","maxLength":1200,"minLength":12,"title":"Text"}},"type":"object","required":["id","text"],"title":"SentenceIn"},"StreamIn":{"properties":{"sentences":{"items":{"$ref":"#/components/schemas/SentenceIn"},"type":"array","maxItems":20,"minItems":1,"title":"Sentences"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"}},"type":"object","required":["sentences"],"title":"StreamIn"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}