AI enhances image clarity with a higher-quality model for sharper details and improved resolution. It works for product photos, portraits, and design assets, with async and sync request modes.
The result image URL is valid for 1 hour. Please download and store it 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 advanced image enhancer task
/api/tasks/visual/scale-pro Body Parameters
image_url string optional Source image URL. Supports HTTP and OSS URLs, up to 512 characters, with a 10-second download timeout. If both image_url and image_file are sent, image_file takes priority.
image_file file optional Source image file as binary data. Supported formats: jpg, jpeg, bmp, png, webp, tiff, bitmap. If both image_file and image_url are sent, image_file takes priority. Maximum file size is 30MB and maximum resolution is 4096 x 4096.
For image upload requirements, see Guidelines and Limits #5.
sync integer optional Whether to return synchronously. 0 = async; 1 = sync.
type integer optional Model type. 0 = Ultra HD and consumes 5 credits; 1 = HD and consumes 4 credits. Default is 0.
return_type integer optional Result return type. 1 returns an image download URL; 2 returns a base64 string. Default is 1.
Return Parameters
status number HTTP response status code. 200 means success, and non-200 means failure. See Status Code Definitions.
message string Response message. If processing fails, use this message to locate the issue.
data.task_id string Advanced image enhancer task ID used for polling.
status number HTTP response status code. 200 means success, and non-200 means failure. See Status Code Definitions.
message string Response message. If processing fails, use this message to locate the issue.
data.task_id string Advanced image enhancer task ID.
data.created_at number Task creation timestamp.
data.processed_at number Task processing start timestamp.
data.completed_at number Task completion timestamp.
data.image string Result image download URL or base64 data. The URL is valid for 1 hour.
data.return_type number Result return type.
data.type number Model type used for this request.
data.progress number Task progress from 0 to 100.
data.state number Task status code. 1 means succeeded, greater than 1 means processing, and less than 0 means failed. See Status Code Definitions.
data.image_width number Output image width.
data.image_height number Output image height.
data.image_size_kb number Output image size in KB.
data.out_format string Output image format.
data.state_detail string Detailed state message.
data.download_time number Download time.
data.time_elapsed number Elapsed processing time.
Query advanced image enhancer result
/api/tasks/visual/scale-pro/{task_id} Path Parameters
task_id string required The task_id returned by the task creation request. Use it to query the processing result.
Return Parameters
status number HTTP response status code. 200 means success, and non-200 means failure. See Status Code Definitions.
message string Response message. If processing fails, use this message to locate the issue.
data.task_id string Advanced image enhancer task ID. If the task fails, contact support with this task_id.
data.created_at number Task creation timestamp.
data.processed_at number Task processing start timestamp.
data.completed_at number Task completion timestamp.
data.image string Result image download URL or base64 data. The URL is valid for 1 hour.
data.return_type number Result return type.
data.type number Model type used for this request.
data.progress number Task progress from 0 to 100.
data.state number Task status code. 1 means succeeded, greater than 1 means processing, and less than 0 means failed. See Status Code Definitions.
data.image_width number Output image width.
data.image_height number Output image height.
data.image_size_kb number Output image size in KB.
data.out_format string Output image format.
data.state_detail string Detailed state message.
data.download_time number Download time.
data.time_elapsed number Elapsed processing time.
Guidelines and Limits
-
The result image URL is valid for 1 hour. Please download and store it promptly.
-
HTTP status 200 means the HTTP request succeeded, not that advanced enhancement succeeded. Check data.state for the task result. See Status Code Definitions.
-
When passing URLs as parameters, follow URL encoding standards to prevent parameter parsing issues.
-
type=0 consumes 5 credits; type=1 consumes 4 credits.
-
Uploaded images must meet the following format, resolution, and file size limits.
Format Resolution Size jpg, jpeg, bmp, png, webp, tiff, bitmap Up to 4096 x 4096 Up to 30MB
# Advanced Image Enhancer API
AI enhances image clarity with a higher-quality model for sharper details and improved resolution. It works for product photos, portraits, and design assets, with asynchronous and synchronous request modes.
> Note: The result image URL is valid for 1 hour. Please download and store it promptly.
## Base URL
All paths below are relative to the Base URL:
```
https://techhk.aoscdn.com
```
## Authentication
Every request must include your API key in the `X-API-KEY` request header:
```http
X-API-KEY: YOUR_API_KEY
```
Get or manage your API key from [API Key](https://picwish.com/my-account?subRoute=api-key).
Requests without a valid key are rejected.
## Choosing a request mode (sync vs async)
The mode is controlled by the `sync` body parameter on the create request:
- Asynchronous (`sync=0`, recommended): the create request returns immediately with `data.task_id`. Poll the query endpoint with that task ID until processing finishes.
- Synchronous (`sync=1`): the create request waits for processing to finish and returns the result directly in the same response.
In both modes, result URLs are generally valid for 1 hour.
## Providing the source image (image_url vs image_file)
`image_file` and `image_url` are one-of-two required. If both are provided, `image_file` takes priority over `image_url`:
- `image_url` - source image URL. HTTP and OSS URLs are supported, up to 512 characters, with a 10-second download timeout.
- `image_file` - source image file uploaded as `multipart/form-data` binary data.
## Endpoints
| Purpose | Method | Path |
| --- | --- | --- |
| Create an advanced image enhancer task | POST | /api/tasks/visual/scale-pro |
| Query a task result (async) | GET | /api/tasks/visual/scale-pro/{task_id} |
## Create an advanced image enhancer task
`POST /api/tasks/visual/scale-pro`
Content-Type: `multipart/form-data`
### Body parameters
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| image_url | string | one of image_url / image_file | Source image URL. Supports HTTP and OSS URLs, up to 512 characters, with a 10-second download timeout. If both image_url and image_file are sent, image_file takes priority. |
| image_file | file | one of image_url / image_file | Source image file. Supported formats: jpg, jpeg, bmp, png, webp, tiff, bitmap. If both image_file and image_url are sent, image_file takes priority. Maximum file size is 30MB and maximum resolution is 4096 x 4096. |
| sync | integer | optional | 0 = asynchronous; 1 = synchronous. |
| type | integer | optional | Model type. 0 = Ultra HD, consumes 5 credits; 1 = HD, consumes 4 credits. Default is 0. |
| return_type | integer | optional | 1 = return image download URL; 2 = return base64 string. Default is 1. |
### Return parameters - asynchronous (sync=0)
| Name | Type | Description |
| --- | --- | --- |
| status | number | HTTP response status code. 200 means the request succeeded, and non-200 means failure. See /states. |
| message | string | Response message. If processing fails, use this message to locate the issue. |
| data.task_id | string | Task ID used for polling. |
### Return parameters - synchronous (sync=1)
| Name | Type | Description |
| --- | --- | --- |
| status | number | HTTP response status code. 200 means the request succeeded, and non-200 means failure. See /states. |
| message | string | Response message. If processing fails, use this message to locate the issue. |
| data.task_id | string | Task ID. |
| data.created_at | number | Task creation timestamp. |
| data.processed_at | number | Task processing start timestamp. |
| data.completed_at | number | Task completion timestamp. |
| data.image | string | Result image download URL or base64 data. URL results are valid for 1 hour. |
| data.return_type | number | Result return type. |
| data.type | number | Model type used for this request. |
| data.progress | number | Task progress from 0 to 100. |
| data.state | number | 1 = succeeded; > 1 = still processing; < 0 = failed. See /states. |
| data.image_width | number | Output image width. |
| data.image_height | number | Output image height. |
| data.image_size_kb | number | Output image size in KB. |
| data.out_format | string | Output image format. |
| data.state_detail | string | Detailed state message. |
| data.download_time | number | Download time. |
| data.time_elapsed | number | Elapsed processing time. |
### Examples
Asynchronous, image URL:
```bash
curl -k 'https://techhk.aoscdn.com/api/tasks/visual/scale-pro' \
-H 'X-API-KEY: YOUR_API_KEY' \
-F 'sync=0' \
-F 'image_url=YOUR_IMAGE_URL'
```
Asynchronous, image file upload:
```bash
curl -k 'https://techhk.aoscdn.com/api/tasks/visual/scale-pro' \
-H 'X-API-KEY: YOUR_API_KEY' \
-F 'sync=0' \
-F 'image_file=@/path/to/image.jpg'
```
Synchronous (result returned directly):
```bash
curl -k 'https://techhk.aoscdn.com/api/tasks/visual/scale-pro' \
-H 'X-API-KEY: YOUR_API_KEY' \
-F 'sync=1' \
-F 'image_url=YOUR_IMAGE_URL'
```
Example async create response:
```json
{
"status": 200,
"message": "success",
"data": { "task_id": "TASK_ID" }
}
```
## Query advanced image enhancer result
`GET /api/tasks/visual/scale-pro/{task_id}`
Use this in asynchronous mode to poll for the result.
### Path parameters
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| task_id | string | required | The task_id returned by the task creation request. |
### Return parameters
| Name | Type | Description |
| --- | --- | --- |
| status | number | HTTP response status code. 200 means the request succeeded, and non-200 means failure. See /states. |
| message | string | Response message. If processing fails, use this message to locate the issue. |
| data.task_id | string | Task ID. |
| data.created_at | number | Task creation timestamp. |
| data.processed_at | number | Task processing start timestamp. |
| data.completed_at | number | Task completion timestamp. |
| data.image | string | Result image download URL or base64 data. URL results are valid for 1 hour. |
| data.return_type | number | Result return type. |
| data.type | number | Model type used for this request. |
| data.progress | number | Task progress from 0 to 100. |
| data.state | number | 1 = succeeded; > 1 = still processing; < 0 = failed. See /states. |
| data.image_width | number | Output image width. |
| data.image_height | number | Output image height. |
| data.image_size_kb | number | Output image size in KB. |
| data.out_format | string | Output image format. |
| data.state_detail | string | Detailed state message. |
| data.download_time | number | Download time. |
| data.time_elapsed | number | Elapsed processing time. |
### Example
```bash
curl -k 'https://techhk.aoscdn.com/api/tasks/visual/scale-pro/{task_id}' \
-H 'X-API-KEY: YOUR_API_KEY'
```
Example completed response:
```json
{
"status": 200,
"message": "success",
"data": {
"task_id": "TASK_ID",
"state": 1,
"progress": 100,
"image": "https://.../result.jpg",
"completed_at": 1776318305
}
}
```
## Recommended asynchronous flow
1. POST to /api/tasks/visual/scale-pro with `sync=0` and one image source (`image_url` or `image_file`). Read `data.task_id`.
2. GET /api/tasks/visual/scale-pro/{task_id} every 1 second. Keep total polling under 180 seconds.
3. Inspect `data.state`: 1 = done (read `data.image`); > 1 = keep polling; < 0 = failed.
4. Download `data.image` within 1 hour.
## Guidelines and Limits
- The URL of the result image is valid for **1 hour**. Please download the image file promptly.
- HTTP status 200 means the HTTP request succeeded, not that advanced enhancement succeeded. Check data.state for the task result. See Status Code Definitions.
- When passing URLs as parameters, follow URL encoding standards to prevent parameter parsing issues.
- type=0 consumes 5 credits; type=1 consumes 4 credits.
- Uploaded images must meet the following format, resolution, and file size limits.
| Format | Resolution | File size |
| --- | --- | --- |
| jpg, jpeg, bmp, png, webp, tiff, bitmap | Up to 4096 x 4096 | Up to 30MB |
## Status codes
Determine success by combining the HTTP response status code (`status`) with the task status code (`data.state`).
### HTTP response status codes
| Code | Meaning |
| --- | --- |
| 200 | The request is successful. |
| 400 | Wrong parameter passed by the client. Check whether a parameter is missing or has an incorrect value. |
| 401 | Unauthorized API key. Check that X-API-KEY is correct and the service is enabled. |
| 404 | The requested URL or resource does not exist. Check that the URL or task_id is correct. |
| 413 | The uploaded file exceeds the allowed size. Refer to the supported image size. |
| 429 | Request frequency exceeds the QPS limit (default QPS is 2). Slow down or contact us to raise your QPS. |
| 500 | Server-side exception. Please contact support. |
### Task status codes (data.state)
1 = succeeded; greater than 1 = still processing; less than 0 = failed.
| Code | Meaning |
| --- | --- |
| -17 | Processing failed because the prompt is invalid. |
| -16 | Processing failed because a third-party review detected prohibited content. |
| -15 | Processing failed due to insufficient resources. |
| -14 | Processing failed because the input image content does not meet the requirements. |
| -13 | Processing failed because the task was canceled due to an exception. |
| -11 | Processing failed because the result is empty. |
| -10 | Processing failed because internal review detected prohibited content. |
| -9 | Processing failed because the internal program failed during loop processing. |
| -8 | Processing timed out. The maximum processing time is 180 seconds. |
| -7 | Invalid image file (e.g. corrupted image or incorrect format). |
| -5 | The image_url image exceeds the size limit (30MB). |
| -3 | The server failed to download your file. Check that the source image URL is available. |
| -2 | Processing completed, but uploading the result to OSS failed. |
| -1 | Processing failed. |
| 0 | Queued. The task is waiting in the queue. |
| 1 | Completed. Processing succeeded. |
| 2 | Preparing. |
| 3 | Waiting. |
| 4 | Processing in progress. |
| 5 | Internally publishing the result. |
| 6 | Processing. Internal loop processing is in progress. |