Translation Task API
Query translation tasks
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
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
| Parameters | Type | Default | Description | Example |
|---|---|---|---|---|
| *taskId | String | - | Translation Task ID | - |
Response
| Parameters | Type | Default | Description | Example |
|---|---|---|---|---|
| taskId | String | - | Task ID | - |
| model | String | - | Translation model used | - |
| fromLang | String | - | Source language | - |
| toLang | String | - | Target Language | - |
| status | String | - | Status: 'Init' | 'Waiting' | 'Processing' | 'Completed' | 'Terminated' | 'Cancelled' | - |
| progress | Number | - | Progress: 0~100 | - |
| errorMsg | String | - | Error message | - |
| fileTitle | String | - | Original File Name | - |
| fileUrl | String | - | Original File Download URL | - |
| translatedFileUrl | String | - | Translation download URL | - |
| translatedBilingualFileUrl | String | - |
| - |
| translatedEditableFileUrl | String | - | Editable translation file download URL. Only returned when editable results are generated for the corresponding file type. | - |
| tokenCount | Integer | - |
| - |
| wordNums | Integer | - | Document word count statistics. May be empty depending on file type. | - |
| price | Integer | - | Total Credits required for the complete translation | - |
| usedCredits | Integer | - | Number of credits used by the translation task | - |
| glossary | String[] | - | Glossary name used by the translation task | - |
| shouldTranslateImage | Boolean | - | Translate images in document | - |
| forceOCR | Boolean | - | Force OCR for document content recognition | - |
| createdAt | DateTime | - | Creation time of the translation task | - |
| updatedAt | DateTime | - | 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.