DoclingDocling for IBM watsonx
API Reference

Convert Batch

Convert multiple documents, including from cloud storage, using the Docling for IBM watsonx API

Convert Batch

Convert more than one document in a single request. Sources can be web URLs (HTTP/HTTPS) or cloud storage (S3), and results are delivered either as temporary download URLs or written to a cloud storage destination you specify.

Use this endpoint whenever you have more than one document. For a single document, use Convert Source or Convert File.

Endpoint

POST /v1/convert/source/batch

Request Headers

HeaderRequiredDescription
X-Api-KeyYesYour API key for authentication
Content-TypeYesMust be application/json

Request Body

ParameterTypeRequiredDescription
sourcesarrayYesOne or more source objects to convert (at least one)
targetobjectYesWhere converted results are delivered (see Targets)
optionsobjectNoConversion options (see Options)
callbacksarrayNoProgress callback endpoints (see Progress Callbacks)

Sources

Each entry in sources is one of the following kinds. A single cloud storage source can represent many documents.

HTTP source

ParameterTypeRequiredDescription
kindstringYesMust be "http"
urlstringYesThe URL of the document to convert
headersobjectNoAdditional request headers used to fetch the URL (for example, authorization)

S3 source

Reads objects from an S3-compatible bucket. Every object under bucket/key_prefix is converted, up to max_num_elements.

ParameterTypeRequiredDescription
kindstringYesMust be "s3"
endpointstringYesS3 service endpoint, without protocol (for example, s3.us-east-2.amazonaws.com)
access_keystringYesS3 access key
secret_keystringYesS3 secret key
bucketstringYesBucket name to read from
key_prefixstringNoPrefix for the object keys to read. Defaults to empty (the whole bucket)
verify_sslbooleanNoUse SSL to connect to S3. Defaults to true
max_num_elementsintegerNoMaximum number of objects to read from this source. Defaults to no limit

Azure Blob Storage source

Reads blobs from an Azure Blob Storage container. Every blob under container/blob_prefix is converted, up to max_num_elements.

ParameterTypeRequiredDescription
kindstringYesMust be "azure_blob"
account_namestringYesAzure storage account name
containerstringYesContainer name to read from
connection_stringstringYesAzure storage connection string (for example, DefaultEndpointsProtocol=https;AccountName=your-account-name;AccountKey=your-account-key;EndpointSuffix=core.windows.net)
blob_prefixstringNoPrefix for the blob names to read. Defaults to empty (the whole container)
max_num_elementsintegerNoMaximum number of blobs to read from this source. Defaults to no limit

FileNet source

Reads documents from an IBM FileNet Content Manager / Cortex repository. You can specify either a folder to process all documents within it, or specific document IDs.

