To determine if the task is successful, a combination of HTTP Response Status Code and Task Status Code (the state field in the HTTP response message) is required.
Return Code Samples
{
"status": 200,
"data": {
"completed_at": 1698387307,
"created_at": 1698387304,
"image": "yourimage",
"processed_at": 1698387303,
"progress": 100,
"return_type": 1,
"state": 1, // Task status code. 1 means succeeded, greater than 1 means processing, and less than 0 means failed.
"state_detail": "Complete",
"task_id": "5f461cfc-ec4b-446b-aa31-57afa8fb5256"
}
}
HTTP Response Status Code
| HTTP Response Status Code | Definitions |
|---|---|
| 200 | The request is successful |
| 400 | Client side passed the wrong parameter. Please check if the parameter is missing or if the value is incorrect. |
| 401 | Unauthorized API Key. Please check if the X-API-KEY is correct and if the service is enabled. |
| 404 | The requested URL or resource does not exist. Please check if the URL or task_id is correct |
| 413 | The uploaded file exceeded the allowed size. Please refer to the supported image size. |
| 429 | The request frequency exceeds the QPS limit (the default QPS is 2). Please slow down the request rate or contact us to increase your QPS. |
| 500 | Server side exception. Please contact the support. |
Task Status Code
The task status code is the state field in the HTTP response message.
| Task Status Code | Definitions |
|---|---|
| -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. For example: corrupted image, incorrect format, etc. |
| -5 | The image_url image exceeds the size limit (30MB). |
| -3 | The server failed to download your file. Please check if the URL of your source image is available. |
| -2 | Restoration completed, but uploading the result to OSS failed. |
| -1 | Restoration failed. |
| 0 | Queued. The restoration task is waiting in the queue. |
| 1 | Completed. Restoration succeeded. |
| 2 | Preparing |
| 3 | Waiting |
| 4 | Processing. Restoration is in progress. |
| 5 | Internally publishing the result. |
| 6 | Processing. Internal loop processing is in progress. |