xdoc-translationx

# Xdoc Translation API Skill

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "xdoc-translationx" with this command: npx skills add yangsongbai1/xdoc-translationx

Xdoc Translation API Skill

You are a document translation assistant powered by the Xdoc Translation API. This skill enables you to translate documents and text between multiple languages.


Authentication & API Key

How to Get an API Key

  1. Visit https://translation.x-doc.ai/
  2. Sign up or log in to your account
  3. Navigate to UserAPI ManagementMy API
  4. Click Create API Key and copy your key
  5. Store the API key securely (it will only be shown once)

Required Credential

VariableDescriptionRequired
XDOC_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.

Security Notes

  • Never share your API key in public repositories or logs
  • API keys are tied to your account and usage quota
  • You can revoke and regenerate keys at any time from the dashboard
  • All API requests are encrypted via HTTPS

Service Information

PropertyValue
ProviderXdoc (https://x-doc.ai)
API Base URLhttps://translation.x-doc.ai/api/open_api/v1
Supportsupport@x-doc.ai

Core Workflow

Document Translation Flow

1. Create Upload URL → 2. Upload File → 3. Submit Translation → 4. Poll Status → 5. Download Result

Step-by-Step:

  1. Create Upload URL

    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
    
  2. Upload File

    • Option A: User uploads via upload_page_url in browser (drag-and-drop)
    • Option B: PUT request to upload_url with file content
  3. Submit Translation

    POST /translate/document
    Headers: x-api-key: <your_api_key>
    Body: {
      "file_id": 123456789,
      "source_language": "en",
      "target_language": "zh-cn",
      "trans_mode": "master"
    }
    
  4. Poll Status (every 3-5 seconds)

    POST /translate/status
    Headers: x-api-key: <your_api_key>
    Body: {"file_id": "123456789"}
    Returns: status_name (parsing/translating/compositing/completed)
    
  5. Download Translation

    • When status_name == "completed", response includes download_url

API Capabilities

Document Translation

FunctionEndpointMethod
Create Upload URL/files/create_upload_urlPOST
Submit Translation/translate/documentPOST
Check Status/translate/statusPOST
Delete File/files/deletePOST

Text Translation

FunctionEndpointMethod
Instant Translate/text/translatePOST

Glossary (Term Library)

FunctionEndpointMethod
Create Glossary/term-libs/createPOST
List Glossaries/term-libs/listPOST
Edit Glossary/term-libs/editPOST
Delete Glossary/term-libs/deletePOST
Add Terms/term-entries/addPOST
List Terms/term-entries/listPOST
Edit Term/term-entries/editPOST
Delete Terms/term-entries/deletePOST

Translation Memory

FunctionEndpointMethod
Create Memory/memory-libs/createPOST
List Memories/memory-libs/listPOST
Edit Memory/memory-libs/editPOST
Delete Memory/memory-libs/deletePOST
Add Entries/memory-entries/addPOST
List Entries/memory-entries/listPOST
Edit Entry/memory-entries/editPOST
Delete Entries/memory-entries/deletePOST

Utility

FunctionEndpointMethod
Get Supported Languages/languagesGET

Usage Guide

Translation Modes

  • deep: Standard quality, faster processing
  • master: Premium quality, recommended for professional use

Supported File Formats

docx, doc, pdf, pptx, ppt, xlsx, xls, txt, xml

PDF Handling

  • Editable PDF (with selectable text): is_can_edit: true
  • Scanned/Image PDF: is_can_edit: false (enables OCR)

Using Glossaries

Ensure consistent terminology by specifying glossary IDs:

{
  "file_id": 123456789,
  "source_language": "en",
  "target_language": "zh-cn",
  "term_lib_ids": [1, 2]
}

Using Translation Memory

Reuse previous translations with memory libraries:

{
  "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.8

Status Reference

Translation Status Flow

parsing → pending → translating → compositing → completed
    ↓         ↓           ↓
parse_failed  ...   translation_failed

Status Definitions

StatusMeaningAction
parsingParsing documentContinue polling
pendingWaiting for translationContinue polling
translatingTranslation in progressContinue polling
compositingGenerating output fileContinue polling
completedDoneGet download_url
parse_failedParse errorCheck file format
translation_failedTranslation errorRetry or contact support

Language Codes

CodeLanguageCodeLanguage
enEnglishzh-cnChinese (Simplified)
jaJapanesekoKorean
deGermanfrFrench
esSpanishptPortuguese
ruRussianarArabic
thThaiviVietnamese
zh-twChinese (Traditional)itItalian

Use /languages endpoint for the complete list.


Example Scenarios

Scenario 1: Translate a Word Document

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

Scenario 2: Instant Text Translation

User: Translate "Hello World" to Japanese

Call:
POST /text/translate
{"text": "Hello World", "source_language": "en", "target_language": "ja"}

Returns: "こんにちは世界"

Scenario 3: Translate with Glossary

1. Create glossary and add terms
2. Specify term_lib_ids when translating
3. Ensures consistent translation of technical terms

Error Handling

All API responses follow this format:

{
  "code": 0,
  "message": "success",
  "data": { ... }
}

Success

CodeMessageDescription
0successRequest completed successfully

Authentication Errors (910xx)

CodeMessageResolution
91000API Key is requiredAdd x-api-key header
91001Invalid API KeyCheck your API key is correct
91002API Key has expiredRenew your API key
91003API Key is disabledContact support or create new key
91004API Key is not yet effectiveWait until the key activation date
91005Customer not foundVerify your account status
91006Rate limit exceededReduce request frequency, retry later

File Translation Errors (911xx)

CodeMessageResolution
91100File size exceeds the limitReduce file size (max 50MB)
91101File type not supportedUse supported formats: docx, pdf, pptx, xlsx, txt, xml
91102File upload failedRetry upload
91103File not foundVerify file_id is correct
91104File status does not allow this operationCheck current file status
91105Insufficient account balanceTop up your account
91107Task not foundVerify task_id is correct
91108Task not completed, cannot downloadWait for translation to complete
91109Translated file not foundRetry translation
91110Failed to get download URLRetry later
91111File is being translated, cannot operateWait for current translation to finish
91112File has not been uploaded yetUpload file before submitting translation

Glossary Errors (912xx)

CodeMessageResolution
91200Term library name already existsUse a different name
91201Term library not foundVerify term_lib_id is correct
91202Source term already existsUpdate existing term instead
91203Term entry not foundVerify entry_id is correct
91204Entry list cannot be emptyProvide at least one entry

Translation Memory Errors (913xx)

CodeMessageResolution
91300Memory library name already existsUse a different name
91301Memory library not foundVerify memory_lib_id is correct
91302Memory entry not foundVerify entry_id is correct
91303Entry list cannot be emptyProvide at least one entry

Text Translation Errors (915xx)

CodeMessageResolution
91500Text exceeds model token limitReduce text length (max 5000 chars)
91501Translation service errorRetry later
91502Translation returned empty resultCheck source text is valid

Best Practices

  1. Polling Interval: Wait 3-5 seconds between status checks
  2. File Size: Recommended max 50MB per file
  3. Concurrency: Max 10 simultaneous translation tasks
  4. Glossaries: Use same glossary for documents in the same domain
  5. Memory Maintenance: Regularly clean outdated translation memories

Privacy & Data Handling

  • Data Encryption: All data transmitted via HTTPS/TLS
  • Data Retention: Uploaded files are automatically deleted after 7 days
  • No Third-Party Sharing: Your documents are not shared with third parties
  • Compliance: Service complies with GDPR and data protection regulations
  • Data Location: Files are processed and stored in secure cloud infrastructure

For privacy policy details, visit: https://x-doc.ai/privacy

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Huo15 Openclaw Enhance

火一五·克劳德·龙虾增强插件 v5.7.8 — 全面适配 openclaw 2026.4.24:peerDep ^4.24 + build/compat 同步到 4.24 + 14 处 api.on 全部去掉 as any 改成 typed hook(hookName 联合类型 + handler 自动推断 Pl...

Registry SourceRecently Updated
General

Content Trend Analyzer

Aggregates and analyzes content trends across platforms to identify hot topics, user intent, content gaps, and generates data-driven article outlines.

Registry SourceRecently Updated
General

Prompt Debugger

Debug prompts that produce unexpected AI outputs — diagnose failure modes, identify ambiguity and conflicting instructions, test variations, compare model re...

Registry SourceRecently Updated
General

Indie Maker News

独行者 Daily - 变现雷达。读对一条新闻,少走一年弯路。每天5分钟,给创业者装上商业雷达。聚焦一人公司、副业、创业变现资讯,智能分类,行动导向。用户下载即能用,无需本地部署!

Registry SourceRecently Updated