ParameterTypeRequiredDescription
kindstringYesMust be "filenet"
base_urlstringYesFileNet Content Services GraphQL endpoint URL (for example, https://filenet-instance.com/content-services-graphql)
usernamestringYesFileNet username
api_keystringYesFileNet API key or password (Zen api key for your CP4BA instance)
repository_idstringYesRepository identifier (for example, "OS1")
folder_idstringNo*Folder path to read all documents from (for example, "/incoming")
document_idsarrayNo*List of specific document IDs to process (for example, ["{doc-id}"])

* Either folder_id or document_ids must be provided, but not both. If folder_id is specified, all documents in that folder are processed. If document_ids is specified, only those specific documents are processed.

Google Cloud Storage source

Reads objects from a Google Cloud Storage bucket. Every object under bucket/key_prefix is converted, up to max_num_elements.

ParameterTypeRequiredDescription
kindstringYesMust be "google_cloud_storage"
bucketstringYesGCS bucket name
key_prefixstringNoObject key prefix for traversal. Defaults to empty (bucket root)
max_num_elementsintegerNoMaximum number of GCS objects to iterate for this source. Defaults to no limit
projectstringNoGCP project ID (for billing / Application Default Credentials). Optional
service_account_keyobjectNoService account credentials. Optional; omit to use Application Default Credentials / Workload Identity (for example, on GKE or Cloud Run)

When providing service_account_key, include these fields (from your GCP service account JSON key file):

FieldTypeRequiredDescription
project_idstringYesGCP project ID the service account belongs to
private_key_idstringYesKey ID of the private key
private_keystringYesRSA private key in PEM format
client_emailstringYesService account email address
client_idstringYesNumeric client ID of the service account
auth_uristringYesOAuth 2.0 authorization endpoint
token_uristringYesOAuth 2.0 token endpoint
auth_provider_x509_cert_urlstringYesX.509 certificate URL for the auth provider
client_x509_cert_urlstringYesX.509 certificate URL for the service account
universe_domainstringYesGoogle Cloud universe domain

SharePoint source

Reads documents from a SharePoint site or OneDrive for Business using Microsoft Graph API with app-only authentication.

ParameterTypeRequiredDescription
kindstringYesMust be "sharepoint"
tenantstringYesMicrosoft Entra ID (Azure AD) tenant identifier or domain used as the authentication authority for the app-only client-credentials flow. Accepts a tenant GUID or a domain such as "contoso.onmicrosoft.com"
client_idstringYesApplication (client) ID of the Microsoft Entra app registration granted Microsoft Graph application permissions (for example, Sites.Read.All, Files.Read.All)
client_secretstringYesApp-only client secret generated for the app registration under 'Certificates & secrets'
site_urlstringNo*URL of the SharePoint site to read from. Resolves to a document library (Graph drive) on that site
onedrive_userstringNo*User principal name (email) whose OneDrive for Business is read from (resolves to /users/{onedrive_user}/drive). Note: only OneDrive for Business (Entra-backed) is accessible with app-only credentials
document_librarystringNoDisplay name of the document library (SharePoint's top-level container, a Graph drive) to read from. A site can contain several libraries. If omitted, the site's default document library is used
folder_pathstringNoFolder path within the document library to read from. Subfolders are traversed. If omitted, the library root is used
file_idsarrayNoIDs of individual items within the site to process. If set, overrides folder_path and document_library traversal
max_num_elementsintegerNoMaximum number of documents to process. If omitted, all matching documents will be processed

* Exactly one of site_url or onedrive_user must be provided.

Google Drive source

Reads documents from Google Drive using OAuth 2.0 authentication. You can specify either a file or folder ID to process documents.

ParameterTypeRequiredDescription
kindstringYesMust be "google_drive"
path_idstringYesIdentifier for a file or folder in Google Drive
token_pathstringNo*Path to save the OAuth 2.0 access token, which is generated on the fly
refresh_tokenstringNo*Refresh token for the OAuth 2.0 access, if already pre-generated
credentials_pathstringNo**Path to the OAuth 2.0 Client ID credentials (available in Google Cloud console)
credentialsobjectNo**OAuth 2.0 Client ID credentials object (available in Google Cloud console)

* One of token_path or refresh_token is required.

** One of credentials_path or credentials is required.

When providing the credentials object, include these fields (from your Google Cloud OAuth 2.0 Client ID):

FieldTypeRequiredDescription
client_idstringYesOAuth 2.0 Client ID issued by Google
project_idstringYesGoogle Cloud project ID associated with the OAuth client
auth_uristringYesAuthorization endpoint URI
token_uristringYesToken endpoint URI
auth_provider_x509_cert_urlstringYesX.509 certificate URL for Google's OAuth provider
client_secretstringYesOAuth 2.0 client secret
redirect_urisarrayYesArray of OAuth 2.0 redirect URIs

Reads documents from a SharePoint site or OneDrive for Business using Microsoft Graph API with app-only authentication.

ParameterTypeRequiredDescription
kindstringYesMust be "sharepoint"
tenantstringYesMicrosoft Entra ID (Azure AD) tenant identifier or domain used as the authentication authority for the app-only client-credentials flow. Accepts a tenant GUID or a domain such as "contoso.onmicrosoft.com"
client_idstringYesApplication (client) ID of the Microsoft Entra app registration granted Microsoft Graph application permissions (for example, Sites.Read.All, Files.Read.All)
client_secretstringYesApp-only client secret generated for the app registration under 'Certificates & secrets'
site_urlstringNo*URL of the SharePoint site to read from. Resolves to a document library (Graph drive) on that site
onedrive_userstringNo*User principal name (email) whose OneDrive for Business is read from (resolves to /users/{onedrive_user}/drive). Note: only OneDrive for Business (Entra-backed) is accessible with app-only credentials
document_librarystringNoDisplay name of the document library (SharePoint's top-level container, a Graph drive) to read from. A site can contain several libraries. If omitted, the site's default document library is used
folder_pathstringNoFolder path within the document library to read from. If omitted, the drive root is used

* Exactly one of site_url or onedrive_user must be provided.

Targets

The target determines where converted results are delivered. The choice is constrained by your sources:

SourcesAllowed targetResult
All HTTPpresigned_url or s3Temporary download URLs, or files written to your bucket
Any S3 sources3 (required)Files written to your destination bucket

If any source reads from cloud storage, you must provide an s3 target. A web-only batch can use either target.

Presigned URL target

ParameterTypeRequiredDescription
kindstringYesMust be "presigned_url"

The result contains one entry per document, each with a download URL for every requested output format.

S3 target

Writes the converted outputs to an S3-compatible bucket you specify. This can be any bucket; it does not have to be a source bucket, and source objects are never modified.

ParameterTypeRequiredDescription
kindstringYesMust be "s3"
endpointstringYesS3 service endpoint, without protocol
access_keystringYesS3 access key
secret_keystringYesS3 secret key
bucketstringYesDestination bucket for converted outputs
key_prefixstringNoPrefix for the written object keys. Defaults to empty
verify_sslbooleanNoUse SSL to connect to S3. Defaults to true

Azure Blob Storage target

Writes the converted outputs to an Azure Blob Storage container you specify. This can be any container; it does not have to be a source container, and source blobs are never modified.

ParameterTypeRequiredDescription
kindstringYesMust be "azure_blob"
account_namestringYesAzure storage account name
containerstringYesDestination container for converted outputs
connection_stringstringYesAzure storage connection string
blob_prefixstringNoPrefix for the written blob names. Defaults to empty

Google Cloud Storage target

Writes the converted outputs to a Google Cloud Storage bucket you specify. This can be any bucket; it does not have to be a source bucket, and source objects are never modified.

ParameterTypeRequiredDescription
kindstringYesMust be "google_cloud_storage"
bucketstringYesGCS bucket name
key_prefixstringNoObject key prefix for output. Defaults to empty (bucket root)
projectstringNoGCP project ID (for billing / Application Default Credentials). Optional
service_account_keyobjectNoService account credentials. Optional; omit to use Application Default Credentials / Workload Identity (for example, on GKE or Cloud Run)

When providing service_account_key, include the same fields as documented in the Google Cloud Storage source section.

SharePoint target

Writes the converted outputs to a SharePoint site or OneDrive for Business using Microsoft Graph API with app-only authentication. This can be any site or OneDrive; it does not have to be a source location.

ParameterTypeRequiredDescription
kindstringYesMust be "sharepoint"
tenantstringYesMicrosoft Entra ID (Azure AD) tenant identifier or domain used as the authentication authority for the app-only client-credentials flow. Accepts a tenant GUID or a domain such as "contoso.onmicrosoft.com"
client_idstringYesApplication (client) ID of the Microsoft Entra app registration granted Microsoft Graph application permissions (for example, Sites.ReadWrite.All, Files.ReadWrite.All)
client_secretstringYesApp-only client secret generated for the app registration under 'Certificates & secrets'
site_urlstringNo*URL of the SharePoint site to write to. Resolves to a document library (Graph drive) on that site
onedrive_userstringNo*User principal name (email) whose OneDrive for Business is written to (resolves to /users/{onedrive_user}/drive). Note: only OneDrive for Business (Entra-backed) is accessible with app-only credentials
document_librarystringNoDisplay name of the document library (SharePoint's top-level container, a Graph drive) to write to. A site can contain several libraries. If omitted, the site's default document library is used
folder_pathstringNoDestination folder path within the document library to write to. Created if it does not exist. If omitted, the drive root is used

* Exactly one of site_url or onedrive_user must be provided.

Google Drive target

Writes the converted outputs to Google Drive using OAuth 2.0 authentication. You can specify either a file or folder ID as the destination.

ParameterTypeRequiredDescription
kindstringYesMust be "google_drive"
path_idstringYesIdentifier for a file or folder in Google Drive
token_pathstringNo*Path to save the OAuth 2.0 access token, which is generated on the fly
refresh_tokenstringNo*Refresh token for the OAuth 2.0 access, if already pre-generated
credentials_pathstringNo**Path to the OAuth 2.0 Client ID credentials (available in Google Cloud console)
credentialsobjectNo**OAuth 2.0 Client ID credentials object (available in Google Cloud console)

* One of token_path or refresh_token is required.

** One of credentials_path or credentials is required.

When providing the credentials object, include these fields (from your Google Cloud OAuth 2.0 Client ID):

FieldTypeRequiredDescription
client_idstringYesOAuth 2.0 Client ID issued by Google
project_idstringYesGoogle Cloud project ID associated with the OAuth client
auth_uristringYesAuthorization endpoint URI
token_uristringYesToken endpoint URI
auth_provider_x509_cert_urlstringYesX.509 certificate URL for Google's OAuth provider
client_secretstringYesOAuth 2.0 client secret
redirect_urisarrayYesArray of OAuth 2.0 redirect URIs

AstraDB Chunks target

Writes document chunks with server-side embeddings to an AstraDB vector database collection. This target automatically chunks documents and generates embeddings using AstraDB's vectorize feature.

ParameterTypeRequiredDescription
kindstringYesMust be "astradb_chunks"
api_endpointstringYesAstraDB API endpoint URL. Available in the AstraDB console under 'Connect'. Format: https://<database-id>-<region>.apps.astra.datastax.com
tokenstringYesAstraDB application token. Generate via AstraDB console → Settings → 'Generate Token'. Format: AstraCS:...
keyspacestringNoAstraDB keyspace (namespace) to use. Defaults to "default_keyspace"
collection_namestringYesName of the AstraDB collection to write chunks into
vectorize_providerstringNoAstraDB vectorize provider for server-side embeddings. Supported: "openai", "huggingface", "nvidia", "voyageai", etc. Defaults to "openai"
vectorize_modelstringNoModel name for server-side vectorization. Must be supported by the chosen provider. Examples: "text-embedding-3-small" (OpenAI), "sentence-transformers/all-MiniLM-L6-v2" (HuggingFace), "nvidia/nv-embedqa-e5-v5" (NVIDIA). Defaults to "text-embedding-3-small"
vectorize_authenticationobjectNoOptional authentication parameters for the vectorize provider. For OpenAI: {"providerKey": "OPENAI_API_KEY"}. For HuggingFace: {"providerKey": "HUGGINGFACE_API_KEY"}. If omitted, AstraDB uses its default credentials
text_fieldstringNoField name used to store chunk text in each AstraDB record. Defaults to "text". This does not change the $vectorize input field used for embedding generation
metadata_fieldstringNoField name used to store chunk metadata. Defaults to "metadata"
doc_id_fieldstringNoField name used to store the source document identifier. Defaults to "doc_id"
chunk_index_fieldstringNoField name used to store the chunk index within the source document. Defaults to "chunk_index"
page_fieldstringNoOptional field name used to store page numbers for each chunk. If unset, page numbers are not written to a dedicated field
headings_fieldstringNoOptional field name used to store chunk headings. If unset, headings are not written to a dedicated field
coerce_large_ints_to_strbooleanNoWhen true, integers outside the signed 64-bit range are converted to strings before writing chunk metadata. This helps avoid failures for values such as DoclingDocument.origin.binary_hash. Defaults to true

Options

The options object supports the following parameters:

ParameterTypeDefaultDescription
to_formatsarray["md"]Output formats, any of: "md", "html", "json", "text", "doclang"

Response

Success Response (200 OK)

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,
  "failure": null,
  "error_message": null
}

See Convert Source for the task field descriptions.

Retrieving Results

Poll /v1/status/poll/{task_id} until the status is success, then call /v1/result/{task_id}. The result shape depends on the target:

  • presigned_url target — one entry per document with download URLs, plus result counters. See Get Results.
  • s3 target — converted files are written to your destination bucket; the result is a summary of counts:
{
  "num_converted": 312,
  "num_succeeded": 310,
  "num_partially_succeeded": 1,
  "num_failed": 1,
  "processing_time": 842.5
}
FieldTypeDescription
num_convertedintegerNumber of documents processed
num_succeededintegerNumber converted successfully
num_partially_succeededintegerNumber converted with partial success
num_failedintegerNumber that failed conversion
processing_timenumberTotal processing time in seconds

Progress Callbacks

For long-running batches, you can have the service notify your own endpoint instead of polling. Each entry in callbacks describes a webhook:

ParameterTypeRequiredDescription
urlstringYesURL the service POSTs progress updates to
headersobjectNoAdditional headers to include on callback requests
ca_certstringNoCustom CA certificate (PEM) for verifying the callback endpoint

Each callback request has the shape:

{
  "task_id": "{TASK_ID}",
  "progress": {
    "kind": "update_processed",
    "num_processed": 120,
    "num_succeeded": 118,
    "num_partially_succeeded": 1,
    "num_failed": 1,
    "docs": [
      { "source": "incoming/report.pdf", "status": "success", "error": null }
    ]
  }
}

The progress object's kind is one of:

KindDescription
set_num_docsSent once the total number of documents is known (num_docs)
update_processedRunning totals plus the documents processed in this update (docs)
document_completedSent after each document, with per-document detail (pages, tables, timing) and overall progress

Error Responses

See Error Handling for the full error model.

StatusDescription
400Bad request — malformed request
401Unauthorized — missing or invalid API key
422Validation error — invalid request shape, or an S3 source paired with a non-S3 target
429Too many requests — rate limit exceeded
500Internal server error
502Gateway or upstream error

Examples

Find examples of using the batch endpoint in Converting Multiple Documents and Batch Conversion.

On this page