Deploy Docling Serve

Convert PDFs, Word files and scans into Markdown and JSON for RAG.

Deploy Docling Serve

Just deployed

/data

docling-artifacts

Bucket

Just deployed

Deploy and Host Docling Serve on Railway

Docling logo

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

ServicePurpose
docling-servedocling-serve-cpu:v1.30.0 on port 5001 with a public domain. REST API, async task endpoints and the Gradio playground at /ui.
docling-workerThe same image running docling-serve rq-worker. Pulls conversion jobs from Redis and runs the models.
RedisRedis 8.2 with a password and a volume. Job queue and result store between API and worker.
docling-artifacts bucketRailway 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

  1. Click Deploy on Railway. The API, worker and Redis start; the first boot downloads the models, so allow a few minutes.
  2. Copy DOCLING_SERVE_API_KEY from the docling-serve service's Variables.
  3. Open https://your-domain/ui to try a conversion in the playground.
  4. Call the API from your code with the X-Api-Key header, sending a file to /v1/convert/file or a URL to /v1/convert/source.
  5. For big jobs, use the /async endpoints, 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

VariableRequiredDescription
DOCLING_SERVE_API_KEY🔐 Auto-generatedRequired X-Api-Key value for all API routes.
DOCLING_SERVE_ENG_KIND✅ Setrq, the Redis queue engine.
DOCLING_SERVE_ENG_RQ_REDIS_URL✅ Auto-injectedRedis connection for jobs and results.
DOCLING_SERVE_ENG_RQ_QUEUE_NAME✅ Setconvert, the queue the worker consumes.
DOCLING_SERVE_ENABLE_UI✅ Settrue, mounts the Gradio playground at /ui.
DOCLING_SERVE_ARTIFACT_STORAGE_*✅ Auto-injectedBucket name, endpoint and keys for exported files.
PORT, UVICORN_PORT✅ Set5001, where the API listens.
DOCLING_SERVE_LOG_LEVEL✅ SetINFO, shows conversion progress.

Turning off the playground. Set DOCLING_SERVE_ENABLE_UI=false on docling-serve if you only need the API.

Scaling workers. Give docling-worker more CPU and memory first, then add replicas. Every replica pulls from the same convert queue.

Rotating the key. Change DOCLING_SERVE_API_KEY and redeploy, then update every client.


Docling Serve vs. Alternatives

Docling on RailwayLlamaParseUnstructured APIPlain PDF text extraction
Monthly cost~$20–50 usageCredits per pagePer pageFree
Self-hosted✅ Yes❌ No⚠️ Paid self-host✅ Yes
Layout and reading order✅ Yes✅ Yes✅ Yes❌ No
Table structure✅ Yes✅ Yes✅ Yes❌ No
OCR for scans✅ Yes✅ Yes✅ Yes❌ No
Documents stay on your servers✅ Yes❌ No⚠️ Depends✅ Yes
License✅ MIT❌ Proprietary⚠️ Apache-2.0 library, paid API✅ Varies

Dependencies for Docling Serve Hosting

  • Railway account. Pro is recommended for more CPU and memory on the worker.
  • A client that can send HTTP requests: Python, JavaScript, curl or your workflow tool.
  • Optional: a vector database or search engine for the converted output.

Deployment Dependencies

Implementation Details

Both Docling services run ghcr.io/docling-project/docling-serve-cpu:v1.30.0; the worker overrides the command to docling-serve rq-worker. Newer releases, currently 1.38, add more formats and options, so test a new tag before switching both services together. The API's health check is /ready, and only docling-serve has a public domain; Redis and the worker are private. Exported files land in the bucket and the API hands back presigned links, so large results don't have to travel through the API response.


Frequently Asked Questions

What is Docling Serve? The HTTP API for Docling, an MIT-licensed library from IBM Research that converts PDFs, Office files, HTML and images into Markdown and structured JSON.

How much does it cost? About $20–50/month on Railway for the API, worker, Redis and bucket, depending on volume. There are no per-page fees.

How do I authenticate? Send the DOCLING_SERVE_API_KEY value in the X-Api-Key header on every request.

Does it handle scanned PDFs? Yes. Docling runs OCR on scanned pages and images, then applies the same layout and table analysis.

Can I process large batches? Yes. Use the async endpoints, and add worker replicas or more CPU to the worker for higher throughput.

Is there a GPU option? This template uses the CPU image. Docling also publishes GPU images, which need a GPU host.


Why Deploy and Host Docling Serve on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Docling Serve on Railway, you get a private document conversion API for AI and search pipelines, with no per-page fees and documents that stay on your infrastructure.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1