
Unlock Powerful Integrations: API Integration Guide
January 14, 2026
Overview
This document describes all interfaces of the Translation Platform Open API. The Open API allows third-party systems to integrate translation services, including file translation, term library management, and memory library management.
Basic Information
- Base URL:
/api/open_api/v1 - Request Format:
application/json(except for file uploads) - Response Format:
application/json
Authentication
All APIs require an API Key in the request header:
X-API-Key: your_api_key_hereUnified Response Format
{
"code": 0,
"message": "success",
"data": {}
}| Field | Type | Description |
|---|---|---|
| code | int | Status code, 0 indicates success |
| message | string | Status message |
| data | object | Response data |
Rate Limiting (QPS)
To ensure service stability, all APIs have rate limits:
| API Type | QPS Limit | Description |
|---|---|---|
| File Upload | 5/s | Maximum 5 requests per second per API Key |
| Submit Translation | 10/s | Maximum 10 requests per second per API Key |
| Query Status | 10/s | Maximum 10 requests per second per API Key |
| Get Download URL | 10/s | Maximum 10 requests per second per API Key |
| Other APIs | 20/s | Maximum 20 requests per second per API Key |
When rate limit is exceeded, the API returns error code 91006 (Rate limit exceeded). Please reduce request frequency and retry.
General APIs
Get Supported Languages
Get all supported language codes and names.
Request
GET /api/open_api/v1/languagesRequest Parameters
None
Response Data
| Field | Type | Description |
|---|---|---|
| languages | array | Language list |
| languages[].code | string | Language code |
| languages[].name | string | Language name in English |
| total | int | Total number of languages |
Response Example
{
"code": 0,
"message": "success",
"data": {
"languages": [
{"code": "zh-CN", "name": "Chinese Simplified"},
{"code": "en-US", "name": "English"},
{"code": "ja", "name": "Japanese"}
],
"total": 50
}
}File Translation APIs
Upload File
Upload a file for translation.
Request
POST /api/open_api/v1/files/upload
Content-Type: multipart/form-dataRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | File to upload. Supported formats: docx, doc, pdf, pptx, ppt, xlsx, xls, txt, xml |
| is_can_edit | boolean | No | Whether PDF file is editable, default is true |
Response Data
| Field | Type | Description |
|---|---|---|
| file_id | string | File ID |
Response Example
{
"code": 0,
"message": "success",
"data": {
"file_id": "12345678901234567"
}
}Submit Translation Task
Submit a file for translation.
Status Restriction: Only files with status
1(Pending Translation) can be submitted for translation. Calling this API on files with other statuses will return error code91104.
Request
POST /api/open_api/v1/translate/submit
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_id | int | Yes | File ID (integer type) |
| source_language | string | Yes | Source language code (LanguageEnum value, e.g., zh-CN) |
| target_language | string | Yes | Target language code (LanguageEnum value, e.g., en-US) |
| trans_mode | string | Yes | Translation mode: deep (Deep Translation) or master (Master Translation) |
| term_lib_ids | int[] | No | List of term library IDs |
| memory_libs | object[] | No | Memory library configuration list |
| memory_libs[].memory_lib_id | int | Yes | Memory library ID |
| memory_libs[].threshold | float | No | Match threshold, range 0-1, default 0.8 |
Request Example
{
"file_id": 12345678901234567,
"source_language": "zh-CN",
"target_language": "en-US",
"trans_mode": "deep",
"term_lib_ids": [1, 2],
"memory_libs": [
{"memory_lib_id": 1, "threshold": 0.8}
]
}Response Data
| Field | Type | Description |
|---|---|---|
| estimated_cost | string | Estimated cost |
Response Example
{
"code": 0,
"message": "success",
"data": {
"estimated_cost": "10.50"
}
}Query File Status
Batch query file translation status.
Request
POST /api/open_api/v1/files/status
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_ids | string[] | Yes | List of file IDs (string type), maximum 20 |
Request Example
{
"file_ids": ["12345678901234567", "12345678901234568"]
}Response Data
| Field | Type | Description |
|---|---|---|
| files | array | File status list |
| files[].file_id | string | File ID |
| files[].status | int | File status code (see table below) |
| files[].filename | string | Filename (null if not exists) |
| files[].word_count | int | Word count (null if not exists) |
| files[].source_language | string | Source language code (null if not exists) |
File Status Codes
| Status Code | Description |
|---|---|
| -1 | File not found |
| 14 | Parsing |
| 15 | Parse failed |
| 1 | Pending translation |
| 5 | Analyzing |
| 6 | Analysis failed |
| 7 | Analyzed |
| 2 | Translating |
| 3 | Translation failed |
| 4 | Translated |
| 16 | Extracting |
| 17 | Extraction failed |
| 18 | Extraction completed |
Response Example
{
"code": 0,
"message": "success",
"data": {
"files": [
{
"file_id": "12345678901234567",
"status": 4,
"filename": "document.docx",
"word_count": 1500,
"source_language": "zh-CN"
},
{
"file_id": "99999999999999999",
"status": -1,
"filename": null,
"word_count": null,
"source_language": null
}
]
}
}Get Download URL
Get the download URL for a translated file.
Status Restriction: Only files with status
4(Translated) can get download URL. Calling this API on files that are not yet translated will return error code91108.
Request
POST /api/open_api/v1/translate/download
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_id | string | Yes | File ID (string type) |
Request Example
{
"file_id": "12345678901234567"
}Response Data
| Field | Type | Description |
|---|---|---|
| file_id | string | File ID |
| status | string | Status: compositing - composing, completed - completed |
| download_url | string | Download URL (null when compositing) |
| filename | string | Filename (null when compositing) |
| expires_in | int | URL expiration time in seconds (null when compositing) |
Response Example (Compositing)
{
"code": 0,
"message": "success",
"data": {
"file_id": "12345678901234567",
"status": "compositing",
"download_url": null,
"filename": null,
"expires_in": null
}
}Response Example (Completed)
{
"code": 0,
"message": "success",
"data": {
"file_id": "12345678901234567",
"status": "completed",
"download_url": "https://storage.example.com/file.docx?token=xxx",
"filename": "document_translated.docx",
"expires_in": 300
}
}Delete File
Delete an uploaded file.
Request
POST /api/open_api/v1/files/delete
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_id | string | Yes | File ID (string type) |
Request Example
{
"file_id": "12345678901234567"
}Response Data
| Field | Type | Description |
|---|---|---|
| file_id | string | File ID |
| deleted | boolean | Whether deletion was successful |
Response Example
{
"code": 0,
"message": "success",
"data": {
"file_id": "12345678901234567",
"deleted": true
}
}Term Library APIs
Create Term Library
Create a new term library.
Request
POST /api/open_api/v1/term-libs/create
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Term library name, max 255 characters |
| source_language | string | Yes | Source language code (LanguageEnum value) |
| target_language | string | Yes | Target language code (LanguageEnum value) |
| description | string | No | Description, max 500 characters |
Request Example
{
"name": "Technical Terms",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "IT technical terminology"
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Term library ID |
| name | string | Term library name |
| source_language | string | Source language code |
| target_language | string | Target language code |
| description | string | Description |
| entry_count | int | Number of entries |
| create_time | datetime | Creation time |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"name": "Technical Terms",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "IT technical terminology",
"entry_count": 0,
"create_time": "2024-01-15T10:30:00"
}
}List Term Libraries
Get paginated list of term libraries.
Request
POST /api/open_api/v1/term-libs/list
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | int | No | Page number, default 1, minimum 1 |
| size | int | No | Page size, default 10, range 1-100 |
| keyword | string | No | Keyword search, max 100 characters |
| source_language | string | No | Source language filter (LanguageEnum value) |
| target_language | string | No | Target language filter (LanguageEnum value) |
Request Example
{
"page": 1,
"size": 10,
"keyword": "technical",
"source_language": "zh-CN",
"target_language": "en-US"
}Response Data
| Field | Type | Description |
|---|---|---|
| items | array | Term library list |
| items[].id | int | Term library ID |
| items[].name | string | Term library name |
| items[].source_language | string | Source language code |
| items[].target_language | string | Target language code |
| items[].description | string | Description |
| items[].entry_count | int | Number of entries |
| items[].create_time | datetime | Creation time |
| items[].update_time | datetime | Update time |
| total | int | Total count |
| page | int | Current page |
| size | int | Page size |
| pages | int | Total pages |
Response Example
{
"code": 0,
"message": "success",
"data": {
"items": [
{
"id": 1,
"name": "Technical Terms",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "IT technical terminology",
"entry_count": 150,
"create_time": "2024-01-15T10:30:00",
"update_time": "2024-01-16T08:00:00"
}
],
"total": 5,
"page": 1,
"size": 10,
"pages": 1
}
}Edit Term Library
Edit term library information.
Request
POST /api/open_api/v1/term-libs/edit
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | int | Yes | Term library ID |
| name | string | No | New name, max 255 characters |
| description | string | No | New description, max 500 characters |
Request Example
{
"id": 1,
"name": "New Term Library Name",
"description": "Updated description"
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Term library ID |
| name | string | Term library name |
| source_language | string | Source language code |
| target_language | string | Target language code |
| description | string | Description |
| entry_count | int | Number of entries |
| update_time | datetime | Update time |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"name": "New Term Library Name",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "Updated description",
"entry_count": 150,
"update_time": "2024-01-16T10:00:00"
}
}Delete Term Library
Delete a term library and all its entries.
Request
POST /api/open_api/v1/term-libs/delete
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | int | Yes | Term library ID |
Request Example
{
"id": 1
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Term library ID |
| deleted | boolean | Whether deletion was successful |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"deleted": true
}
}Add Term Entries
Add one or more entries to a term library.
Request
POST /api/open_api/v1/term-entries/add
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| term_lib_id | int | Yes | Term library ID |
| entries | object[] | Yes | Entry list |
| entries[].source_text | string | Yes | Source term, max 1000 characters |
| entries[].target_text | string | Yes | Target term, max 1000 characters |
Request Example
{
"term_lib_id": 1,
"entries": [
{"source_text": "人工智能", "target_text": "Artificial Intelligence"},
{"source_text": "机器学习", "target_text": "Machine Learning"}
]
}Response Data
None (data is null)
Response Example
{
"code": 0,
"message": "success",
"data": null
}List Term Entries
Get entries from a term library.
Request
POST /api/open_api/v1/term-entries/list
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| term_lib_id | int | Yes | Term library ID |
| page | int | No | Page number, default 1, minimum 1 |
| size | int | No | Page size, default 10, range 1-100 |
| keyword | string | No | Keyword search, max 100 characters |
Request Example
{
"term_lib_id": 1,
"page": 1,
"size": 10,
"keyword": "AI"
}Response Data
| Field | Type | Description |
|---|---|---|
| items | array | Entry list |
| items[].id | int | Entry ID |
| items[].source_text | string | Source term |
| items[].target_text | string | Target term |
| items[].create_time | datetime | Creation time |
| items[].update_time | datetime | Update time |
| total | int | Total count |
| page | int | Current page |
| size | int | Page size |
| pages | int | Total pages |
Response Example
{
"code": 0,
"message": "success",
"data": {
"items": [
{
"id": 1,
"source_text": "人工智能",
"target_text": "Artificial Intelligence",
"create_time": "2024-01-15T10:30:00",
"update_time": null
}
],
"total": 150,
"page": 1,
"size": 10,
"pages": 15
}
}Edit Term Entry
Edit a single term entry.
Request
POST /api/open_api/v1/term-entries/edit
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | int | Yes | Entry ID |
| source_text | string | No | New source term, max 1000 characters |
| target_text | string | No | New target term, max 1000 characters |
Request Example
{
"id": 1,
"source_text": "New Source Term",
"target_text": "New Target Term"
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Entry ID |
| source_text | string | Source term |
| target_text | string | Target term |
| update_time | datetime | Update time |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"source_text": "New Source Term",
"target_text": "New Target Term",
"update_time": "2024-01-16T10:00:00"
}
}Delete Term Entries
Delete one or more term entries.
Request
POST /api/open_api/v1/term-entries/delete
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ids | int[] | Yes | List of entry IDs |
Request Example
{
"ids": [1, 2, 3]
}Response Data
| Field | Type | Description |
|---|---|---|
| deleted | int | Number of deleted entries |
| ids | int[] | List of deleted entry IDs |
Response Example
{
"code": 0,
"message": "success",
"data": {
"deleted": 3,
"ids": [1, 2, 3]
}
}Memory Library APIs
Create Memory Library
Create a new memory library.
Request
POST /api/open_api/v1/memory-libs/create
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Memory library name, max 255 characters |
| source_language | string | Yes | Source language code (LanguageEnum value) |
| target_language | string | Yes | Target language code (LanguageEnum value) |
| description | string | No | Description, max 500 characters |
Request Example
{
"name": "Technical Documentation TM",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "Technical documentation translation memory"
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Memory library ID |
| name | string | Memory library name |
| source_language | string | Source language code |
| target_language | string | Target language code |
| description | string | Description |
| entry_count | int | Number of entries |
| create_time | datetime | Creation time |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"name": "Technical Documentation TM",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "Technical documentation translation memory",
"entry_count": 0,
"create_time": "2024-01-15T10:30:00"
}
}List Memory Libraries
Get paginated list of memory libraries.
Request
POST /api/open_api/v1/memory-libs/list
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | int | No | Page number, default 1, minimum 1 |
| size | int | No | Page size, default 10, range 1-100 |
| keyword | string | No | Keyword search, max 100 characters |
| source_language | string | No | Source language filter (LanguageEnum value) |
| target_language | string | No | Target language filter (LanguageEnum value) |
Request Example
{
"page": 1,
"size": 10,
"keyword": "technical",
"source_language": "zh-CN",
"target_language": "en-US"
}Response Data
| Field | Type | Description |
|---|---|---|
| items | array | Memory library list |
| items[].id | int | Memory library ID |
| items[].name | string | Memory library name |
| items[].source_language | string | Source language code |
| items[].target_language | string | Target language code |
| items[].description | string | Description |
| items[].entry_count | int | Number of entries |
| items[].create_time | datetime | Creation time |
| items[].update_time | datetime | Update time |
| total | int | Total count |
| page | int | Current page |
| size | int | Page size |
| pages | int | Total pages |
Response Example
{
"code": 0,
"message": "success",
"data": {
"items": [
{
"id": 1,
"name": "Technical Documentation TM",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "Technical documentation translation memory",
"entry_count": 500,
"create_time": "2024-01-15T10:30:00",
"update_time": "2024-01-16T08:00:00"
}
],
"total": 3,
"page": 1,
"size": 10,
"pages": 1
}
}Edit Memory Library
Edit memory library information.
Request
POST /api/open_api/v1/memory-libs/edit
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | int | Yes | Memory library ID |
| name | string | No | New name, max 255 characters |
| description | string | No | New description, max 500 characters |
Request Example
{
"id": 1,
"name": "New Memory Library Name",
"description": "Updated description"
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Memory library ID |
| name | string | Memory library name |
| source_language | string | Source language code |
| target_language | string | Target language code |
| description | string | Description |
| entry_count | int | Number of entries |
| update_time | datetime | Update time |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"name": "New Memory Library Name",
"source_language": "zh-CN",
"target_language": "en-US",
"description": "Updated description",
"entry_count": 500,
"update_time": "2024-01-16T10:00:00"
}
}Delete Memory Library
Delete a memory library and all its entries.
Request
POST /api/open_api/v1/memory-libs/delete
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | int | Yes | Memory library ID |
Request Example
{
"id": 1
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Memory library ID |
| deleted | boolean | Whether deletion was successful |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"deleted": true
}
}Add Memory Entries
Add one or more entries to a memory library.
Request
POST /api/open_api/v1/memory-entries/add
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| memory_lib_id | int | Yes | Memory library ID |
| entries | object[] | Yes | Entry list |
| entries[].source_text | string | Yes | Source text, max 5000 characters |
| entries[].target_text | string | Yes | Target text, max 5000 characters |
Request Example
{
"memory_lib_id": 1,
"entries": [
{
"source_text": "This is an example sentence.",
"target_text": "这是一个示例句子。"
},
{
"source_text": "Machine translation technology is developing rapidly.",
"target_text": "机器翻译技术正在快速发展。"
}
]
}Response Data
None (data is null)
Response Example
{
"code": 0,
"message": "success",
"data": null
}List Memory Entries
Get entries from a memory library.
Request
POST /api/open_api/v1/memory-entries/list
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| memory_lib_id | int | Yes | Memory library ID |
| page | int | No | Page number, default 1, minimum 1 |
| size | int | No | Page size, default 10, range 1-100 |
| keyword | string | No | Keyword search, max 100 characters |
Request Example
{
"memory_lib_id": 1,
"page": 1,
"size": 10,
"keyword": "example"
}Response Data
| Field | Type | Description |
|---|---|---|
| items | array | Entry list |
| items[].id | int | Entry ID |
| items[].source_text | string | Source text |
| items[].target_text | string | Target text |
| items[].create_time | datetime | Creation time |
| items[].update_time | datetime | Update time |
| total | int | Total count |
| page | int | Current page |
| size | int | Page size |
| pages | int | Total pages |
Response Example
{
"code": 0,
"message": "success",
"data": {
"items": [
{
"id": 1,
"source_text": "This is an example sentence.",
"target_text": "这是一个示例句子。",
"create_time": "2024-01-15T10:30:00",
"update_time": null
}
],
"total": 500,
"page": 1,
"size": 10,
"pages": 50
}
}Edit Memory Entry
Edit a single memory entry.
Request
POST /api/open_api/v1/memory-entries/edit
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | int | Yes | Entry ID |
| source_text | string | No | New source text, max 5000 characters |
| target_text | string | No | New target text, max 5000 characters |
Request Example
{
"id": 1,
"source_text": "New source text.",
"target_text": "New target text."
}Response Data
| Field | Type | Description |
|---|---|---|
| id | int | Entry ID |
| source_text | string | Source text |
| target_text | string | Target text |
| update_time | datetime | Update time |
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"source_text": "New source text.",
"target_text": "New target text.",
"update_time": "2024-01-16T10:00:00"
}
}Delete Memory Entries
Delete one or more memory entries.
Request
POST /api/open_api/v1/memory-entries/delete
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ids | int[] | Yes | List of entry IDs |
Request Example
{
"ids": [1, 2, 3]
}Response Data
| Field | Type | Description |
|---|---|---|
| deleted | int | Number of deleted entries |
| ids | int[] | List of deleted entry IDs |
Response Example
{
"code": 0,
"message": "success",
"data": {
"deleted": 3,
"ids": [1, 2, 3]
}
}Error Codes
Authentication Related (910xx)
| Error Code | Description |
|---|---|
| 91000 | API Key is required |
| 91001 | Invalid API Key |
| 91002 | API Key has expired |
| 91003 | API Key is disabled |
| 91004 | API Key is not yet effective |
| 91005 | Customer not found |
| 91006 | Rate limit exceeded |
File Translation Related (911xx)
| Error Code | Description |
|---|---|
| 91100 | File size exceeds the limit |
| 91101 | File type not supported |
| 91102 | File upload failed |
| 91103 | File not found |
| 91104 | File status does not allow this operation |
| 91105 | Insufficient account balance |
| 91106 | Refund failed, balance record not found |
| 91107 | Task not found |
| 91108 | Task not completed, cannot download |
| 91109 | Translated file not found |
| 91110 | Failed to get download URL |
| 91111 | File is being translated, cannot operate |
Term Library Related (912xx)
| Error Code | Description |
|---|---|
| 91200 | Term library name already exists |
| 91201 | Term library not found |
| 91202 | Source term already exists |
| 91203 | Term entry not found |
| 91204 | Entry list cannot be empty |
Memory Library Related (913xx)
| Error Code | Description |
|---|---|
| 91300 | Memory library name already exists |
| 91301 | Memory library not found |
| 91302 | Memory entry not found |
| 91303 | Entry list cannot be empty |
Language Code Reference
The following are common language codes (for the complete list, call the /api/open_api/v1/languages API):
| Code | Language |
|---|---|
| zh-CN | Chinese (Simplified) |
| zh-TW | Chinese (Traditional) |
| en-US | English |
| ja | Japanese |
| ko | Korean |
| de | German |
| fr | French |
| es | Spanish |
| pt | Portuguese |
| ru | Russian |
| ar | Arabic |
| th | Thai |
| vi | Vietnamese |
| id | Indonesian |
| ms | Malay |
Usage Examples
Python Example
import requests
BASE_URL = "https://api.example.com/api/open_api/v1"
API_KEY = "your_api_key"
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
# 1. Upload file
with open("document.docx", "rb") as f:
files = {"file": f}
data = {"is_can_edit": "true"}
response = requests.post(
f"{BASE_URL}/files/upload",
files=files,
data=data,
headers={"X-API-Key": API_KEY}
)
file_id = response.json()["data"]["file_id"]
# 2. Submit translation
response = requests.post(
f"{BASE_URL}/translate/submit",
json={
"file_id": int(file_id),
"source_language": "zh-CN",
"target_language": "en-US",
"trans_mode": "deep"
},
headers=headers
)
# 3. Query status
response = requests.post(
f"{BASE_URL}/files/status",
json={"file_ids": [file_id]},
headers=headers
)
status = response.json()["data"]["files"][0]["status"]
# 4. Get download URL (after translation is complete)
response = requests.post(
f"{BASE_URL}/translate/download",
json={"file_id": file_id},
headers=headers
)
download_url = response.json()["data"]["download_url"]cURL Example
# Get supported languages
curl -X GET "https://api.example.com/api/open_api/v1/languages" \
-H "X-API-Key: your_api_key"
# Upload file
curl -X POST "https://api.example.com/api/open_api/v1/files/upload" \
-H "X-API-Key: your_api_key" \
-F "file=@document.docx" \
-F "is_can_edit=true"
# Submit translation
curl -X POST "https://api.example.com/api/open_api/v1/translate/submit" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"file_id": 12345678901234567, "source_language": "zh-CN", "target_language": "en-US", "trans_mode": "deep"}'
# Query status
curl -X POST "https://api.example.com/api/open_api/v1/files/status" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"file_ids": ["12345678901234567"]}'
# Create term library
curl -X POST "https://api.example.com/api/open_api/v1/term-libs/create" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Technical Terms", "source_language": "zh-CN", "target_language": "en-US"}'
# Add term entries
curl -X POST "https://api.example.com/api/open_api/v1/term-entries/add" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"term_lib_id": 1, "entries": [{"source_text": "人工智能", "target_text": "AI"}]}'