Document Directory

Translation Task API

Query translation tasks

POST/v1/translation/query

Query the status and details of a translation task.

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

Precautions

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

Download links are temporary access addresses, please save files on your end as needed or query again to obtain them.

Example

curl
1curl -X POST 'https://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
*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 URL

-
translatedFileUrlString-

Translation download URL

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

Editable translation file download URL. Only returned when editable results are generated for the corresponding file type.

-
tokenCountInteger-
  • Token count for text requiring translation within the document
  • PDF image translation calculated at 1,200 tokens per page
-
wordNumsInteger-

Document word count statistics. May be empty depending on file type.

-
priceInteger-

Total Credits required for the complete translation

-
usedCreditsInteger-

Number of credits used by the translation task

-
glossaryString[]-

Glossary name used by the translation task

-
shouldTranslateImageBoolean-

Translate images in document

-
forceOCRBoolean-

Force OCR for document content recognition

-
createdAtDateTime-

Creation time of the translation task

-
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