Document Directory

Translation Task API

Query translation tasks

POST/v1/translation/query

Query the status and details of a translation task.

Complete Address
https://deploy-demo.otranslator.com/api/v1/translation/query
Authentication
API Key needs to be passed in the Authorization request header
Content-Type
application/json
Error Format
{ "error": "Invalid API key." }

Notes

It is recommended to poll this interface when the task status is Waiting or Processing, and stop polling after the status enters Completed, Terminated, or Cancelled.

The download link is a temporary access address. Please save the file or re-query as needed on the business side.

Example

1curl -X POST 'https://deploy-demo.otranslator.com/api/v1/translation/query' \
2--header 'Authorization: [yourSecretKey]' \
3--header 'Content-Type: application/json' \
4--data '{
5  "taskId": "[string]"
6}'

Request Parameters

ParametersTypeDefaultDescriptionExample
Required: taskIdString-

Translation Task ID

-

Response

ParametersTypeDefaultDescriptionExample
taskIdString-

Task ID

-
modelString-

Translation model used

-
fromLangString-

Source language

-
toLangString-

Target Language

-
statusString-

Status: 'Init' | 'Waiting' | 'Processing' | 'Completed' | 'Terminated' | 'Cancelled'

-
progressNumber-

Progress: 0-100

-
errorMsgString-

Error message

-
fileTitleString-

Original File Name

-
fileUrlString-

Original File Download Address

-
translatedFileUrlString-

Translation download URL

-
translatedBilingualFileUrlString-
  • Download URL for bilingual translation; only supports PDF, DOCX, PPTX, XLSX, EPUB, CSV, SRT, TXT, HTML, ODF
  • When the file is too large or translation errors occur, bilingual translation will not be generated
-
translatedEditableFileUrlString-

Download URL for editable translation file. Returned only when an editable result is generated for the corresponding file type.

-
tokenCountInteger-
  • Tokens for text to be translated in the document
  • Image translation in PDFs is calculated at 1200 Tokens per page
-
wordNumsInteger-

Document statistics word count. May be empty for different file types.

-
priceInteger-

Total credits required for translation

-
usedCreditsInteger-

Number of credits used by translation task

-
glossaryString[]-

Glossary name used for translation tasks

-
shouldTranslateImageBoolean-

Whether to translate images in documents

-
forceOCRBoolean-

Whether to force use of OCR to recognize document content

-
createdAtDateTime-

Translation task creation time

-
updatedAtDateTime-

Translation task update time

-

Common Errors

401 Missing API key.

The Authorization request header is required.

401 Invalid API key.

The API key does not exist, has been deleted, or is no longer valid.

400 Missing required parameter: taskId.

Provide the taskId returned by the create translation task API.

404 Task not found.

The task does not exist, has been deleted, does not belong to the current API account, or was not created through the API.

Translation Task API
Create translation task
Translation Task API
Delete translation task