文档目录

简介

提供用于文档翻译的RESTful API,支持自动化翻译任务管理、基于术语表的术语一致性,以及对支持格式、语言和模型的查询,便于构建无缝翻译工作流程和管理用户账户。

入门指南

要开始使用,您需要申请成为开发者。申请成为开发者

一旦获得批准,您可以创建多个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
创建翻译任务