The Doctranslate document translation platform provides programmatic access to document translation for formats including DOCX, PDF, PPTX, and XLSX via standard HTTP endpoints. Full technical references are maintained in the Doctranslate API Documentation .

Technical Requirements for English to Bangla Document Translation

Automating English to Bangla document workflows requires accounting for script characteristics and structural document constraints:

  • Complex Script Rendering: Bangla uses conjunct characters (যুক্তবর্ণ - juktoborno) and dependent vowel signs (kar and fola) requiring Unicode font shaping engines. Text extractors without proper font mapping can split conjunct sequences.
  • Left-to-Right Text Alignment: Both English and Bangla follow a left-to-right (LTR) reading direction. When integrating automated translation into formatted files, layout engines must handle variable text bounds across table cells and defined blocks.
  • Tabular and Columnar Structure: Business documents such as financial statements and operational agreements rely on table columns and alignment. Processing files as structured documents rather than fragmented strings preserves table structures.

API Endpoint Specifications

The translation service provides endpoints for single-file and batch document workflows. Official documentation for document translation endpoints is available at Document Translation API v2 and Document Translation API v3 .

Endpoint: POST /v2/translate/document

  • Documentation URL: https://developer.doctranslate.io/document-translation-api/translation-api/api-v2/document-translation.md
  • Base Endpoint: https://api-doc.doctranslate.io
  • HTTP Method: POST
  • Path: /v2/translate/document
  • Authentication: OAuth2PasswordBearer (Authorization: Bearer <your_api_token> or X-API-Key: <your_api_key>)
  • Request Body Type: multipart/form-data

The endpoint accepts the following parameters:

ParameterTypeRequiredValues and Description
fileFileYesDocument file upload. Supported formats: DOCX, PDF, PPTX, XLSX.
file_typeStringYesFile extension string: DOCX, PDF, PPTX, XLSX.
original_langStringNoSource language code (e.g., en).
dest_langStringYesTarget language code (bn for Bangla).
process_modeStringNoOutput processing mode: replace (replaces source text), append (bilingual output), append_reverse.
style_modeIntegerNoStyling preference for translation output (Default: 0). Influences formatting and presentation.
translate_typeStringNoTranslation engine version: Paraphrase, Professional.
is_translate_imagesBoolNoBoolean flag indicating whether images within the document should also be translated.
toneStringNoTone of the translation.
domainStringNoDomain specialization to assist model selection (e.g., legal, finance).
bilingual_text_style__fontStringNoFont name used when process_mode=append.
bilingual_text_style__colorStringNoColor value used when process_mode=append.
dictionaryStringNoCustom dictionary in JSON format specifying word-level translations.
custom_promptStringNoCustom prompt instructions passed to the translation engine.

Endpoint: POST /v3/process (Batch File Translation)

  • Documentation URL: https://developer.doctranslate.io/document-translation-api/translation-api/api-v3/translate-multiple-files-currently-supports-document-summarization.md
  • HTTP Method: POST
  • Path: /v3/process
  • Request Body Type: application/json
  • Parameters: Accepts task_type (document, images, audio, video, summarization, create_video), meta_files (array containing uploaded file metadata and task identifiers), dest_lang, process_mode, translate_type, dictionary, and output_format.

Polling and Result Retrieval: GET /v3/result/{task_id}

  • Documentation URL: https://developer.doctranslate.io/document-translation-api/translation-api/api-v3/get-result.md
  • HTTP Method: GET
  • Path: /v3/result/{task_id}
  • Authentication: Authorization: Bearer <your_api_token> or X-API-Key: <your_api_key>

Document Translation Response Schema

Submitting a document to /v2/translate/document or /v3/translate/document returns:

json
{
  "status_code": 200,
  "content": {
    "data": {
      "task_id": "0d05c89e6f2c472ab86b291516e8e466"
    },
    "errors": [],
    "error_description": "",
    "start_time": "2024-03-11 13:05:42.080757",
    "end_time": "2024-03-11 13:05:42.348086",
    "status": "success"
  }
}

Polling Result Response Schema

Calling GET /v3/result/{task_id} returns job progress and output metadata:

json
{
  "status_code": 200,
  "content": {
    "data": {
      "0d05c89e6f2c472ab86b291516e8e466": {
        "task_id": "0d05c89e6f2c472ab86b291516e8e466",
        "url_download": "https://media.doctranslate.io/output/docx/document_bn.docx",
        "type": "document",
        "status": "done",
        "file_name": "document_bn.docx",
        "dest_lang": "bn",
        "translation_type": "Document"
      }
    },
    "errors": [],
    "error_description": "",
    "status": "success"
  }
}

