API Examples
Route
/api/v2/api/translate/uploads
R2 target
/api/v2/api/translate
Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
Idempotency-Key | Yes | HTTP header | Prepare request header: stable key used to safely retry the same file manifest for 8 hours |
platform | No | string | null | Prepare and final requests: optional self-reported platform label used only for API call auditing |
files[] | Yes | array<object> | Prepare request: file metadata containing filename, content_type, size, and content_sha256 |
upload_id | Yes | string | Final request: opaque upload batch ID returned by prepare |
files[].index | Yes | integer string | Final request: per-file index and opaque upload_intent returned by prepare; send only after each R2 upload finishes |
source_language | No | string | Optional; required when model is manga (e.g., ja) |
target_language | Yes | string | Target language code (e.g., en) |
model | No | string | Model; omit to use the API default |
font | No | string | Font; legacy font_style is also accepted |
Response Params
| Field | Type | Description |
|---|---|---|
status | integer | Application status code; 200 on success |
cost_ms | integer | Time spent handling this API request in milliseconds |
request_id | string | Request identifier for tracing this API call |
data | object | Translation task identifiers returned after the request is accepted |
message | string | Always success for a successful API response; it does not mean the translation task has completed |
data.task_id | string | Task identifier |
data.batch_id | string | Batch identifier used to query task status |
Sample Response (JSON)
{
"status": 200,
"cost_ms": 125,
"request_id": "4b7370383cacccc7",
"data": {
"task_id": "00000000-0000-4000-8000-000000000001",
"batch_id": "00000000-0000-4000-8000-000000000001"
},
"message": "success"
}
Error Response Params
On V2 failures, the HTTP status is preserved and the same five-field envelope is returned.
| Field | Type | Description |
|---|---|---|
status | integer | Actual HTTP error status code |
cost_ms | integer | Time spent handling this API request in milliseconds |
request_id | string | Request identifier for tracing this API call |
data | object | Error-data container containing only the stable machine-readable code |
message | string | Public error message; internal diagnostic details are not exposed |
data.code | string | Stable machine-readable error code |
Error Response Example (JSON)
{
"status": 400,
"cost_ms": 1,
"request_id": "4b7370383cacccc7",
"data": {
"code": "PZ_API_ACCESS_BAD_REQUEST"
},
"message": "Invalid target language"
}
Example Inputs
Python3 Example
cURL Examples