curl --request POST \
--url https://api.legnext.ai/api/v1/enhance-upscale \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"image_url": "https://example.com/photo.jpg",
"jobId": "1868588555208310784",
"imageNo": 0,
"target_resolution": "4K",
"content_type": "photo",
"aspect_ratio": "keep",
"crop_mode": "letterbox",
"output_format": "jpeg",
"face_enhancement_level": "moderate",
"callback": "https://your-domain.com/webhook"
}
'import requests
url = "https://api.legnext.ai/api/v1/enhance-upscale"
payload = {
"image_url": "https://example.com/photo.jpg",
"jobId": "1868588555208310784",
"imageNo": 0,
"target_resolution": "4K",
"content_type": "photo",
"aspect_ratio": "keep",
"crop_mode": "letterbox",
"output_format": "jpeg",
"face_enhancement_level": "moderate",
"callback": "https://your-domain.com/webhook"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image_url: 'https://example.com/photo.jpg',
jobId: '1868588555208310784',
imageNo: 0,
target_resolution: '4K',
content_type: 'photo',
aspect_ratio: 'keep',
crop_mode: 'letterbox',
output_format: 'jpeg',
face_enhancement_level: 'moderate',
callback: 'https://your-domain.com/webhook'
})
};
fetch('https://api.legnext.ai/api/v1/enhance-upscale', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.legnext.ai/api/v1/enhance-upscale",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_url' => 'https://example.com/photo.jpg',
'jobId' => '1868588555208310784',
'imageNo' => 0,
'target_resolution' => '4K',
'content_type' => 'photo',
'aspect_ratio' => 'keep',
'crop_mode' => 'letterbox',
'output_format' => 'jpeg',
'face_enhancement_level' => 'moderate',
'callback' => 'https://your-domain.com/webhook'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.legnext.ai/api/v1/enhance-upscale"
payload := strings.NewReader("{\n \"image_url\": \"https://example.com/photo.jpg\",\n \"jobId\": \"1868588555208310784\",\n \"imageNo\": 0,\n \"target_resolution\": \"4K\",\n \"content_type\": \"photo\",\n \"aspect_ratio\": \"keep\",\n \"crop_mode\": \"letterbox\",\n \"output_format\": \"jpeg\",\n \"face_enhancement_level\": \"moderate\",\n \"callback\": \"https://your-domain.com/webhook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.legnext.ai/api/v1/enhance-upscale")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"image_url\": \"https://example.com/photo.jpg\",\n \"jobId\": \"1868588555208310784\",\n \"imageNo\": 0,\n \"target_resolution\": \"4K\",\n \"content_type\": \"photo\",\n \"aspect_ratio\": \"keep\",\n \"crop_mode\": \"letterbox\",\n \"output_format\": \"jpeg\",\n \"face_enhancement_level\": \"moderate\",\n \"callback\": \"https://your-domain.com/webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.legnext.ai/api/v1/enhance-upscale")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_url\": \"https://example.com/photo.jpg\",\n \"jobId\": \"1868588555208310784\",\n \"imageNo\": 0,\n \"target_resolution\": \"4K\",\n \"content_type\": \"photo\",\n \"aspect_ratio\": \"keep\",\n \"crop_mode\": \"letterbox\",\n \"output_format\": \"jpeg\",\n \"face_enhancement_level\": \"moderate\",\n \"callback\": \"https://your-domain.com/webhook\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"message": "Invalid request, image_url must start with http:// or https://",
"raw_message": "image_url must start with http:// or https://",
"detail": null
}{
"code": 401,
"message": "Failed to verify api key",
"raw_message": "",
"detail": null
}{
"code": 402,
"message": "insufficient quota",
"raw_message": "insufficient quota",
"detail": null
}{
"code": 403,
"message": "Forbidden - Sensitive content detected",
"raw_message": "Forbidden - Sensitive content detected",
"detail": null
}{
"code": 413,
"message": "File size exceeds maximum limit (100MB)",
"raw_message": "file too large: exceeded 100MB",
"detail": null
}{
"code": 422,
"message": "Invalid parameter values",
"raw_message": "target_resolution must be one of HD, FHD, 2K, 4K, 6K, 8K, 12K",
"detail": null
}{
"code": 429,
"message": "rate limit exceeded, please retry later",
"raw_message": "rate limit exceeded, please retry later",
"detail": null
}{
"code": 500,
"message": "Internal server error",
"raw_message": "Internal server error",
"detail": null
}Topaz Upscale Image
Upscale images to ultra-high resolutions up to 12K
curl --request POST \
--url https://api.legnext.ai/api/v1/enhance-upscale \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"image_url": "https://example.com/photo.jpg",
"jobId": "1868588555208310784",
"imageNo": 0,
"target_resolution": "4K",
"content_type": "photo",
"aspect_ratio": "keep",
"crop_mode": "letterbox",
"output_format": "jpeg",
"face_enhancement_level": "moderate",
"callback": "https://your-domain.com/webhook"
}
'import requests
url = "https://api.legnext.ai/api/v1/enhance-upscale"
payload = {
"image_url": "https://example.com/photo.jpg",
"jobId": "1868588555208310784",
"imageNo": 0,
"target_resolution": "4K",
"content_type": "photo",
"aspect_ratio": "keep",
"crop_mode": "letterbox",
"output_format": "jpeg",
"face_enhancement_level": "moderate",
"callback": "https://your-domain.com/webhook"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image_url: 'https://example.com/photo.jpg',
jobId: '1868588555208310784',
imageNo: 0,
target_resolution: '4K',
content_type: 'photo',
aspect_ratio: 'keep',
crop_mode: 'letterbox',
output_format: 'jpeg',
face_enhancement_level: 'moderate',
callback: 'https://your-domain.com/webhook'
})
};
fetch('https://api.legnext.ai/api/v1/enhance-upscale', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.legnext.ai/api/v1/enhance-upscale",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_url' => 'https://example.com/photo.jpg',
'jobId' => '1868588555208310784',
'imageNo' => 0,
'target_resolution' => '4K',
'content_type' => 'photo',
'aspect_ratio' => 'keep',
'crop_mode' => 'letterbox',
'output_format' => 'jpeg',
'face_enhancement_level' => 'moderate',
'callback' => 'https://your-domain.com/webhook'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.legnext.ai/api/v1/enhance-upscale"
payload := strings.NewReader("{\n \"image_url\": \"https://example.com/photo.jpg\",\n \"jobId\": \"1868588555208310784\",\n \"imageNo\": 0,\n \"target_resolution\": \"4K\",\n \"content_type\": \"photo\",\n \"aspect_ratio\": \"keep\",\n \"crop_mode\": \"letterbox\",\n \"output_format\": \"jpeg\",\n \"face_enhancement_level\": \"moderate\",\n \"callback\": \"https://your-domain.com/webhook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.legnext.ai/api/v1/enhance-upscale")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"image_url\": \"https://example.com/photo.jpg\",\n \"jobId\": \"1868588555208310784\",\n \"imageNo\": 0,\n \"target_resolution\": \"4K\",\n \"content_type\": \"photo\",\n \"aspect_ratio\": \"keep\",\n \"crop_mode\": \"letterbox\",\n \"output_format\": \"jpeg\",\n \"face_enhancement_level\": \"moderate\",\n \"callback\": \"https://your-domain.com/webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.legnext.ai/api/v1/enhance-upscale")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_url\": \"https://example.com/photo.jpg\",\n \"jobId\": \"1868588555208310784\",\n \"imageNo\": 0,\n \"target_resolution\": \"4K\",\n \"content_type\": \"photo\",\n \"aspect_ratio\": \"keep\",\n \"crop_mode\": \"letterbox\",\n \"output_format\": \"jpeg\",\n \"face_enhancement_level\": \"moderate\",\n \"callback\": \"https://your-domain.com/webhook\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"message": "Invalid request, image_url must start with http:// or https://",
"raw_message": "image_url must start with http:// or https://",
"detail": null
}{
"code": 401,
"message": "Failed to verify api key",
"raw_message": "",
"detail": null
}{
"code": 402,
"message": "insufficient quota",
"raw_message": "insufficient quota",
"detail": null
}{
"code": 403,
"message": "Forbidden - Sensitive content detected",
"raw_message": "Forbidden - Sensitive content detected",
"detail": null
}{
"code": 413,
"message": "File size exceeds maximum limit (100MB)",
"raw_message": "file too large: exceeded 100MB",
"detail": null
}{
"code": 422,
"message": "Invalid parameter values",
"raw_message": "target_resolution must be one of HD, FHD, 2K, 4K, 6K, 8K, 12K",
"detail": null
}{
"code": 429,
"message": "rate limit exceeded, please retry later",
"raw_message": "rate limit exceeded, please retry later",
"detail": null
}{
"code": 500,
"message": "Internal server error",
"raw_message": "Internal server error",
"detail": null
}Input Methods
Choose one of the following input methods:Option 1: Direct Image URL
| Parameter | Type | Required | Description |
|---|---|---|---|
image_url | string | Yes | Publicly accessible image URL (HTTP/HTTPS). Supports JPEG, PNG, TIFF. Max: 100MB |
Option 2: Midjourney Task
| Parameter | Type | Required | Description |
|---|---|---|---|
jobId | string | Yes | ID from previous Midjourney task |
imageNo | integer | Yes | Image index from grid (0-3) |
Common Parameters
All enhancement requests support the following parameters:| Parameter | Type | Default | Description |
|---|---|---|---|
target_resolution | string | 2K | Output resolution: HD, FHD, 2K, 4K, 6K, 8K, 12K |
content_type | string | standard | Enhancement model: standard, photo, illustration, text, low_res |
aspect_ratio | string | keep | Aspect ratio: keep, 1:1, 16:9, 9:16, 4:5, 5:4, 3:2, 2:3, 4:3, 3:4 |
crop_mode | string | letterbox | Crop handling: letterbox, crop, stretch |
output_format | string | jpeg | Output format: jpeg, jpg, png, tiff, tif |
face_enhancement_level | string | moderate | Face enhancement: off, none, subtle, moderate, strong |
callback | string | - | Webhook URL for completion notifications |
Resolution Options
| Resolution | Long Edge | Credits | Cost | Recommended For |
|---|---|---|---|---|
| HD/FHD | 1920px | 120 | $0.12 | Web, social media |
| 2K | 2560px | 120 | $0.12 | Web, social media (default) |
| 4K | 3840px | 160 | $0.16 | Digital displays |
| 6K | 6144px | 200 | $0.20 | Professional printing |
| 8K | 7680px | 300 | $0.30 | Large format prints |
| 12K | 12288px | 540 | $0.54 | Billboards, posters |
Content Type Models
| Type | Best For |
|---|---|
standard | General purpose, mixed content (default) |
photo | Photographs, realistic images |
illustration | Digital art, CGI, drawings |
text | Documents, screenshots with text |
low_res | Very low quality source images |
Face Enhancement
| Level | Effect |
|---|---|
off / none | Disabled (no faces in image) |
subtle | Gentle enhancement for natural portraits |
moderate | Balanced enhancement (default) |
strong | Aggressive enhancement for low-quality faces |
Examples
Using Image URL
curl -X POST "https://api.legnext.ai/api/v1/enhance-upscale" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/photo.jpg",
"target_resolution": "4K",
"content_type": "photo"
}'
import requests
response = requests.post(
"https://api.legnext.ai/api/v1/enhance-upscale",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"image_url": "https://example.com/photo.jpg",
"target_resolution": "4K",
"content_type": "photo"
}
)
print(response.json())
const response = await fetch('https://api.legnext.ai/api/v1/enhance-upscale', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
image_url: 'https://example.com/photo.jpg',
target_resolution: '4K',
content_type: 'photo'
})
});
console.log(await response.json());
Using Midjourney Task
curl -X POST "https://api.legnext.ai/api/v1/enhance-upscale" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jobId": "1868588555208310784",
"imageNo": 0,
"target_resolution": "8K",
"content_type": "illustration"
}'
import requests
response = requests.post(
"https://api.legnext.ai/api/v1/enhance-upscale",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"jobId": "1868588555208310784",
"imageNo": 0,
"target_resolution": "8K",
"content_type": "illustration"
}
)
print(response.json())
const response = await fetch('https://api.legnext.ai/api/v1/enhance-upscale', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
jobId: '1868588555208310784',
imageNo: 0,
target_resolution: '8K',
content_type: 'illustration'
})
});
console.log(await response.json());
Response
Success Response
Returns a task object with the following structure:{
"job_id": "f3efd852-18ad-483d-87f2-0685a60df014",
"model": "midjourney",
"task_type": "enhance_upscale",
"status": "pending",
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "",
"secret": ""
}
},
"input": null,
"output": {
"image_url": "",
"image_urls": null,
"seed": ""
},
"meta": {
"created_at": "2025-12-17T03:22:29+08:00",
"started_at": "0001-01-01T00:00:00Z",
"ended_at": "0001-01-01T00:00:00Z",
"usage": {
"type": "point",
"frozen": 300,
"consume": 0
}
},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
job_id | string | Unique task identifier (UUID) |
model | string | Model used: midjourney |
task_type | string | Task type: enhance_upscale |
status | string | Current status: pending, processing, completed, failed |
config | object | Service configuration |
config.service_mode | string | Service mode: public |
config.webhook_config | object | Webhook configuration |
config.webhook_config.endpoint | string | Webhook endpoint URL (empty if not set) |
config.webhook_config.secret | string | Webhook secret (empty if not set) |
input | object/null | Input parameters (null for this endpoint) |
output | object | Task output (empty until completed) |
output.image_url | string | Primary enhanced image URL (available when status is completed) |
output.image_urls | array/null | Array of enhanced image URLs (null until completed) |
output.seed | string | Generation seed (empty for enhancement tasks) |
meta | object | Task metadata |
meta.created_at | string | Task creation timestamp (ISO 8601) |
meta.started_at | string | Task start timestamp (ISO 8601, 0001-01-01T00:00:00Z if not started) |
meta.ended_at | string | Task completion timestamp (ISO 8601, 0001-01-01T00:00:00Z if not completed) |
meta.usage | object | Credit usage information |
meta.usage.type | string | Usage type: point |
meta.usage.frozen | integer | Credits frozen/reserved for this task |
meta.usage.consume | integer | Credits actually consumed (0 if task failed) |
detail | object/null | Additional task details (null if none) |
logs | array | Processing logs (empty array) |
error | object | Error information |
error.code | integer | Error code (0 if successful) |
error.raw_message | string | Raw error message from service (empty if successful) |
error.message | string | Human-readable error message (empty if successful) |
error.detail | object/null | Additional error details (null if none) |
job_id to check task status via the Get Task Status endpoint.Authorizations
API key for authentication
Body
- Option 1
- Option 2
Direct image URL to enhance. Must be publicly accessible. Supports JPEG, PNG, TIFF formats. Maximum file size: 100MB.
2048^https?://"https://example.com/photo.jpg"
Task ID from a previous Midjourney generation task. Use this to enhance images from prior generations.
"1868588555208310784"
Image index from the Midjourney grid (0-3). Required when using jobId.
0 <= x <= 30
Target output resolution. Higher resolutions cost more credits.
HD, FHD, 2K, 4K, 6K, 8K, 12K "4K"
Content-aware enhancement model selection.
standard, photo, illustration, text, low_res "photo"
Output aspect ratio. Use 'keep' to maintain original proportions.
keep, 1:1, 16:9, 9:16, 4:5, 5:4, 3:2, 2:3, 4:3, 3:4 "keep"
How to handle aspect ratio changes when aspect_ratio is not 'keep'.
letterbox, crop, stretch "letterbox"
Output image format.
jpeg, jpg, png, tiff, tif "jpeg"
AI-powered face enhancement strength.
off, none, subtle, moderate, strong "moderate"
Webhook URL for task completion notifications.
"https://your-domain.com/webhook"
Response
Enhancement task created successfully