A PDF is a picture of a page, not a text file. Copy and paste mixes up columns, flattens tables and gives nothing at all for a scan. If you want the text for a search index, a chatbot, a summary or an archive, you need a tool that reads the layout. Docling is open-source software (MIT licence) that does this: it keeps headings, tables and reading order, reads scans with OCR (text recognition) and writes Markdown, HTML or JSON. On a rented GPU you start its API server, convert a whole folder, copy the results home and stop the server, paying by the second only while it runs. This guide shows how.
When this is worth it
- A large pile of documents that you want as clean text once: contracts, papers, manuals, reports.
- Scans that need OCR, which is the slow part and the part a GPU speeds up.
- A step before an AI project. Text from Docling is what you embed and search in a document chatbot; see Build a RAG chatbot on your own documents.
For one or two short, text-based PDFs, a free local tool is enough. The rented server pays off when there are many files or many scans.
What you need
- An Apidly account with some credit.
- A terminal with
curl. Python 3 is optional, for the loop in step 4. - No SSH key: the API is used over the web.
Step 1: Start the server
Open Quick start with this template, or open Deploy, pick a GPU, select Serve an API above the template cards and choose the Docling document conversion API card. The Docling template page lists what it sets up.
The template needs at least 4 GB of VRAM (GPU memory) and recommends 8 GB, so a small, cheap card is enough. Sort by Price, low to high and compare live prices on the pricing page; prices follow supply, so check them rather than a number in a guide. Leave DOCLING_API_KEY empty and the platform creates a key for this server. On the review step, check Per hour, keep the automatic stop under Automation (optional) on for a first try and select Start my server.
The models are inside the image, so the first start takes several minutes while the image downloads. You are billed from the moment the server runs.
Step 2: Find the address and the key
Open the server and its Connect tab. Copy the App address and, under Sign in with, show and copy the API key. Below they are SERVER_ADDRESS and YOUR_KEY. The ready command under Try it from a terminal checks that the API answers.
Step 3: Convert one document
From a link 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"}]}'Or a file from your computer:
curl -X POST http://SERVER_ADDRESS/v1/convert/file \
-H "Authorization: Bearer YOUR_KEY" \
-F "files=@report.pdf"The answer is JSON and the Markdown is in document.md_content. With jq installed, add | jq -r .document.md_content > report.md to save it directly. Open the result and compare it with the PDF before you convert the rest: check a page with a table and, if you have scans, a scanned page.
Step 4: Convert a whole folder
Send the files one at a time and write each answer next to its source. This script uses only Python's requests package; run it in the folder that holds your PDFs.
import pathlib
import requests
URL = "http://SERVER_ADDRESS/v1/convert/file"
HEADERS = {"Authorization": "Bearer YOUR_KEY"}
for pdf in sorted(pathlib.Path(".").glob("*.pdf")):
out = pdf.with_suffix(".md")
if out.exists():
continue # already converted, so a rerun picks up where it stopped
with pdf.open("rb") as f:
r = requests.post(URL, headers=HEADERS, files={"files": f}, timeout=900)
if r.ok:
out.write_text(r.json()["document"]["md_content"], encoding="utf-8")
print("done", pdf.name)
else:
print("failed", pdf.name, r.status_code)The loop skips files that already have a result, so you can stop it and run it again without paying for the same pages twice. Scanned pages take longest because each one goes through OCR; a long timeout keeps a big file from being cut off.
The API has more options, such as other output formats, OCR on or off and page ranges. They belong to Docling: open http://SERVER_ADDRESS/docs in your browser for its reference page. The browser asks for a user name and password: enter admin and the key.
What to expect from the output
Docling does well on printed text, headings, lists and most tables. It is weaker on handwriting, very low-resolution scans and unusual layouts, and no OCR is perfect. Check a sample, and keep the original files. If you feed the text into a search system, spot-check answers against the source pages.
Keep it private
The API uses plain http, so your documents travel unencrypted. Do not send confidential documents over a network you do not trust, and do not share the key. The service runs on third-party machines operated by independent, verified hosting providers, so treat the server as shared infrastructure rather than your own building: for documents you must not expose, convert them on your own hardware. If the key leaks, destroy the server and start a new one.
Control the cost
- Convert in one sitting, then stop. Stopping ends the compute charge. The disk is kept and still billed.
- Copy your results out first. Anything that is only on the server is lost when you destroy it. Your script writes the files on your own computer, so nothing is left behind.
- Add an automatic stop. Under the server's Settings, Automation, stop the server when the GPU has been idle for a number of minutes. See Automation.
- Destroy when the archive is done. That ends every charge.
How billing by the second works has worked examples, and Control costs covers budgets and warnings.
Common problems
401 Unauthorized. The header must beAuthorization: Bearer YOUR_KEY, with the wordBearerand a space.- A request hangs or times out on a big file. Split very long documents or raise the timeout.
- Empty or broken text from a scan. The image is too small or too faint. Rescan at a higher resolution if you can.
- The address stopped working after a restart. Copy it again from the Connect tab after Start.
Next steps
Turn PDFs into Markdown with Docling has the same steps in short form. To make the converted text searchable, see Run a vector database with Qdrant, or the full document chatbot in the RAG guide. Batch jobs are covered on the batch processing use case. When you are ready, start a Docling server.
Try what this guide shows
Start one of these templates on a rented GPU server. You see the price per hour before you start, and you pay by the second.
- CustomOpens in your browser
Docling document conversion API
Turns PDFs, Word files and scans into clean Markdown, HTML or JSON with layout, tables and OCR, behind a key.
- Minimum GPU memory
- 4 GB
- Default disk
- 40 GB
- CustomOpens in your browser
Qdrant vector database
A fast vector database for search and retrieval (RAG) apps, protected by an API key.
- Minimum GPU memory
- No minimum
- Default disk
- 30 GB
- Language modelsOpens in your browser
Embeddings and reranking server (Infinity)
Turns text into embeddings for search and RAG apps, with an OpenAI-compatible API on your GPU.
- Minimum GPU memory
- 4 GB
- Default disk
- 40 GB
Try it on a real GPU server
Create a free account and add a balance from $10. Servers are billed by the second, and the review step shows the price per hour before you request one.
Related guides
- Build a private RAG chatbot on your own documentsTurn PDFs into text with Docling, embed them, store them in Qdrant and answer questions with vLLM, all on rented GPUs you control, with real commands.
- How billing by the second worksHow compute and storage are charged by the second on Apidly Cloud, with worked examples.
- How much VRAM do you need for LLMs and images?Work out how much GPU memory your model needs before you rent: a simple formula for language models, image models and fine-tuning, with worked examples.