文檔目錄

介紹

提供RESTful APIs進行文件翻譯,支援自動化翻譯任務管理、基於詞彙表的術語一致性,以及查詢支援的格式、語言和模型,讓您輕鬆建立無縫的翻譯工作流程並管理使用者帳戶。

開始使用

開始使用前,您需要申請成為開發人員。申請成為開發者

一旦獲得批准,您可以建立多個API金鑰,並根據需要在每個API請求中包含適當的API金鑰。

快速接入

Base URL

https://otranslator.com/api

認證方式

Authorization: [yourSecretKey]

JSON 請求

除文件上傳接口外,接口默認使用 POST JSON 請求,Content-Type 為 application/json。

檔案上傳

建立文件翻譯任務使用 multipart/form-data,file 欄位傳入待翻譯檔案。

通用錯誤響應

請求失敗時介面會返回 JSON,error 欄位包含固定英文錯誤訊息。建議優先按 HTTP status code 分支處理錯誤,error 欄位用於展示或日誌記錄。

{
  "error": "Invalid API key."
}

錯誤狀態碼規則

所有 v1 API 錯誤響應保持相同結構,請按下列 HTTP status code 規則處理。

400 Bad Request
Missing required parameters, invalid parameter formats or enum values, missing file upload, upload save failure, or task processing failure.
401 Unauthorized
Missing API key or invalid API key.
402 Payment Required
Insufficient credits balance for preview, full translation, or text translation.
404 Not Found
The task or glossary does not exist, has been deleted, does not belong to the current API account, or was not created through the API.
409 Conflict
The current task status does not allow the requested operation.
500 Internal Server Error
Unexpected server exception. The response error is fixed as "Internal server error.".

推薦接入流程

資源

翻譯任務 API
建立翻譯任務