Deploy Docling Serve
Convert PDFs, Word files and scans into Markdown and JSON for RAG.
docling-worker
Just deployed
docling-serve
Just deployed
Redis
Just deployed
/data
docling-artifacts
Bucket
Just deployed
Deploy and Host Docling Serve on Railway
Docling Serve is the HTTP API for Docling, IBM Research's open source document converter that turns PDFs, Word files, PowerPoint decks, spreadsheets, HTML and scanned images into clean Markdown and structured JSON. Docling understands page layout, reading order, tables, headings, lists, figures and formulas, and runs OCR on scans, so the output is ready for retrieval-augmented generation, search indexes and LLM pipelines. Docling is MIT-licensed and has about 70,600 GitHub stars. This template runs Docling Serve on Railway in a production shape: an API service with an optional web playground, a separate worker that does the heavy conversion, Redis as the job queue, and a Railway object storage bucket for exported files. Every route is protected by a generated API key. It is a self-hosted alternative to paid document parsing APIs such as LlamaParse, so your documents never leave your infrastructure. Expect roughly $20–50/month on Railway, depending on how many pages you process.
What This Template Deploys
| Service | Purpose |
|---|---|
| docling-serve | docling-serve-cpu:v1.30.0 on port 5001 with a public domain. REST API, async task endpoints and the Gradio playground at /ui. |
| docling-worker | The same image running docling-serve rq-worker. Pulls conversion jobs from Redis and runs the models. |
| Redis | Redis 8.2 with a password and a volume. Job queue and result store between API and worker. |
| docling-artifacts bucket | Railway object storage. Converted files the worker uploads, served back through presigned URLs. |
DOCLING_SERVE_API_KEY is generated at deploy time; every request must send it in the X-Api-Key header.
About Hosting Docling Serve
Getting good text out of documents is the unglamorous first step of most AI projects. Plain PDF text extraction scrambles columns, loses tables and drops anything scanned. Docling uses layout and table-structure models to rebuild the document the way a person reads it, then exports it as Markdown for LLMs or as a lossless JSON document with every element and its position.
Why a separate worker. Conversions are CPU-heavy and can take seconds to minutes for long documents. The API service accepts requests and returns quickly, while the worker processes jobs from the Redis queue. Add more worker replicas when you need more throughput, without touching the API.
Many input formats. Besides PDF, Docling reads Word, PowerPoint and Excel files, HTML, Markdown, AsciiDoc, CSV and images such as PNG and JPEG.
Rich output. Export Markdown for LLMs, HTML for display, plain text, or Docling's JSON document, which keeps every element's type, page and position for citations.
Sync or async. Small files can use the synchronous convert endpoints and get Markdown back in the response. For large batches, use the async endpoints: you get a task ID, poll its status, then fetch the result or download the exported file from the bucket.
CPU image. This template uses the CPU build, which runs anywhere Railway does. It's slower than a GPU but fine for steady document ingestion. The models download on first use and stay cached while the container runs.
Private by default. All API routes require the generated key, and documents are processed inside your Railway project rather than a third-party service, which matters for contracts, medical records and internal reports.
Typical cost: ~$20–50/month on Railway for the API, worker, Redis and bucket at moderate volume. Conversion speed depends mainly on the worker's CPU and memory, so scale that service first.
Deploy Docling Serve in Under 10 Minutes
- Click Deploy on Railway. The API, worker and Redis start; the first boot downloads the models, so allow a few minutes.
- Copy
DOCLING_SERVE_API_KEYfrom the docling-serve service's Variables. - Open
https://your-domain/uito try a conversion in the playground. - Call the API from your code with the
X-Api-Keyheader, sending a file to/v1/convert/fileor a URL to/v1/convert/source. - For big jobs, use the
/asyncendpoints, poll/v1/status/poll/{task_id}and fetch/v1/result/{task_id}.
Check /docs for the interactive OpenAPI reference with every option.
Common Use Cases
- RAG ingestion. Turn company PDFs and Office files into Markdown chunks for a vector database.
- LLM preprocessing. Feed clean, structured text to models instead of messy raw extraction.
- Table extraction. Pull financial tables and reports into structured JSON.
- Scanned archives. OCR old scanned documents into searchable text.
- Search indexing. Prepare documents for Elasticsearch, Meilisearch or OpenSearch.
- Agent tools. Give an AI agent an HTTP tool that reads any document a user uploads.
- Research papers. Extract sections, tables and formulas from academic PDFs.
- Invoice and form processing. Turn invoices and forms into structured fields for downstream automation.
- Batch conversion. Convert whole folders of contracts or papers overnight with the async API.
Configuration
| Variable | Required | Description |
|---|---|---|
DOCLING_SERVE_API_KEY | 🔐 Auto-generated | Required X-Api-Key value for all API routes. |
DOCLING_SERVE_ENG_KIND | ✅ Set | rq, the Redis queue engine. |
DOCLING_SERVE_ENG_RQ_REDIS_URL | ✅ Auto-injected | Redis connection for jobs and results. |
DOCLING_SERVE_ENG_RQ_QUEUE_NAME |