Upscaler
This is one of our best upscaling pipelines, keeping the original composition intact while adding depth and clarity to an image.
- Python
 - JavaScript
 - PHP
 
import requests
import json
url = "https://api.imagepipeline.io/upscaler/v1"
headers = {
    "API-Key": "Your API Key",
    "Content-Type": "application/json"
}
data = {
    "input_image": "https://example.com/image.jpg",
    "direct_link": true,
    "prompt": "Enhance image quality with more details",
    "server_id": "optional-server-id",
    "type": "deblur",
    "webhook": "https://example.com/webhook",
    "batch_id": "batch-123",
    "file_prefix": "enhanced_",
    "queued_image_urls": true
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const url = "https://api.imagepipeline.io/upscaler/v1";
const headers = {
    "API-Key": "Your API Key",
    "Content-Type": "application/json"
};
const data = {
    "input_image": "https://example.com/image.jpg",
    "direct_link": true,
    "prompt": "Enhance image quality with more details",
    "server_id": "optional-server-id",
    "type": "deblur",
    "webhook": "https://example.com/webhook",
    "batch_id": "batch-123",
    "file_prefix": "enhanced_",
    "queued_image_urls": true
};
fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$url = "https://api.imagepipeline.io/upscaler/v1";
$headers = array(
    "API-Key: Your API Key",
    "Content-Type: application/json"
);
$data = array(
    "input_image" => "https://example.com/image.jpg",
    "direct_link" => true,
    "prompt" => "Enhance image quality with more details",
    "server_id" => "optional-server-id",
    "type" => "deblur",
    "webhook" => "https://example.com/webhook",
    "batch_id" => "batch-123",
    "file_prefix" => "enhanced_",
    "queued_image_urls" => true
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if($response === FALSE){
    die(curl_error($ch));
}
$responseData = json_decode($response, TRUE);
curl_close($ch);
var_dump($responseData);
?>
JSON Parameters
| Parameter | Type | Notes | 
|---|---|---|
input_image | string | required. Public URL for the initial image. | 
direct_link | boolean | Optional. Fetches the friendly URL in PNG format. | 
prompt | string | required. Description of the enhancement or changes you want to apply to the image. | 
server_id | string | Optional. Provide a server ID to use an enterprise subscription or for load-balancing. | 
type | string | Optional. Choose between deblur and variation. Default is deblur. | 
webhook | string | URL where the generated image will be sent. | 
batch_id | string | Adds a batch ID for the image generation request. | 
file_prefix | string | Adds a prefix to the generated files. | 
queued_image_urls | boolean | Returns the links of the images prematurely. The link will have the image once the task is run successfully. | 
Status
Your response will include a status.
- If the 
status=SUCCESS, you will also havedownload_urlsthat will have the links to your generated image based on the number of samples you have entered. The maximum number of samples that can be generated is 2. - If the 
status=PENDING, you will receive anid. You can use the status endpoint to fetch your image using theid. - If the 
status=FAILURE, you will receive only an error message. 
Endpoint: [GET]
https://api.imagepipeline.io/upscaler/v1/status/{{id}}
Pass the API-Key as the authorization in the header.