Old Photo Restoration API

Try on PicWish

AI restores and enhances old photos by repairing damage, improving clarity, and optionally colorizing the result. It works for old photo renewal, family album repair, and archive photo enhancement, 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 old photo restoration task

POST /api/tasks/visual/restoration-old-photo

Body Parameters

image_url string optional

Image download 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.

one required
image_file file optional

Image file as binary data. Supported formats: JPG, JPEG, PNG. If both image_file and image_url are sent, image_file takes priority. The input image received by the server must be less than 20MB and up to 2048 x 2048.

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

sync integer optional

Whether to return the result synchronously. 1 returns the result directly in this response; 0 returns task_id first, then you can poll the result endpoint. We recommend keeping async polling within 180 seconds and polling once every 1 second.

restoration_type integer optional

Damage level. 0 = light (default); 1 = medium; 2 = severe.

model_type integer optional

Model type. Optional and only takes effect when restoration_type > 0. 1 = realistic restoration; 2 = smart enhancement; 3 = Ultra HD restoration.

change_color integer optional

Whether to change color. 0 = do not change; 1 = change color (default).

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 the task fails, refer to this field or contact support.

data.task_id string

Old photo restoration 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 the task fails, refer to this field or contact support.

data.task_id string

Old photo restoration task ID.

data.created_at string

Task creation timestamp.

data.processed_at string

Timestamp when processing started.

data.completed_at string

Task completion timestamp.

data.image string

Result image URL or Base64 data.

data.image_url string

Result image URL. Some examples use this field name.

data.return_type number

Result return type.

data.progress number

Task progress percentage, ranging from 0 to 100.

data.state number

Task status code. 1 means completed, 0 or greater than 1 means processing, and less than 0 means failed. See Status Code Definitions.

data.state_detail string

Detailed task state.

data.download_time number

Download time.

data.time_elapsed string

Total processing time.

Query old photo restoration result

GET /api/tasks/visual/restoration-old-photo/{task_id}

Path Parameters

task_id string required

Task ID returned after creating the task with sync=0. 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 the task fails, refer to this field or contact support.

data.task_id string

Old photo restoration task ID. If the task fails, contact support with this task_id.

data.created_at string

Task creation timestamp.

data.processed_at string

Timestamp when processing started.

data.completed_at string

Task completion timestamp.

data.image string

Result image URL or Base64 data.

data.image_url string

Result image URL. Some examples use this field name.

data.return_type number

Result return type.

data.progress number

Task progress percentage, ranging from 0 to 100.

data.state number

Task status code. 1 means completed, 0 or greater than 1 means processing, and less than 0 means failed. See Status Code Definitions.

data.state_detail string

Detailed task state.

data.download_time number

Download time.

data.time_elapsed string

Total processing time.

Guidelines and Limits

  1. The result image URL is valid for 1 hour. Please download and store it promptly.

  2. HTTP status 200 means the HTTP request succeeded, not that old photo restoration succeeded. Check data.state for the task result. See Status Code Definitions.

  3. When passing URLs as parameters, follow URL encoding standards to prevent parameter parsing issues.

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

    FormatResolutionSize
    jpg, jpeg, pngUp to 2048 x 2048Less than 20MB