DoclingDocling for IBM watsonx
This is a preview with content being developed and subject to changes. Rely on theofficial announcement and documentationabout the Docling for IBM watsonx product.
Examples

Batch Conversion

Batch conversion examples for using Docling for IBM watsonx

API Endpoint Usage

If you have to convert multiple PDFs, making an HTTP request for each one is computationally inefficient. Instead, Docling for IBM watsonx allows you to add multiple documents in a single conversion request.

Process multiple documents in a single request:

curl -X POST "${DOCLING_SERVICE_URL}/v1/convert/source/async" \
  -H "X-Api-Key: ${DOCLING_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "sources": [
      {
        "kind": "http",
        "url": "https://arxiv.org/pdf/2408.09869"
      },
      {
        "kind": "http",
        "url": "https://arxiv.org/pdf/2501.17887"
      }
    ],
    "options": {}
  }' \
  -o multiple.zip

If you are uploading multiple documents, you must include an "options" object in the request body. An empty object is allowed.

All results will be saved in the multiple.zip file. To extract the results, you can use the following command:

unzip multiple.zip

In this example, each document is converted to a markdown file. See the Custom Conversion examples to learn more about alternative output formats.

Python SDK Usage

from pathlib import Path
from docling.service_client import DoclingServiceClient
import os

SERVICE_URL = os.getenv("DOCLING_SERVICE_URL")
API_KEY = os.getenv("DOCLING_API_KEY")

documents = [
    Path("path/to/doc1.pdf"),
    Path("path/to/doc2.pdf"),
    Path("path/to/doc3.pdf")
]

with DoclingServiceClient(url=SERVICE_URL, api_key=API_KEY) as client:
    for doc in documents:
        result = client.convert(source=doc)
        
        # Save each result
        output_path = doc.with_suffix('.md')
        output_path.write_text(result.document.export_to_markdown())
        print(f"Converted {doc} -> {output_path}")

On this page