Configuring Custom Terminology Dictionaries

For specialized technical, corporate, or financial documentation, developers can enforce word-level translation mappings via the dictionary parameter. In the single-document endpoint, the parameter takes a serialized JSON string or object mapping source terms to target terms:

json
{
  "balance sheet": "উদ্বৃত্তপত্র",
  "cash flow": "নগদ प्रवाह",
  "operating income": "পরিচালন আয়"
}

Note on language verification: The English-to-Bangla financial terms above are sample translations and have not yet been independently verified by a native Bangla linguist; project teams should have translations reviewed by local language specialists before production deployment.

Supported File Formats

The translation API processes core document file extensions:

  • Microsoft Word (.docx): Translates paragraphs, headers, and embedded tables.
  • Adobe PDF (.pdf): Translates digital PDFs and scanned documents via optical character recognition (OCR), supporting output formatting configurations detailed in API v3 specifications.
  • Microsoft Excel (.xlsx): Translates cell text across worksheets while retaining tabular cell arrangements.
  • Microsoft PowerPoint (.pptx): Translates text blocks across slide presentations.

File processing on the web interface accommodates up to 3 files and 300 MB total per upload. API account limits and quota specifications are detailed in the System Requirement documentation.

Output Processing Modes and Error Handling

The API provides granular control over bilingual file generation through the process_mode parameter:

  • replace: Replaces the source English text entirely with the translated Bangla output while maintaining container coordinates.
  • append: Appends the translated Bangla text directly beneath the original English segment, generating a bilingual comparison document. Developers can configure font family and color using `bilingual_text_stylefont and bilingual_text_stylecolor`.
  • append_reverse: Places the translated Bangla text first, followed by the original English reference text.

When error states occur during document processing, the API returns structured error payloads:

  • HTTP 400 Bad Request: Returned if the uploaded document payload cannot be processed or if required parameters are missing. The response body contains an errors array and an error_description clarifying the parsing issue.
  • HTTP 401 Authentication Error: Returned when the request lacks a valid bearer token or when the API key provided in headers is invalid, returning {"detail": "Not authenticated"}.

Implementation Workflow and Python Integration

Integrating the API into a document localization workflow involves three steps: submitting the multipart file payload, polling the task result endpoint until processing completes, and downloading the output file from the returned storage URL.

The following Python script illustrates submitting a DOCX file for English to Bangla translation with polling and timeout safeguards:

python
import time
import requests

API_BASE = "https://api-doc.doctranslate.io"
API_TOKEN = "your_api_token_here"

headers = {
    "Authorization": f"Bearer {API_TOKEN}"
}

with open("annual_report_en.docx", "rb") as f:
    files = {
        "file": ("annual_report_en.docx", f, "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
    }
    data = {
        "file_type": "DOCX",
        "original_lang": "en",
        "dest_lang": "bn",
        "process_mode": "replace",
        "translate_type": "Professional"
    }
    
    response = requests.post(f"{API_BASE}/v2/translate/document", headers=headers, files=files, data=data)
    response.raise_for_status()
    payload = response.json()
    task_id = payload.get("content", {}).get("data", {}).get("task_id")

if not task_id:
    raise ValueError("No task_id returned from API")

    # Polling safeguard with timeout and maximum attempt limits
max_attempts = 60
poll_interval_seconds = 5
download_url = None

for attempt in range(max_attempts):
    time.sleep(poll_interval_seconds)
    poll_resp = requests.get(f"{API_BASE}/v3/result/{task_id}", headers=headers)
    poll_resp.raise_for_status()
    content = poll_resp.json().get("content", {})
    task_data = content.get("data", {}).get(task_id, {})
    status = task_data.get("status")
    
    if status == "done":
        download_url = task_data.get("url_download")
        break
    elif status == "failed":
        raise RuntimeError(f"Translation task {task_id} failed.")

if download_url:
    print(f"Translation finished. Download URL: {download_url}")
else:
    print("Polling timed out before document translation completed.")

Teams evaluating document workflows can test translation and layouts directly on Doctranslate Document Translation before automating integration via developer endpoints.

Frequently Asked Questions

Which document formats are supported by the English to Bangla translation API?
The API processes DOCX, PDF, PPTX, and XLSX files while preserving document structure, typography, and tables.
How does the API handle specialized terminology?
Developers can supply custom JSON dictionaries via the dictionary parameter containing word-level translations for domain-specific terminology.
Where can developers access the official API documentation?
Complete technical specifications, parameter schemas, and authentication guides are available in the Doctranslate API Documentation at https://developer.doctranslate.io.