Upscale Image
curl --request POST \
--url https://api.legnext.ai/api/v1/upscale \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"imageNo": 0,
"callback": "<string>"
}
'import requests
url = "https://api.legnext.ai/api/v1/upscale"
payload = {
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"imageNo": 0,
"callback": "<string>"
}
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({
jobId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
imageNo: 0,
callback: '<string>'
})
};
fetch('https://api.legnext.ai/api/v1/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/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([
'jobId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'imageNo' => 0,
'callback' => '<string>'
]),
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/upscale"
payload := strings.NewReader("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"imageNo\": 0,\n \"callback\": \"<string>\"\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/upscale")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"imageNo\": 0,\n \"callback\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.legnext.ai/api/v1/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 \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"imageNo\": 0,\n \"callback\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"message": "Invalid request parameters",
"raw_message": "Invalid request parameters",
"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",
"raw_message": "file too large",
"detail": null
}{
"code": 422,
"message": "Invalid parameter values",
"raw_message": "Invalid parameter values",
"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
}Image Generation
Upscale
Enhance image resolution and quality
POST
/
v1
/
upscale
Upscale Image
curl --request POST \
--url https://api.legnext.ai/api/v1/upscale \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"imageNo": 0,
"callback": "<string>"
}
'import requests
url = "https://api.legnext.ai/api/v1/upscale"
payload = {
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"imageNo": 0,
"callback": "<string>"
}
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({
jobId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
imageNo: 0,
callback: '<string>'
})
};
fetch('https://api.legnext.ai/api/v1/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/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([
'jobId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'imageNo' => 0,
'callback' => '<string>'
]),
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/upscale"
payload := strings.NewReader("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"imageNo\": 0,\n \"callback\": \"<string>\"\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/upscale")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"imageNo\": 0,\n \"callback\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.legnext.ai/api/v1/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 \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"imageNo\": 0,\n \"callback\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"message": "Invalid request parameters",
"raw_message": "Invalid request parameters",
"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",
"raw_message": "file too large",
"detail": null
}{
"code": 422,
"message": "Invalid parameter values",
"raw_message": "Invalid parameter values",
"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
}Headers
| Header | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | Your API key |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
jobId | string | Yes | ID of the original image generation task |
imageNo | integer | Yes | Image number to upscale (0/1/2/3) |
type | integer | Yes | Upscaling type (0 or 1) |
callback | string | No | Callback URL for task completion notifications |
Upscale Types
| Type | Name | Description | Supported Models |
|---|---|---|---|
| 0 | Subtle | Conservative enhancement preserving original details | v6, niji6, v6.1, v7 |
| 1 | Creative | More aggressive enhancement with artistic interpretation | v6, niji6, v6.1, v7 |
| 2 | 2x | 2x resolution increase (deprecated) | v5, niji5 |
| 3 | 4x | 4x resolution increase (deprecated) | v5, niji5 |
Example Requests
Subtle Upscale
curl -X POST "https://api.legnext.ai/api/v1/upscale" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jobId": "5dd94ec3-7282-4f04-9445-59e850ef1822",
"imageNo": 0,
"type": 0,
"callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
}'
import requests
url = "https://api.legnext.ai/api/v1/upscale"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"jobId": "5dd94ec3-7282-4f04-9445-59e850ef1822",
"imageNo": 0,
"type": 0,
"callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
const response = await fetch('https://api.legnext.ai/api/v1/upscale', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
jobId: '5dd94ec3-7282-4f04-9445-59e850ef1822',
imageNo: 0,
type: 0,
callback: 'https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d'
})
});
const result = await response.json();
console.log(result);
Creative Upscale
curl -X POST "https://api.legnext.ai/api/v1/upscale" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jobId": "5dd94ec3-7282-4f04-9445-59e850ef1822",
"imageNo": 0,
"type": 1,
"callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
}'
import requests
url = "https://api.legnext.ai/api/v1/upscale"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"jobId": "5dd94ec3-7282-4f04-9445-59e850ef1822",
"imageNo": 0,
"type": 1,
"callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
const response = await fetch('https://api.legnext.ai/api/v1/upscale', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
jobId: '5dd94ec3-7282-4f04-9445-59e850ef1822',
imageNo: 0,
type: 1,
callback: 'https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d'
})
});
const result = await response.json();
console.log(result);
Response
Returns a task object containing the task information.{
"job_id": "8541c46c-6af7-49a5-a5a2-dd82eae7e6c8",
"model": "midjourney",
"task_type": "upscale",
"status": "pending",
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d",
"secret": ""
}
},
"input": null,
"output": {
"image_url": "",
"image_urls": null,
"seed": ""
},
"meta": {
"created_at": "",
"started_at": "",
"ended_at": "",
"usage": {
"type": "point",
"frozen": 120,
"consume": 0
}
},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
}
This is the initial success response. Use the
job_id to check the task status via the Get Task endpoint to retrieve the completed result with image URLs.Upscale Types Comparison
Subtle (Type 0)
- Best For: Photography, realistic images, preserving original details
- Characteristics:
- Minimal artistic interpretation
- Preserves original composition and style
- Clean, sharp enhancement
- Suitable for professional use
Creative (Type 1)
- Best For: Artistic images, illustrations, creative projects
- Characteristics:
- Enhanced artistic details
- More dramatic improvement
- May add creative interpretation
- Good for artistic workflows
Authorizations
API key for authentication
Body
application/json
ID of the original image generation task
Image number to upscale (0, 1, 2, or 3)
Required range:
0 <= x <= 3Example:
0
Upscaling type (0=Subtle, 1=Creative)
Available options:
0, 1 Callback URL for task completion notifications
Response
Upscale task created successfully
⌘I