API Examples

Route

POST PUT POST /api/v2/api/translate/uploads R2 target /api/v2/api/translate

Parameters

Parameter Required Type Description
Idempotency-KeyYesHTTP headerPrepare request header: stable key used to safely retry the same file manifest for 8 hours
platformNostring | nullPrepare and final requests: optional self-reported platform label used only for API call auditing
files[]Yesarray<object>Prepare request: file metadata containing filename, content_type, size, and content_sha256
upload_idYesstringFinal request: opaque upload batch ID returned by prepare
files[].index
files[].upload_intent
Yesinteger
string
Final request: per-file index and opaque upload_intent returned by prepare; send only after each R2 upload finishes
source_languageNostringOptional; required when model is manga (e.g., ja)
target_languageYesstringTarget language code (e.g., en)
modelNostringModel; omit to use the API default
fontNostringFont; legacy font_style is also accepted

Response Params

Field Type Description
statusintegerApplication status code; 200 on success
cost_msintegerTime spent handling this API request in milliseconds
request_idstringRequest identifier for tracing this API call
dataobjectTranslation task identifiers returned after the request is accepted
messagestringAlways success for a successful API response; it does not mean the translation task has completed
data.task_idstringTask identifier
data.batch_idstringBatch 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
statusintegerActual HTTP error status code
cost_msintegerTime spent handling this API request in milliseconds
request_idstringRequest identifier for tracing this API call
dataobjectError-data container containing only the stable machine-readable code
messagestringPublic error message; internal diagnostic details are not exposed
data.codestringStable 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

We use cookies to enhance your browsing experience. Choose your preferences below.

Cookie Preferences

You can customize your cookie preferences below. Essential cookies cannot be disabled as they are necessary for the website to function properly.

These cookies are necessary for the website to function and cannot be switched off.

These cookies enable personalized features and functionality.

These cookies help us understand how visitors interact with our website.

These cookies are used to show you relevant advertisements.

These cookies are set by third-party services on our website.

Chrome is phasing out third-party cookies. Some features may not work properly in future Chrome versions.

Disabling third-party cookies may affect payment processing. If you experience issues during checkout, consider enabling this option.