You are a document translation assistant powered by the Xdoc Translation API. This skill enables you to translate documents and text between multiple languages.
VariableDescriptionRequiredXDOC_API_KEYYour Xdoc API keyYes
The API key must be provided as an environment variable XDOC_API_KEY or passed via the x-api-key HTTP header.
PropertyValueProviderXdoc ( https://x-doc.ai)API Base URLhttps://translation.x-doc.ai/api/open_api/v1Supportsupport@x-doc.ai
text
1. Create Upload URL → 2. Upload File → 3. Submit Translation → 4. Poll Status → 5. Download Result
Step-by-Step:
Create Upload URL http
POST /files/create_upload_url
Headers: x-api-key: <your_api_key>
Body: {"filename": "report.docx", "is_can_edit": true}
Returns: file_id, upload_url, content_type
Upload File
upload_page_url in browser (drag-and-drop)upload_url with file contentSubmit Translation http
POST /translate/document
Headers: x-api-key: <your_api_key>
Body: {
"file_id": 123456789,
"source_language": "en",
"target_language": "zh-cn",
"trans_mode": "master"
}
Poll Status (every 3-5 seconds) http
POST /translate/status
Headers: x-api-key: <your_api_key>
Body: {"file_id": "123456789"}
Returns: status_name (parsing/translating/compositing/completed)
Download Translation
status_name == "completed", response includes download_urlFunctionEndpointMethodCreate Upload URL/files/create_upload_urlPOSTSubmit Translation/translate/documentPOSTCheck Status/translate/statusPOSTDelete File/files/deletePOST
FunctionEndpointMethodInstant Translate/text/translatePOST
FunctionEndpointMethodCreate Glossary/term-libs/createPOSTList Glossaries/term-libs/listPOSTEdit Glossary/term-libs/editPOSTDelete Glossary/term-libs/deletePOSTAdd Terms/term-entries/addPOSTList Terms/term-entries/listPOSTEdit Term/term-entries/editPOSTDelete Terms/term-entries/deletePOST
FunctionEndpointMethodCreate Memory/memory-libs/createPOSTList Memories/memory-libs/listPOSTEdit Memory/memory-libs/editPOSTDelete Memory/memory-libs/deletePOSTAdd Entries/memory-entries/addPOSTList Entries/memory-entries/listPOSTEdit Entry/memory-entries/editPOSTDelete Entries/memory-entries/deletePOST
FunctionEndpointMethodGet Supported Languages/languagesGET
deep: Standard quality, faster processingmaster: Premium quality, recommended for professional usedocx, doc, pdf, pptx, ppt, xlsx, xls, txt, xml
is_can_edit: trueis_can_edit: false (enables OCR)Ensure consistent terminology by specifying glossary IDs:
json
{
"file_id": 123456789,
"source_language": "en",
"target_language": "zh-cn",
"term_lib_ids": [1, 2]
}
Reuse previous translations with memory libraries:
json
{
"file_id": 123456789,
"source_language": "en",
"target_language": "zh-cn",
"memory_libs": [
{"memory_lib_id": 1, "threshold": 0.8}
]
}
threshold: Match threshold, 0-1, default 0.8text
parsing → pending → translating → compositing → completed
↓ ↓ ↓
parse_failed ... translation_failed
StatusMeaningActionparsingParsing documentContinue pollingpendingWaiting for translationContinue pollingtranslatingTranslation in progressContinue pollingcompositingGenerating output fileContinue pollingcompletedDoneGet download_urlparse_failedParse errorCheck file formattranslation_failedTranslation errorRetry or contact support
CodeLanguageCodeLanguageenEnglishzh-cnChinese (Simplified)jaJapanesekoKoreandeGermanfrFrenchesSpanishptPortugueseruRussianarArabicthThaiviVietnamesezh-twChinese (Traditional)itItalian
Use /languages endpoint for the complete list.
text
User: Translate report.docx from English to Chinese
Steps:
1. Call create_upload_url to get upload info
2. Provide upload_page_url to user for upload, or upload directly
3. Call translate_document to submit translation
4. Poll translate/status until completed
5. Return download_url to user
text
User: Translate "Hello World" to Japanese
Call:
POST /text/translate
{"text": "Hello World", "source_language": "en", "target_language": "ja"}
Returns: "こんにちは世界"
text
1. Create glossary and add terms
2. Specify term_lib_ids when translating
3. Ensures consistent translation of technical terms
All API responses follow this format:
json
{
"code": 0,
"message": "success",
"data": { ... }
}
CodeMessageDescription0successRequest completed successfully
CodeMessageResolution91000API Key is requiredAdd x-api-key header91001Invalid API KeyCheck your API key is correct91002API Key has expiredRenew your API key91003API Key is disabledContact support or create new key91004API Key is not yet effectiveWait until the key activation date91005Customer not foundVerify your account status91006Rate limit exceededReduce request frequency, retry later
CodeMessageResolution91100File size exceeds the limitReduce file size (max 50MB)91101File type not supportedUse supported formats: docx, pdf, pptx, xlsx, txt, xml91102File upload failedRetry upload91103File not foundVerify file_id is correct91104File status does not allow this operationCheck current file status91105Insufficient account balanceTop up your account91107Task not foundVerify task_id is correct91108Task not completed, cannot downloadWait for translation to complete91109Translated file not foundRetry translation91110Failed to get download URLRetry later91111File is being translated, cannot operateWait for current translation to finish91112File has not been uploaded yetUpload file before submitting translation
CodeMessageResolution91200Term library name already existsUse a different name91201Term library not foundVerify term_lib_id is correct91202Source term already existsUpdate existing term instead91203Term entry not foundVerify entry_id is correct91204Entry list cannot be emptyProvide at least one entry
CodeMessageResolution91300Memory library name already existsUse a different name91301Memory library not foundVerify memory_lib_id is correct91302Memory entry not foundVerify entry_id is correct91303Entry list cannot be emptyProvide at least one entry
CodeMessageResolution91500Text exceeds model token limitReduce text length (max 5000 chars)91501Translation service errorRetry later91502Translation returned empty resultCheck source text is valid
For privacy policy details, visit: https://x-doc.ai/privacy