Introduction
Provides RESTful APIs for document translation, supporting automated translation task management, glossary-based terminology consistency, and queries for supported formats, languages, and models, making it easy to build seamless translation workflows and manage user accounts.
Getting started
To get started, you need to apply to become a developer.Apply as a developer
Once approved, you can create multiple API keys and include the appropriate API key in each API request as required.
Quick Access
Base URL
https://otranslator.com/api
Authentication Method
Authorization: [yourSecretKey]
JSON Request
Except for the file upload interface, interfaces default to POST JSON requests with Content-Type as application/json.
File Upload
Creating a document translation task uses multipart/form-data, with the file field passing in the file to be translated.
Generic Error Response
When a request fails, the interface will return JSON, and the error field contains a fixed English error message. It is recommended to prioritize handling errors by HTTP status code branching, with the error field used for display or logging.
{
"error": "Invalid API key."
}Error Status Code Rules
All v1 API error responses maintain the same structure, please handle according to the following HTTP status code rules.
- 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.".
Recommended integration process
1. Create Task
Upload files and create translation tasks, returns taskId.
2. Query Progress
Poll task status until Completed, Terminated, or Cancelled.
3. Get Results
Download translated files, or read source and translation JSON.
4. Manage Tasks
Pay as you go to translate full text, restart tasks, revise text, or delete tasks.