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/batchRequest Headers
| Header | Required | Description |
|---|---|---|
X-Api-Key | Yes | Your API key for authentication |
Content-Type | Yes | Must be application/json |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
sources | array | Yes | One or more source objects to convert (at least one) |
target | object | Yes | Where converted results are delivered (see Targets) |
options | object | No | Conversion options (see Options) |
callbacks | array | No | Progress 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
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "http" |
url | string | Yes | The URL of the document to convert |
headers | object | No | Additional 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "s3" |
endpoint | string | Yes | S3 service endpoint, without protocol (for example, s3.us-east-2.amazonaws.com) |
access_key | string | Yes | S3 access key |
secret_key | string | Yes | S3 secret key |
bucket | string | Yes | Bucket name to read from |
key_prefix | string | No | Prefix for the object keys to read. Defaults to empty (the whole bucket) |
verify_ssl | boolean | No | Use SSL to connect to S3. Defaults to true |
max_num_elements | integer | No | Maximum 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "azure_blob" |
account_name | string | Yes | Azure storage account name |
container | string | Yes | Container name to read from |
connection_string | string | Yes | Azure storage connection string (for example, DefaultEndpointsProtocol=https;AccountName=your-account-name;AccountKey=your-account-key;EndpointSuffix=core.windows.net) |
blob_prefix | string | No | Prefix for the blob names to read. Defaults to empty (the whole container) |
max_num_elements | integer | No | Maximum 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "filenet" |
base_url | string | Yes | FileNet Content Services GraphQL endpoint URL (for example, https://filenet-instance.com/content-services-graphql) |
username | string | Yes | FileNet username |
api_key | string | Yes | FileNet API key or password (Zen api key for your CP4BA instance) |
repository_id | string | Yes | Repository identifier (for example, "OS1") |
folder_id | string | No* | Folder path to read all documents from (for example, "/incoming") |
document_ids | array | No* | 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "google_cloud_storage" |
bucket | string | Yes | GCS bucket name |
key_prefix | string | No | Object key prefix for traversal. Defaults to empty (bucket root) |
max_num_elements | integer | No | Maximum number of GCS objects to iterate for this source. Defaults to no limit |
project | string | No | GCP project ID (for billing / Application Default Credentials). Optional |
service_account_key | object | No | Service 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):
| Field | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | GCP project ID the service account belongs to |
private_key_id | string | Yes | Key ID of the private key |
private_key | string | Yes | RSA private key in PEM format |
client_email | string | Yes | Service account email address |
client_id | string | Yes | Numeric client ID of the service account |
auth_uri | string | Yes | OAuth 2.0 authorization endpoint |
token_uri | string | Yes | OAuth 2.0 token endpoint |
auth_provider_x509_cert_url | string | Yes | X.509 certificate URL for the auth provider |
client_x509_cert_url | string | Yes | X.509 certificate URL for the service account |
universe_domain | string | Yes | Google Cloud universe domain |
SharePoint source
Reads documents from a SharePoint site or OneDrive for Business using Microsoft Graph API with app-only authentication.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "sharepoint" |
tenant | string | Yes | Microsoft 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_id | string | Yes | Application (client) ID of the Microsoft Entra app registration granted Microsoft Graph application permissions (for example, Sites.Read.All, Files.Read.All) |
client_secret | string | Yes | App-only client secret generated for the app registration under 'Certificates & secrets' |
site_url | string | No* | URL of the SharePoint site to read from. Resolves to a document library (Graph drive) on that site |
onedrive_user | string | No* | 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_library | string | No | Display 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_path | string | No | Folder path within the document library to read from. Subfolders are traversed. If omitted, the library root is used |
file_ids | array | No | IDs of individual items within the site to process. If set, overrides folder_path and document_library traversal |
max_num_elements | integer | No | Maximum 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "google_drive" |
path_id | string | Yes | Identifier for a file or folder in Google Drive |
token_path | string | No* | Path to save the OAuth 2.0 access token, which is generated on the fly |
refresh_token | string | No* | Refresh token for the OAuth 2.0 access, if already pre-generated |
credentials_path | string | No** | Path to the OAuth 2.0 Client ID credentials (available in Google Cloud console) |
credentials | object | No** | 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):
| Field | Type | Required | Description |
|---|---|---|---|
client_id | string | Yes | OAuth 2.0 Client ID issued by Google |
project_id | string | Yes | Google Cloud project ID associated with the OAuth client |
auth_uri | string | Yes | Authorization endpoint URI |
token_uri | string | Yes | Token endpoint URI |
auth_provider_x509_cert_url | string | Yes | X.509 certificate URL for Google's OAuth provider |
client_secret | string | Yes | OAuth 2.0 client secret |
redirect_uris | array | Yes | Array of OAuth 2.0 redirect URIs |
Reads documents from a SharePoint site or OneDrive for Business using Microsoft Graph API with app-only authentication.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "sharepoint" |
tenant | string | Yes | Microsoft 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_id | string | Yes | Application (client) ID of the Microsoft Entra app registration granted Microsoft Graph application permissions (for example, Sites.Read.All, Files.Read.All) |
client_secret | string | Yes | App-only client secret generated for the app registration under 'Certificates & secrets' |
site_url | string | No* | URL of the SharePoint site to read from. Resolves to a document library (Graph drive) on that site |
onedrive_user | string | No* | 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_library | string | No | Display 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_path | string | No | Folder 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:
| Sources | Allowed target | Result |
|---|---|---|
| All HTTP | presigned_url or s3 | Temporary download URLs, or files written to your bucket |
| Any S3 source | s3 (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
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "s3" |
endpoint | string | Yes | S3 service endpoint, without protocol |
access_key | string | Yes | S3 access key |
secret_key | string | Yes | S3 secret key |
bucket | string | Yes | Destination bucket for converted outputs |
key_prefix | string | No | Prefix for the written object keys. Defaults to empty |
verify_ssl | boolean | No | Use 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "azure_blob" |
account_name | string | Yes | Azure storage account name |
container | string | Yes | Destination container for converted outputs |
connection_string | string | Yes | Azure storage connection string |
blob_prefix | string | No | Prefix 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "google_cloud_storage" |
bucket | string | Yes | GCS bucket name |
key_prefix | string | No | Object key prefix for output. Defaults to empty (bucket root) |
project | string | No | GCP project ID (for billing / Application Default Credentials). Optional |
service_account_key | object | No | Service 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "sharepoint" |
tenant | string | Yes | Microsoft 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_id | string | Yes | Application (client) ID of the Microsoft Entra app registration granted Microsoft Graph application permissions (for example, Sites.ReadWrite.All, Files.ReadWrite.All) |
client_secret | string | Yes | App-only client secret generated for the app registration under 'Certificates & secrets' |
site_url | string | No* | URL of the SharePoint site to write to. Resolves to a document library (Graph drive) on that site |
onedrive_user | string | No* | 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_library | string | No | Display 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_path | string | No | Destination 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "google_drive" |
path_id | string | Yes | Identifier for a file or folder in Google Drive |
token_path | string | No* | Path to save the OAuth 2.0 access token, which is generated on the fly |
refresh_token | string | No* | Refresh token for the OAuth 2.0 access, if already pre-generated |
credentials_path | string | No** | Path to the OAuth 2.0 Client ID credentials (available in Google Cloud console) |
credentials | object | No** | 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):
| Field | Type | Required | Description |
|---|---|---|---|
client_id | string | Yes | OAuth 2.0 Client ID issued by Google |
project_id | string | Yes | Google Cloud project ID associated with the OAuth client |
auth_uri | string | Yes | Authorization endpoint URI |
token_uri | string | Yes | Token endpoint URI |
auth_provider_x509_cert_url | string | Yes | X.509 certificate URL for Google's OAuth provider |
client_secret | string | Yes | OAuth 2.0 client secret |
redirect_uris | array | Yes | Array 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "astradb_chunks" |
api_endpoint | string | Yes | AstraDB API endpoint URL. Available in the AstraDB console under 'Connect'. Format: https://<database-id>-<region>.apps.astra.datastax.com |
token | string | Yes | AstraDB application token. Generate via AstraDB console → Settings → 'Generate Token'. Format: AstraCS:... |
keyspace | string | No | AstraDB keyspace (namespace) to use. Defaults to "default_keyspace" |
collection_name | string | Yes | Name of the AstraDB collection to write chunks into |
vectorize_provider | string | No | AstraDB vectorize provider for server-side embeddings. Supported: "openai", "huggingface", "nvidia", "voyageai", etc. Defaults to "openai" |
vectorize_model | string | No | Model 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_authentication | object | No | Optional 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_field | string | No | Field 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_field | string | No | Field name used to store chunk metadata. Defaults to "metadata" |
doc_id_field | string | No | Field name used to store the source document identifier. Defaults to "doc_id" |
chunk_index_field | string | No | Field name used to store the chunk index within the source document. Defaults to "chunk_index" |
page_field | string | No | Optional field name used to store page numbers for each chunk. If unset, page numbers are not written to a dedicated field |
headings_field | string | No | Optional field name used to store chunk headings. If unset, headings are not written to a dedicated field |
coerce_large_ints_to_str | boolean | No | When 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:
| Parameter | Type | Default | Description |
|---|---|---|---|
to_formats | array | ["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_urltarget — one entry per document with download URLs, plus result counters. See Get Results.s3target — 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
}| Field | Type | Description |
|---|---|---|
num_converted | integer | Number of documents processed |
num_succeeded | integer | Number converted successfully |
num_partially_succeeded | integer | Number converted with partial success |
num_failed | integer | Number that failed conversion |
processing_time | number | Total 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | URL the service POSTs progress updates to |
headers | object | No | Additional headers to include on callback requests |
ca_cert | string | No | Custom 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:
| Kind | Description |
|---|---|
set_num_docs | Sent once the total number of documents is known (num_docs) |
update_processed | Running totals plus the documents processed in this update (docs) |
document_completed | Sent after each document, with per-document detail (pages, tables, timing) and overall progress |
Error Responses
See Error Handling for the full error model.
| Status | Description |
|---|---|
400 | Bad request — malformed request |
401 | Unauthorized — missing or invalid API key |
422 | Validation error — invalid request shape, or an S3 source paired with a non-S3 target |
429 | Too many requests — rate limit exceeded |
500 | Internal server error |
502 | Gateway or upstream error |
Examples
Find examples of using the batch endpoint in Converting Multiple Documents and Batch Conversion.
Related Endpoints
- Convert Source - Convert a single document from a URL
- Convert File - Upload and convert a single local file
- Poll Status - Check conversion progress
- Get Results - Retrieve conversion result artifacts