This is a simple HTTP API wrapper for the MarkItDown package that allows you to convert various document formats to text using a RESTful API.
app.py
: The Flask application that provides the HTTP APIrequirements.txt
: Python dependenciesDockerfile
: Instructions for building the Docker image
version: "3.8"
services:
markitdown_api:
image: ghcr.io/bitovi/markitdown_api:latest
container_name: markitdown_api
ports:
- "5000:5000"
docker compose up --build -d
The service will be available at http://localhost:5000
GET /health
Returns a 200 OK response if the service is running correctly.
POST /convert
Parameters:
file
: The file to convert (multipart/form-data)
Example usage with curl:
curl -X POST -F "[email protected]" -H "Content-Type: multipart/form-data" -H "Accept: application/json" http://localhost:5000/convert
Example response:
{
"markdown": "Extracted text from the document..."
}
To modify the application:
- Edit the
app.py
file as needed - Rebuild and restart the Docker container:
docker compose down
docker compose up --build -d
You can extend the API by adding more endpoints to app.py
or by adding more features to the existing endpoint.