Guides
Repairing a file
/v1/repair takes the same upload as /v1/check and answers with a file: repaired if it needed it, your own bytes if it didn't.
Getting the file back
The response body is the file, with the same content type as the one you sent and a Content-Disposition naming it <name>-repaired.<ext>. Save the bytes as they are.
curl https://api.ihatecorruptfiles.xyz/v1/repair \
-H "Authorization: Bearer $IHCF_API_KEY" \
-F file=@report.xlsx \
-D - -o report-fixed.xlsxWhat changed
Three headers describe the repair, so you do not need a second call to find out. X-Repair-Changed is true or false. X-Repair-Level is the last repair stage that changed something — XML, SCHEMA, SEMANTICS and so on — or NONE. X-Repair-Actions is base64 JSON with a count per stage and the fix codes:
import base64, json
summary = json.loads(base64.b64decode(response.headers["X-Repair-Actions"]))
# {"total": 3, "by_stage": {"schema": 1, "semantics": 2}, "codes": ["convert-text-to-number", …]}For the full list of actions with the cells and parts they touch, run /v1/check on the original file.
What a repair promises
A file that needs nothing comes back byte for byte — X-Repair-Changed: false is a promise, not an estimate. A changed file is returned only after Microsoft's Open XML SDK accepts it. Advisory findings are never applied, and nothing is rewritten for style. How repairs work covers the levels.
When there is no file
If the file cannot be repaired, the response is a JSON problem instead: for example 422 encrypted_package for a password-protected file, or 422 openxml_validation_failed if the repaired file still failed validation — we would rather return nothing than a file Office rejects. Check the status code before saving the body.
response.raise_for_status() in Python or if (!response.ok) in JavaScript keeps a problem document from being saved as report-fixed.xlsx.