### Quick Start Java Client Example Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/docling-serve/serve-client.md Demonstrates how to create a Docling Serve API client, build a conversion request for a document from a URL, and process the response. Ensure Jackson is included in your project. ```java import java.net.URI; import ai.docling.serve.api.DoclingServeApi; import ai.docling.serve.api.convert.request.ConvertDocumentRequest; import ai.docling.serve.api.convert.request.options.ConvertDocumentOptions; import ai.docling.serve.api.convert.request.options.OutputFormat; import ai.docling.serve.api.convert.request.source.HttpSource; import ai.docling.serve.api.convert.request.target.InBodyTarget; import ai.docling.serve.api.convert.response.InBodyConvertDocumentResponse; DoclingServeApi api = DoclingServeApi.builder() .baseUrl("http://localhost:8000") // your Docling Serve URL .logRequests() // log HTTP requests .logResponses() // log HTTP responses .prettyPrint() // pretty-print JSON requests/responses .build(); ConvertDocumentRequest request = ConvertDocumentRequest.builder() .source(HttpSource.builder().url(URI.create("https://arxiv.org/pdf/2408.09869")).build()) .options(ConvertDocumentOptions.builder() .toFormat(OutputFormat.MARKDOWN) .includeImages(true) .build()) .target(InBodyTarget.builder().build()) .build(); InBodyConvertDocumentResponse response = (InBodyConvertDocumentResponse) api.convertSource(request); System.out.println(response.getDocument().getMarkdownContent()); ``` -------------------------------- ### HTTP Source Configuration Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/docling-serve/serve-client.md Example of configuring an HTTP source for the Docling Serve API. ```APIDOC ## HTTP Source Configuration ### Description Configure an HTTP source by providing a URL. Optional headers can also be set. ### Method N/A (Client-side configuration) ### Endpoint N/A (Client-side configuration) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body N/A ### Request Example ```java import ai.docling.serve.api.convert.request.source.HttpSource; import java.net.URI; var httpSource = HttpSource.builder() .url(URI.create("https://example.com/file.pdf")) // .header("Authorization", "Bearer ...") .build(); ``` ### Response N/A (Client-side configuration) ``` -------------------------------- ### Docling Server Logs Example Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/includes/docling-serve/serve-compatibility.md This log output indicates the successful startup of the Docling production server and provides the URLs for accessing the documentation and scalar documentation. ```text Starting production server 🚀 Server started at http://0.0.0.0:5001 Documentation at http://0.0.0.0:5001/docs Scalar docs at http://0.0.0.0:5001/scalar ``` -------------------------------- ### Initialize DoclingServeContainer Source: https://github.com/docling-project/docling-java/blob/main/docling-testing/docling-version-tests/README.md Configures and starts a DoclingServeContainer for testing. Specify the Docker image, registry, and startup timeout. Ensure Testcontainers and Docker are set up correctly. ```java var containerConfig = DoclingServeContainerConfig.builder() .image("{registry}/{image}:{tag}") .startupTimeout(Duration.ofMinutes(5)) .build(); var doclingContainer = new DoclingServeContainer(containerConfig); doclingContainer.start(); ``` -------------------------------- ### Docling Server Startup Logs Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/includes/docling-serve/serve-compatibility.md Shows the typical log output when the Docling production server starts, including the server address and documentation endpoints. ```text Starting production server 🚀 Server started at http://0.0.0.0:5001 Documentation at http://0.0.0.0:5001/docs Scalar docs at http://0.0.0.0:5001/scalar ``` -------------------------------- ### Docling Serve v1.15.0 Logs Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/includes/docling-serve/serve-compatibility.md These logs show the startup sequence and operational messages for Docling serve version 1.15.0. They include server start confirmation, documentation paths, and details about the OCR engine initialization. A deprecation warning for `strict_text` is also noted. ```log Starting production server 🚀\n\nServer started at http://0.0.0.0:5001\nDocumentation at http://0.0.0.0:5001/docs\nScalar docs at http://0.0.0.0:5001/scalar\n\nLogs:\nINFO: Started server process [1]\nINFO: Waiting for application startup.\n2026-06-15 11:58:55.323809457 [W:onnxruntime:Default, device_discovery.cc:132 GetPciBusId] Skipping pci_bus_id for PCI path at "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/MSFT1000:00/5620e0c7-8062-4dce-aeb7-520c7ef76171" because filename ""5620e0c7-8062-4dce-aeb7-520c7ef76171"" dit not match expected pattern of [0-9a-f]+:[0-9a-f]+:[0-9a-f]+[.][0-9a-f]+\n[INFO] 2026-06-15 11:58:56,235 [RapidOCR] base.py:22: Using engine_name: onnxruntime\n[INFO] 2026-06-15 11:58:56,237 [RapidOCR] main.py:53: Using /opt/app-root/src/.cache/docling/models/RapidOcr/onnx/PP-OCRv4/det/ch_PP-OCRv4_det_infer.onnx\n[INFO] 2026-06-15 11:58:56,412 [RapidOCR] base.py:22: Using engine_name: onnxruntime\n[INFO] 2026-06-15 11:58:56,412 [RapidOCR] main.py:53: Using /opt/app-root/src/.cache/docling/models/RapidOcr/onnx/PP-OCRv4/cls/ch_ppocr_mobile_v2.0_cls_infer.onnx\n[INFO] 2026-06-15 11:58:56,459 [RapidOCR] base.py:22: Using engine_name: onnxruntime\n[INFO] 2026-06-15 11:58:56,459 [RapidOCR] main.py:53: Using /opt/app-root/src/.cache/docling/models/RapidOcr/onnx/PP-OCRv4/rec/ch_PP-OCRv4_rec_infer.onnx\nINFO: Application startup complete.\nINFO: Uvicorn running on http://0.0.0.0:5001 (Press CTRL+C to quit)\nINFO: 172.17.0.1:56546 - "GET /health HTTP/1.1" 200 OK\nINFO: 172.17.0.1:56550 - "GET /health HTTP/1.1" 200 OK\nWARNING:docling_core.types.doc.document:Parameter `strict_text` has been deprecated and will be ignored.\nINFO: 172.17.0.1:56550 - "POST /v1/convert/source HTTP/1.1" 200 OK\nINFO: 172.17.0.1:56550 - "POST /v1/convert/source HTTP/1.1" 200 OK\nINFO: 172.17.0.1:56550 - "POST /v1/convert/source HTTP/1.1" 200 OK\nINFO: 172.17.0.1:56550 - "GET /v1/clear/converters HTTP/1.1" 200 OK\nINFO: 172.17.0.1:56550 - "GET /v1/clear/results?older_then=3600 HTTP/1.1" 200 OK\n ``` -------------------------------- ### Presigned URL Target Configuration Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/docling-serve/serve-client.md Example of configuring the target to receive results as presigned download URLs. ```APIDOC ## Presigned URL Target Configuration ### Description Configure the target to receive results as presigned download URLs. Requires docling-serve v1.22.0+. ### Method N/A (Client-side configuration) ### Endpoint N/A (Client-side configuration) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body N/A ### Request Example ```java import ai.docling.serve.api.convert.request.target.PresignedUrlTarget; var presigned = PresignedUrlTarget.builder().build(); ``` ### Response N/A (Client-side configuration) ``` -------------------------------- ### Convert Document Request Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/testcontainers.md Example of using the reference client to call the Convert endpoint for document conversion. This snippet demonstrates setting up the request with a source URL and desired output format. ```java import java.net.URI; import ai.docling.serve.api.convert.request.ConvertDocumentRequest; import ai.docling.serve.api.convert.request.options.ConvertDocumentOptions; import ai.docling.serve.api.convert.request.options.OutputFormat; import ai.docling.serve.api.convert.request.source.HttpSource; import ai.docling.serve.api.convert.request.target.InBodyTarget; import ai.docling.serve.api.convert.response.InBodyConvertDocumentResponse; String baseUrl = docling.getApiUrl(); DoclingServeApi api = DoclingServeApi.builder() .baseUrl(baseUrl) .build(); ConvertDocumentRequest request = ConvertDocumentRequest.builder() .source(HttpSource.builder().url(URI.create("https://arxiv.org/pdf/2408.09869")).build()) .options(ConvertDocumentOptions.builder() .toFormat(OutputFormat.MARKDOWN) .includeImages(true) .build()) .target(InBodyTarget.builder().build()) .build(); InBodyConvertDocumentResponse response = (InBodyConvertDocumentResponse) api.convertSource(request); // Assert on response.getDocument().getMarkdownContent(), errors, timings, etc. ``` -------------------------------- ### Docling Server Startup and Log Output Source: https://github.com/docling-project/docling-java/blob/main/docs/src/doc/docs/includes/docling-serve/serve-compatibility.md This snippet displays the typical log output when the Docling production server starts. It includes server addresses, documentation URLs, and initial processing messages from OCR engines. ```log Starting production server 🚀 Server started at http://0.0.0.0:5001 Documentation at http://0.0.0.0:5001/docs Scalar docs at http://0.0.0.0:5001/scalar Logs: INFO: Started server process [1] INFO: Waiting for application startup. 2026-06-15 12:01:06.645567614 [W:onnxruntime:Default, device_discovery.cc:132 GetPciBusId] Skipping pci_bus_id for PCI path at "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/MSFT1000:00/5620e0c7-8062-4dce-aeb7-520c7ef76171" because filename ""5620e0c7-8062-4dce-aeb7-520c7ef76171"" dit not match expected pattern of [0-9a-f]+:[0-9a-f]+:[0-9a-f]+[.][0-9a-f]+ [m [INFO] 2026-06-15 12:01:07,148 [RapidOCR] base.py:22: Using engine_name: onnxruntime [INFO] 2026-06-15 12:01:07,150 [RapidOCR] main.py:57: Using /opt/app-root/src/.cache/docling/models/RapidOcr/onnx/PP-OCRv4/det/ch_PP-OCRv4_det_mobile.onnx [INFO] 2026-06-15 12:01:07,273 [RapidOCR] base.py:22: Using engine_name: onnxruntime [INFO] 2026-06-15 12:01:07,274 [RapidOCR] main.py:57: Using /opt/app-root/src/.cache/docling/models/RapidOcr/onnx/PP-OCRv4/cls/ch_ppocr_mobile_v2.0_cls_mobile.onnx [INFO] 2026-06-15 12:01:07,323 [RapidOCR] base.py:22: Using engine_name: onnxruntime [INFO] 2026-06-15 12:01:07,323 [RapidOCR] main.py:57: Using /opt/app-root/src/.cache/docling/models/RapidOcr/onnx/PP-OCRv4/rec/ch_PP-OCRv4_rec_mobile.onnx Loading weights: 0%| | 0/770 [00:00