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.
API Reference

Convert File

Upload and convert local files using the Docling for IBM watsonx API

Convert File

Use this endpoint to upload and convert local documents into different formats. To upload a PDF from a URL, see Convert Source.

Endpoint

POST {SERVICE_URL}/v1/convert/file/async

Request Headers

HeaderRequiredDescription
X-Api-KeyYesYour API key for authentication
Content-TypeYesMust be multipart/form-data

Request Body

The request must be sent as multipart/form-data with the following fields:

ParameterTypeRequiredDescription
filesfileYesThe file(s) to upload and convert (use @ prefix for file paths)
optionsJSON stringConditionalConversion options as a JSON string (see Options)

Options

options is required if you are uploading multiple documents. When provided, the options parameter must be a JSON string containing an object with the following parameters:

ParameterTypeDefaultDescription
output_formatstring"json"Output format: "json", "markdown", or "html"

Response

Success Response (20X Accepted)

Returns a task object that can be used to poll for completion:

{
  "task_id": "{TASK_ID}",
  "task_type": "convert",
  "task_status": "pending",
  "task_position": 1,
  "task_meta": null,
  "error_message": null
}
FieldTypeDescription
task_idstringUnique identifier for this conversion task (generated by the service)
task_typestringAlways "convert" for conversion tasks
task_statusstringCurrent status: "pending", "success", or "failure"
task_positionintegerPosition in queue (null when processing or complete)
task_metaobjectAdditional metadata
error_messagestringError description if status is "failure"

Error Responses

To be added.

Examples

Find examples of using the File Conversion endpoint in the Examples section.

Next Steps

After submitting a conversion request:

  1. Poll for status - Use the /v1/status/poll/{task_id} endpoint to check conversion progress
  2. Retrieve results - Once status is "success", use the /v1/result/{task_id} endpoint to get the converted document

Best Practices

  1. Use appropriate output formats - Choose markdown for RAG applications, json for structured data extraction
  2. Enable low-latency mode - For real-time applications where speed is critical
  3. Batch similar documents - Upload multiple files together for efficiency
  4. Handle errors gracefully - Always check the task_status and error_message fields
  5. Implement retry logic - Use exponential backoff for transient failures
  6. Validate files locally - Check file format and size before uploading to avoid errors

Common Errors

To be added.

File Format Support

The Convert File endpoint supports the same formats as Convert Source:

  • PDF documents - Including scanned PDFs with OCR
  • Images - PNG, JPEG, TIFF, BMP, GIF
  • Microsoft Office - DOCX, PPTX, XLSX
  • HTML - Web pages and HTML documents
  • Markdown - MD files
  • Text files - TXT, CSV

For the most up-to-date list, see the FAQ.

On this page