Skip to content

API built with Python (FastAPI + Microsoft MarkItDown) to convert common document formats (DOCX, PDF, PPTX, images, etc.) into Markdown. Secured with API Key (header X-API-Key) and packaged for Docker/Coolify deployments, including a healthcheck endpoint.

License

THJLI/doc2md-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 Doc2MD API

API built with Python (FastAPI + MarkItDown) to convert documents (DOCX, PDF, PPTX, images, etc.) into Markdown. Includes API Key authentication and is configured to run in Docker/Coolify, with a built-in healthcheck.


✨ Features

  • Convert common document formats to Markdown (.docx, .pdf, .pptx, .xlsx, .html, images, etc.).
  • Secure file upload via multipart/form-data.
  • API Key protection (via X-API-Key header).
  • /health endpoint for monitoring.
  • Ready for Docker and DevContainer environments.

🚀 Running Locally

Requirements

Local setup

pip install -r requirements.txt
uvicorn app:api --reload

Access the API at: http://localhost:8000/docs


🐳 Running with Docker

Build

docker build -t doc2md-api .

Run

docker run -e API_KEY=supersecret -p 8000:8000 doc2md-api

🔑 Authentication

All requests must include the header:

X-API-Key: supersecret

Set your API key via the API_KEY environment variable.


📡 Endpoints

Healthcheck

GET /health

Response:

{ "status": "ok" }

Convert document

POST /convert

Headers:

X-API-Key: supersecret

Body (form-data):

  • file: document file (.docx, .pdf, etc.)

Example using curl:

curl -H "X-API-Key: supersecret" \
     -F "[email protected]" \
     http://localhost:8000/convert

Response:

{
  "filename": "mydocument.md",
  "markdown": "# Title\n\nConverted content in Markdown..."
}

🛠 DevContainer

The project includes VS Code DevContainer support. Open it in VS Code and select “Reopen in Container” to start with a fully prepared development environment.


📜 License

MIT – you are free to use, modify, and contribute.


💰 Donations

This initiative is open-source and free to use. If you find it valuable and would like to contribute, you can make a donation as a way to support the continuation of this work.

PayPal


Project powered by FastAPI and MarkItDown.

About

API built with Python (FastAPI + Microsoft MarkItDown) to convert common document formats (DOCX, PDF, PPTX, images, etc.) into Markdown. Secured with API Key (header X-API-Key) and packaged for Docker/Coolify deployments, including a healthcheck endpoint.

Topics

Resources

License

Stars

Watchers

Forks