A FastAPI based docx editor. Edit, highlight, and annotate .docx
files in seconds with literally a simple & fast API. Super good for programmatic document review or edits.
Allows any Custom GPT to call it and process documents at scale to:
- 🔄 Replace, inject, and edit text in
.docx
files - 🎯 Highlight key sections
- 💬 Append inline notes dynamically
- ☁️ Uploads the modified files to
file.io
and returns a public download link
pip install -r requirements.txt
uvicorn main:app --reload
Then go to: http://localhost:8000/docs
Upload a .docx and your edits JSON, and boom -> instant doc enhancement
{
"replacements": {
"Hello": "Hi",
"world": "Earth"
},
"highlightSections": [
"important",
"note"
],
"inlineNotes": {
"FYI": "This was added per client request."
}
}
Field | Type | Description |
---|---|---|
file |
File |
.docx file to be edited |
edits |
string |
JSON string with instructions |
Returns: {"downloadUrl": "https://file.io/abc123"}
curl -X POST https://your-vercel-url.vercel.app/modify-docx \
-F "[email protected]" \
-F 'edits={
"replacements": {"Hello": "Hi"},
"highlightSections": ["important"],
"inlineNotes": {"FYI": "This is a note"}
}'
Make sure:
- Your docx file is named example.docx
- You format your edits as a valid JSON string
import requests
url = "https://your-vercel-url.vercel.app/modify-docx"
files = {"file": open("example.docx", "rb")}
data = {
"edits": '''
{
"replacements": {"Hello": "Hi"},
"highlightSections": ["important"],
"inlineNotes": {"FYI": "This is a note"}
}
'''
}
response = requests.post(url, files=files, data=data)
print(response.json())
If you're using a custom GPT to send JSON instructions… you're already ahead of the game. Add OpenAI or LLM support and you've got a document editing co pilot