Upscale photos or illustrations by 2x, 4x, 8x, or 16x, with a choice of model style and noise reduction strength.
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 a lossless upscaling task
/api/tasks/visual/advanced-scale Body Parameters
image_url string optional Image download URL. Provide at least one of image_url or image_file; image_file takes precedence when both are supplied. Supports HTTP and OSS, up to 512 characters, with a 20-second download timeout.
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. The image received by the server must not exceed 50MB, including 50MB.
For image upload requirements, see Guidelines and Limits #6.
scale_factor string optional Upscaling factor. Send the option value, not the actual scale factor.
1:2x (default)2:4x3:8x4:16x
style string optional Choose a model style.
photo:Photograph (default)art:Cartoon or illustration
noise string optional Noise reduction strength.
-1:None (default)0:Low1:Medium2:High3:Highest
output_format string optional Output image format. Accepts jpg, png, or an empty value.
Return Parameters
status integer HTTP response status code: 200 means the request succeeded; non-200 means it failed. See Status Code Definitions.
message string Response message. If processing fails, refer to this field or contact sales or technical support with the error message and task_id.
data.task_id string Lossless upscaling task ID. Use it to query the result and include it when contacting support about a failed task.
Query lossless upscaling result
For asynchronous requests, poll the result once every 1 second. The maximum polling duration for this API is 600 seconds; if the total polling time exceeds this without a result, treat it as a timeout failure.
/api/tasks/visual/advanced-scale/{task_id} Path Parameters
task_id string required Task ID returned when the lossless upscaling task was created.
Return Parameters
status integer HTTP response status code: 200 means the request succeeded; non-200 means it failed. See Status Code Definitions.
message string Response message. If processing fails, refer to this field or contact sales or technical support with the error message and task_id.
data.task_id string Lossless upscaling task ID. Use it to query the result and include it when contacting support about a failed task.
data.image string Upscaled result image URL or base64 data. Result URLs are generally valid for 1 hour.
data.created_at integer Timestamp of task creation.
data.processed_at integer Timestamp when the task started processing.
data.completed_at integer Timestamp of task completion.
data.progress integer Task progress from 0 to 100. 100 indicates completion; less than 100 indicates processing. Check data.state to determine success or failure.
data.state integer Task status code. See Status Code Definitions.
1: Succeeded;> 1: Processing;< 0: Failed.
data.state_detail string Detailed task status.
data.time_elapsed string Elapsed processing time.
data.return_type integer Result return method.
data.cost number Cost value returned by the API.
data.use_point integer Credits consumed by this task. Each successful call consumes 3 credits.
Guidelines and Limits
-
Result image URLs are generally valid for 1 hour. Please download and store them promptly.
-
HTTP status 200 only means the HTTP request succeeded. data.state = 1 means upscaling succeeded; data.state < 0 means it failed. Stop polling on either success or failure.
-
Follow URL encoding standards when passing URLs to prevent parameter parsing issues.
-
Processing usually takes 1–2 minutes, depending on image size, and never exceeds 10 minutes.
-
The default QPS limit is 2. Contact sales for a higher limit. Each successful call consumes 3 credits.
-
Uploaded images must meet the following format and file size limits.
Format File size jpg, jpeg, bmp, png, webp Up to 50MB (inclusive)
# Lossless Upscaling
Upscale photos or illustrations by 2x, 4x, 8x, or 16x, with a choice of model style and noise reduction strength.
> Result image URLs are generally valid for 1 hour. Please download and store them promptly.
## Base URL
https://techhk.aoscdn.com
## Authentication
Every request must include the X-API-KEY request header.
```http
X-API-KEY: YOUR_API_KEY
```
[Get or manage your API key](https://picwish.com/my-account?subRoute=api-key)
## Request modes
Asynchronous only: create a task, read data.task_id, then poll the query endpoint.
## Source image
Image download URL. Provide at least one of image_url or image_file; image_file takes precedence when both are supplied. Supports HTTP and OSS, up to 512 characters, with a 20-second download timeout.
Source image file as binary data. Provide at least one of image_file or image_url; image_file takes precedence when both are supplied. The image received by the server must not exceed 50MB, including 50MB.
## Endpoints
| Purpose | Method | Path |
| --- | --- | --- |
| Create a lossless upscaling task | POST | /api/tasks/visual/advanced-scale |
| Query lossless upscaling result | GET | /api/tasks/visual/advanced-scale/{task_id} |
## Create a lossless upscaling task
`POST /api/tasks/visual/advanced-scale`
Content-Type: `multipart/form-data`
### Body Parameters
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| image_url | string | one required | Image download URL. Provide at least one of image_url or image_file; image_file takes precedence when both are supplied. Supports HTTP and OSS, up to 512 characters, with a 20-second download timeout. |
| image_file | file | one required | Source image file as binary data. Provide at least one of image_file or image_url; image_file takes precedence when both are supplied. The image received by the server must not exceed 50MB, including 50MB. |
| scale_factor | string | optional | Scale option: 1 = 2x (default); 2 = 4x; 3 = 8x; 4 = 16x. Send the option value, not the actual scale factor. |
| style | string | optional | Model style: photo = photograph (default); art = cartoon or illustration. |
| noise | string | optional | Noise reduction strength: -1 = none (default); 0 = low; 1 = medium; 2 = high; 3 = highest. |
| output_format | string | optional | Output image format. Accepts jpg, png, or an empty value. |
### Return Parameters
| Name | Type | Description |
| --- | --- | --- |
| status | integer | HTTP response status code. 200 means the request succeeded; non-200 means it failed. |
| message | string | Response message. If processing fails, refer to this field or contact sales or technical support with the error message and task_id. |
| data.task_id | string | Lossless upscaling task ID. Use it to query the result and include it when contacting support about a failed task. |
### cURL
Using an image URL:
```bash
curl 'https://techhk.aoscdn.com/api/tasks/visual/advanced-scale' \
-H 'X-API-KEY: YOUR_API_KEY' \
-F 'image_url=YOUR_IMAGE_URL' \
-F 'style=photo' \
-F 'noise=-1' \
-F 'scale_factor=1' \
-F 'output_format=png'
```
Uploading an image file:
```bash
curl 'https://techhk.aoscdn.com/api/tasks/visual/advanced-scale' \
-H 'X-API-KEY: YOUR_API_KEY' \
-F 'image_file=@/path/to/image.jpg' \
-F 'style=photo' \
-F 'noise=-1' \
-F 'scale_factor=1' \
-F 'output_format=png'
```
Successful create response:
```json
{
"status": 200,
"message": "ok",
"data": {
"task_id": "94806a3f-1173-4afb-9bcc-3ff19c0981f4"
}
}
```
## Query lossless upscaling result
For asynchronous requests, poll the result once every **1 second**. The maximum polling duration for this API is **600 seconds**; if the total polling time exceeds this without a result, treat it as a timeout failure.
`GET /api/tasks/visual/advanced-scale/{task_id}`
### Path Parameters
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| task_id | string | required | Task ID returned when the lossless upscaling task was created. |
### Return Parameters
| Name | Type | Description |
| --- | --- | --- |
| status | integer | HTTP response status code. 200 means the request succeeded; non-200 means it failed. |
| message | string | Response message. If processing fails, refer to this field or contact sales or technical support with the error message and task_id. |
| data.task_id | string | Lossless upscaling task ID. Use it to query the result and include it when contacting support about a failed task. |
| data.image | string | Upscaled result image URL or base64 data. Result URLs are generally valid for 1 hour. |
| data.created_at | integer | Timestamp of task creation. |
| data.processed_at | integer | Timestamp when the task started processing. |
| data.completed_at | integer | Timestamp of task completion. |
| data.progress | integer | Task progress from 0 to 100. 100 indicates completion; less than 100 indicates processing. Check data.state to determine success or failure. |
| data.state | integer | Task status code. 1 = succeeded; > 1 = processing; < 0 = failed. See /states. |
| data.state_detail | string | Detailed task status. |
| data.time_elapsed | string | Elapsed processing time. |
| data.return_type | integer | Result return method. |
| data.cost | number | Cost value returned by the API. |
| data.use_point | integer | Credits consumed by this task. Each successful call consumes 3 credits. |
### cURL
```bash
curl 'https://techhk.aoscdn.com/api/tasks/visual/advanced-scale/{task_id}' \
-H 'X-API-KEY: YOUR_API_KEY'
```
Processing response:
```json
{
"status": 200,
"message": "success",
"data": {
"progress": 21,
"state": 4
}
}
```
Completed response:
```json
{
"status": 200,
"data": {
"task_id": "7b63df59-76cc-4035-9f94-01b720ea5665",
"completed_at": 1789541563,
"cost": 0,
"created_at": 1789541552,
"image": "oss://oss-cn-shenzhen.aliyuncs.com/wxtechdev/pub/tasks/output/visual_external_scale/7b63df59-76cc-4035-9f94-01b720ea5665-image1.png",
"processed_at": 1789541552,
"progress": 100,
"return_type": 2,
"state": 1,
"state_detail": "Complete",
"use_point": 3
}
}
```
Failed task response:
```json
{
"status": 200,
"message": "success",
"data": {
"created_at": 1634884056,
"processed_at": 1634884056,
"progress": 0,
"state": -1,
"task_id": "8576761c-fbe5-48a7-9620-18f9ebb132b3"
}
}
```
Failed request response:
```json
{
"status": 401,
"message": "Invalid API key"
}
```
## Recommended asynchronous flow
1. POST a task with image_url or image_file and read data.task_id.
2. GET the task result every 1 second, for no more than 600 seconds in total.
3. When data.state = 1, read data.image. When data.state < 0, the task failed. Stop polling in either case; continue for other states.
4. Download and store the result promptly; result URLs are generally valid for 1 hour.
## Guidelines and Limits
- Result image URLs are generally valid for 1 hour. Please download and store them promptly.
- HTTP status 200 only means the HTTP request succeeded. data.state = 1 means upscaling succeeded; data.state < 0 means it failed. Stop polling on either success or failure.
- Follow URL encoding standards when passing URLs to prevent parameter parsing issues.
- Processing usually takes 1–2 minutes, depending on image size, and never exceeds 10 minutes.
- The default QPS limit is 2. Contact sales for a higher limit. Each successful call consumes 3 credits.
- Uploaded images must meet the following format and file size limits.
| Format | File size |
| --- | --- |
| jpg, jpeg, bmp, png, webp | Up to 50MB (inclusive) |
## 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 600 seconds. |
| -7 | Invalid image file (e.g. corrupted image or incorrect format). |
| -5 | The image_url image exceeds the size limit (50MB). |
| -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. |