Image Translation API

Try on PicWish

Intelligently recognize and translate text in images, generating images in your chosen language with support for 26 target languages. Automatically preserve the original fonts, font sizes, text colors, and layout to match the original style as closely as possible.

Result image URLs are generally valid for 1 hour. Please download and store them promptly.

Authentication

Every API request must include your API Key in the X-API-KEY request header. Send it with each request exactly as shown in the examples and parameter descriptions.

X-API-KEY: YOUR_API_KEY

Create an image translation task

POST /api/tasks/visual/image-translator

Body Parameters

image_url string optional

Source image URL. Provide at least one of image_url or image_file; image_file takes precedence when both are supplied.

one required
image_file file optional

Source image file as binary data. Provide at least one of image_file or image_url; image_file takes precedence when both are supplied.

For image upload requirements, see Guidelines and Limits #7.

target_language string required

Target language. Use one of the following language codes:

  • AR: Arabic
  • BG: Bulgarian
  • CSY: Czech
  • DEU: German
  • ENG: English
  • ESP: Spanish
  • FRA: French
  • HUN: Hungarian
  • ID: Indonesian
  • ITA: Italian
  • JPN: Japanese
  • JW: Javanese
  • KOR: Korean
  • MS: Malay
  • MY: Burmese
  • NLD: Dutch
  • PLK: Polish
  • ROM: Romanian
  • RUS: Russian
  • TH: Thai
  • TRK: Turkish
  • VIN: Vietnamese
  • TL: Tagalog (Philippines)
  • PTB: Brazilian Portuguese
  • CHT: Traditional Chinese
  • CHS: Simplified Chinese
aspect_ratio string optional

Output aspect ratio. Omit for automatic sizing. Supported values: 1:1, 2:3, 3:2, 4:3, 3:4, 16:9, 9:16, 9:21.

quality string optional

Output quality. Available values:

  • 1k
  • 1.5k
  • 2k (default)
sync uint optional

Request mode. Available values:

  • 0: Async (default). Read task_id from the create response, then poll for the result.
  • 1: Sync. Wait for translation to complete and return the result directly.

Return Parameters

status integer

Response status. 200 means the request succeeded, not that image translation succeeded. See Status Code Definitions.

message string

Response message. Include the error message and task_id when contacting support about a failed task.

data.task_id string

Task ID used to query the image translation result.

status integer

Response status. 200 means the request succeeded, not that image translation succeeded. See Status Code Definitions.

message string

Response message. Include the error message and task_id when contacting support about a failed task.

data.task_id string

Task ID used to query the image translation result.

data.image_url string

Translated image URL or base64 data. Result URLs are generally valid for 1 hour.

data.state integer

Task status. Stop polling on success or failure. See Status Code Definitions.

  • 0: Queued.
  • 1: Succeeded.
  • 2: Preparing.
  • 3: Waiting.
  • 4: Processing.
  • < 0: Failed.
  • -8: Processing timed out (maximum 180 seconds).
  • -7: Invalid image file.
  • -5: Image exceeds 10MB.
  • -3: The server failed to download the image.
  • -2: Translation completed, but uploading the result failed.
  • -1: Image translation failed.
data.progress integer

Task progress from 0 to 100. Check data.state to determine whether translation succeeded.

data.created_at integer

Timestamp of task creation.

data.processed_at integer

Timestamp when processing started.

data.completed_at integer

Timestamp of task completion.

data.state_detail string

Detailed task status.

data.return_type integer

Result return method.

data.type integer

Result method field returned by the API.

data.time_elapsed number

Elapsed processing time.

Query image translation result

For asynchronous requests, poll the result once every 1 second. The maximum polling duration for this API is 180 seconds; if the total polling time exceeds this without a result, treat it as a timeout failure.

GET /api/tasks/visual/image-translator/{task_id}

Path Parameters

task_id string required

Task ID used to query the image translation result.

Return Parameters

status integer

Response status. 200 means the request succeeded, not that image translation succeeded. See Status Code Definitions.

message string

Response message. Include the error message and task_id when contacting support about a failed task.

data.task_id string

Task ID used to query the image translation result.

data.image_url string

Translated image URL or base64 data. Result URLs are generally valid for 1 hour.

data.state integer

Task status. Stop polling on success or failure. See Status Code Definitions.

  • 0: Queued.
  • 1: Succeeded.
  • 2: Preparing.
  • 3: Waiting.
  • 4: Processing.
  • < 0: Failed.
  • -8: Processing timed out (maximum 180 seconds).
  • -7: Invalid image file.
  • -5: Image exceeds 10MB.
  • -3: The server failed to download the image.
  • -2: Translation completed, but uploading the result failed.
  • -1: Image translation failed.
data.progress integer

Task progress from 0 to 100. Check data.state to determine whether translation succeeded.

data.created_at integer

Timestamp of task creation.

data.processed_at integer

Timestamp when processing started.

data.completed_at integer

Timestamp of task completion.

data.state_detail string

Detailed task status.

data.return_type integer

Result return method.

data.time_elapsed string

Elapsed processing time.

data.cost number

Cost value returned by the API.

data.use_point integer

Credits consumed by this task. Each successful call consumes 5 credits.

Guidelines and Limits

  1. Result image URLs are generally valid for 1 hour. Please download and store them promptly.

  2. HTTP status 200 only means the request succeeded. data.state = 1 means translation succeeded; data.state < 0 means it failed. Stop polling on either success or failure.

  3. Follow URL encoding standards when passing URLs. Preserve all signed URL parameters when downloading results; do not incorrectly escape &.

  4. Image URLs support HTTP and OSS, up to 512 characters, with a 20-second download timeout. File size is measured on the server.

  5. Processing usually takes 1–2 minutes, depending on image size. Poll asynchronous tasks every 1 second for no more than 180 seconds.

  6. The default QPS limit is 2. Contact sales for a higher limit. Each successful call consumes 5 credits.

  7. Uploaded images must meet the following format, resolution, and file size limits.

    FormatFile sizeResolution
    JPEG, JPG, PNG, WebPUp to 10MB≤ 6000 × 6000 px