PDFs are hard to use in code: columns, tables and scanned pages come out as a jumble of text. Docling reads a document's layout and turns it into clean Markdown, HTML or JSON, keeps headings, tables and the reading order, and reads scans with OCR. It is open-source software under the MIT licence. The Docling document conversion API template runs its API server on a GPU, behind a key. This guide is for anyone who has a pile of documents to turn into text, for example before putting them into a search index. You need an account with credit and a terminal with curl; you do not need an SSH key.
What it costs
You pay for the server by the second while it runs, plus its disk for as long as the server exists. Converting a batch and then stopping the server keeps the bill small. The review step shows the price Per hour before anything starts; the pricing page has the current prices of every GPU.
1. Start the server
Never started a server? Your first GPU server shows adding credit and Quick start step by step. Quick start offers the most common goals; Docling is in the full setup:
- Open Deploy. Under Sort by, choose Price, low to high and pick a configuration with at least 4 GB of VRAM (8 GB is recommended). Select Continue.
- Above the template cards, select Serve an API, then the Docling document conversion API card, then Continue. The card also says Also needs a fast download, because the software is large.
- Name the server, for example
docling. LeaveDOCLING_API_KEYempty: the platform creates a key for this server. - Select Continue, check Per hour and keep the automatic stop under Automation (optional) on for a first try. Select Start my server.
Some new servers are reviewed by our team before they start; you are not charged until the server runs.
2. Wait for the first start
The software and its models are inside the image, so the first start takes several minutes while the server downloads it; the template card shows the expected time as First start. The server is billed from the moment it runs.
3. Find the key and the address
Open Servers, select the server and open the Connect tab. Under Sign in with, show and copy the API key, and copy the App address. Below they are YOUR_KEY and SERVER_ADDRESS. The ready command under Try it from a terminal checks that the API answers.
4. Convert a document from a link
Send the address of a PDF on the web:
curl -X POST http://SERVER_ADDRESS/v1/convert/source \
-H "Authorization: Bearer YOUR_KEY" -H "Content-Type: application/json" \
-d '{"sources": [{"kind": "http", "url": "https://arxiv.org/pdf/2408.09869"}]}'The answer is JSON. The Markdown is in document.md_content. With jq installed you can save it straight to a file by adding | jq -r .document.md_content > paper.md to the command.
5. Convert a file from your computer
Upload a file from the folder you are in:
curl -X POST http://SERVER_ADDRESS/v1/convert/file \
-H "Authorization: Bearer YOUR_KEY" \
-F "files=@report.pdf"The answer has the same shape. Large documents take longer; scanned pages take longest, because every page goes through OCR.
The API has more options (other output formats, OCR on or off, page ranges). They belong to Docling: open http://SERVER_ADDRESS/docs in your browser for its own reference page. The browser asks for a user name and password: enter admin and the key.
Common mistakes
- 401 Unauthorized: the header must be
Authorization: Bearer YOUR_KEY, with the wordBearerand a space. - The request hangs or times out on a big file: split very long documents, or convert fewer files per request.
- Empty or broken text from a scan: OCR reads printed text well; handwriting and very low-resolution scans come out poorly. Check a sample before converting a whole archive.
- The address stopped working after a restart: copy it again from the Connect tab after Start.
Keep it private
The API uses plain
http, so your documents travel unencrypted. Do not send confidential documents over an untrusted network, and do not share the key.
When you are done: stop or destroy
- Stop ends the compute charge. The disk is kept and still billed.
- Destroy ends every charge. Open the server, go to Settings and choose Destroy server. Converted text you did not save on your computer is lost.
Next
- Run a vector database for search with Qdrant to make the converted text searchable.
- Move data in and out
- Control costs
Ready to try it?
Create a free account and add credit when you want to start a server. The smallest top-up is $10.
Was this helpful?