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, // "state=1" refers to the task succeeds; and "state<0" refers to the task fails
        "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 | 
|---|---|
| -8 | Processing timeout. The processing time is limited to 30 seconds. | 
| -7 | Invalid image file. For example: corrupted image, incorrect format, etc. | 
| -5 | Image exceeds size (Up to 15MB). | 
| -3 | The server failed to download your file. Please check if the URL of your source image is available. | 
| -2 | The task has been completed, but the result image upload OSS fails. | 
| -1 | Task fails | 
| 0 | Too many requests. Your task is in the queue. | 
| 1 | Task succeeds | 
| 2 | Preparing | 
| 3 | Waiting | 
| 4 | Processing |