Translation Task API
Query translation tasks
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
| Parameters | Type | Default | Description | Example |
|---|---|---|---|---|
| Required: 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 Address | - |
| translatedFileUrl | String | - | Translation download URL | - |
| translatedBilingualFileUrl | String | - |
| - |
| translatedEditableFileUrl | String | - | Download URL for editable translation file. Returned only when an editable result is generated for the corresponding file type. | - |
| tokenCount | Integer | - |
| - |
| wordNums | Integer | - | Document statistics word count. May be empty for different file types. | - |
| price | Integer | - | Total credits required for translation | - |
| usedCredits | Integer | - | Number of credits used by translation task | - |
| glossary | String[] | - | Glossary name used for translation tasks | - |
| shouldTranslateImage | Boolean | - | Whether to translate images in documents | - |
| forceOCR | Boolean | - | Whether to force use of OCR to recognize document content | - |
| createdAt | DateTime | - | Translation task creation time | - |
| 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.