Document Directory

Create translation

Create a translation task.

curl
1curl -X POST 'https://otranslator.com/api/v1/translation/create' \
2--header 'Authorization: [yourSecretKey]' \
3--form 'fromLang=English' \
4--form 'toLang=Simplified Chinese' \
5--form 'glossary=[GlossaryName]' \
6--form 'file=@bitcoin.pdf'

Request Parameters

Supported languages:
English、Simplified Chinese、Traditional Chinese (Hong Kong)、Traditional Chinese (Taiwan)、Traditional Chinese、Spanish、Portuguese、Russian、Italian、French、German、Ukrainian、Swedish、Japanese、Japanese (Honorifics)、Japanese (Humble)、Japanese (Polite)、Polish、Turkish、Korean、Malay、Lao、Thai、Vietnamese、Bengali、Burmese、Finnish、Georgian、Greek、Albanian、Arabic、Armenian、Azerbaijani、Belarusian、Bulgarian、Canadian French、Catalan、Croatian、Czech、Danish、Dutch、Estonian、Filipino、Gujarati、Haitian Creole、Hebrew、Hindi、Hungarian、Icelandic、Indonesian、Irish、Kazakh、Khmer、Latin、Latin American Spanish、Brazilian Portuguese、Latvian、Lithuanian、Macedonian、Maltese、Mongolian (Cyrillic)、Norwegian、Persian、Romanian、Serbian (Cyrillic letters)、Serbian (Latin letters)、Sinhala、Slovak、Slovenian、Swahili、Tamil、Telugu、Oriya、Kannada、Punjabi、Marathi、Malayalam、Uzbek、Urdu、Amharic、Uyghur、Cantonese、Yiddish、Tigrinya、Any Language

  • *fromLang - String - Source language, the source language cannot be the same as the target language, see supported languages
  • *toLang - String - Target language, the target language cannot be the same as the source language, see supported languages
  • *model - String - Optional model: gpt-4o-mini | gpt-4o | gemini-flash | gemini-pro | claude-haiku | claude-sonnet
  • *file - binary - Files that need to be translated,Supported file types: .PDF .DOCX .XLSX .PPTX .EPUB .PO .SRT .TXT .HTML .ZIP .XML .XLF .GO .JPG .JPEG .PNG .MD .ODT .ODS .ODP .CSV .TSV .YAML .PHP .AI
  • shouldTranslateImage - String - Valid values: "true" or "false". Whether to translate images in PDF documents, default is false
  • glossary - String - Name of the glossary used in translation
  • preview - String - Valid values: "true" or "false". Generate a preview of the document translation by paying 2 credits

Response

  • taskId - String - ID of the task created

Query translation

Query translation tasks, including task status, translated file link

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

Request Parameters

  • *taskId - String - Translation task ID

Response

  • status - String - 'Waiting' | 'Processing' | 'Completed' | 'Terminated'
  • progress - integer - 0~100, Translation task progress
  • translatedFileUrl - String - Translation file download link, valid only when the translation is completed (status ='Completed')
  • translatedBilingualFileUrl - String - Download link for translated bilingual documents, valid only when the translation is completed (status = 'Completed')
  • usedCredits - integer - Credits used for translation
  • tokenCount - integer - Number of tokens corresponding to the text in the document
  • glossary - String[] - Glossary name used in the document

Delete translation

Delete translation tasks and related documents. Translation tasks created by the API will be automatically deleted after 7 days.

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

Request Parameters

  • *taskId - String - Translation task ID needed to be deleted