Skip to main content
POST
/
v1
/
enhance-upscale
Enhance and Upscale Image
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"
}
'
{
  "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
}
Supports direct image URLs or images from previous Midjourney tasks.

Input Methods

Choose one of the following input methods:

Option 1: Direct Image URL

ParameterTypeRequiredDescription
image_urlstringYesPublicly accessible image URL (HTTP/HTTPS). Supports JPEG, PNG, TIFF. Max: 100MB

Option 2: Midjourney Task

ParameterTypeRequiredDescription
jobIdstringYesID from previous Midjourney task
imageNointegerYesImage index from grid (0-3)

Common Parameters

All enhancement requests support the following parameters:
ParameterTypeDefaultDescription
target_resolutionstring2KOutput resolution: HD, FHD, 2K, 4K, 6K, 8K, 12K
content_typestringstandardEnhancement model: standard, photo, illustration, text, low_res
aspect_ratiostringkeepAspect ratio: keep, 1:1, 16:9, 9:16, 4:5, 5:4, 3:2, 2:3, 4:3, 3:4
crop_modestringletterboxCrop handling: letterbox, crop, stretch
output_formatstringjpegOutput format: jpeg, jpg, png, tiff, tif
face_enhancement_levelstringmoderateFace enhancement: off, none, subtle, moderate, strong
callbackstring-Webhook URL for completion notifications

Resolution Options

ResolutionLong EdgeCreditsCostRecommended For
HD/FHD1920px120$0.12Web, social media
2K2560px120$0.12Web, social media (default)
4K3840px160$0.16Digital displays
6K6144px200$0.20Professional printing
8K7680px300$0.30Large format prints
12K12288px540$0.54Billboards, posters
Higher resolutions consume more credits and take longer to process. Choose the minimum resolution that meets your requirements.

Content Type Models

TypeBest For
standardGeneral purpose, mixed content (default)
photoPhotographs, realistic images
illustrationDigital art, CGI, drawings
textDocuments, screenshots with text
low_resVery low quality source images

Face Enhancement

LevelEffect
off / noneDisabled (no faces in image)
subtleGentle enhancement for natural portraits
moderateBalanced enhancement (default)
strongAggressive 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"
  }'

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"
  }'

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

FieldTypeDescription
job_idstringUnique task identifier (UUID)
modelstringModel used: midjourney
task_typestringTask type: enhance_upscale
statusstringCurrent status: pending, processing, completed, failed
configobjectService configuration
config.service_modestringService mode: public
config.webhook_configobjectWebhook configuration
config.webhook_config.endpointstringWebhook endpoint URL (empty if not set)
config.webhook_config.secretstringWebhook secret (empty if not set)
inputobject/nullInput parameters (null for this endpoint)
outputobjectTask output (empty until completed)
output.image_urlstringPrimary enhanced image URL (available when status is completed)
output.image_urlsarray/nullArray of enhanced image URLs (null until completed)
output.seedstringGeneration seed (empty for enhancement tasks)
metaobjectTask metadata
meta.created_atstringTask creation timestamp (ISO 8601)
meta.started_atstringTask start timestamp (ISO 8601, 0001-01-01T00:00:00Z if not started)
meta.ended_atstringTask completion timestamp (ISO 8601, 0001-01-01T00:00:00Z if not completed)
meta.usageobjectCredit usage information
meta.usage.typestringUsage type: point
meta.usage.frozenintegerCredits frozen/reserved for this task
meta.usage.consumeintegerCredits actually consumed (0 if task failed)
detailobject/nullAdditional task details (null if none)
logsarrayProcessing logs (empty array)
errorobjectError information
error.codeintegerError code (0 if successful)
error.raw_messagestringRaw error message from service (empty if successful)
error.messagestringHuman-readable error message (empty if successful)
error.detailobject/nullAdditional error details (null if none)
Use the job_id to check task status via the Get Task Status endpoint.

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json
image_url
string<uri>
required

Direct image URL to enhance. Must be publicly accessible. Supports JPEG, PNG, TIFF formats. Maximum file size: 100MB.

Maximum string length: 2048
Example:

"https://example.com/photo.jpg"

jobId
string

Task ID from a previous Midjourney generation task. Use this to enhance images from prior generations.

Example:

"1868588555208310784"

imageNo
integer

Image index from the Midjourney grid (0-3). Required when using jobId.

Required range: 0 <= x <= 3
Example:

0

target_resolution
enum<string>
default:2K

Target output resolution. Higher resolutions cost more credits.

Available options:
HD,
FHD,
2K,
4K,
6K,
8K,
12K
Example:

"4K"

content_type
enum<string>
default:standard

Content-aware enhancement model selection.

Available options:
standard,
photo,
illustration,
text,
low_res
Example:

"photo"

aspect_ratio
enum<string>
default:keep

Output aspect ratio. Use 'keep' to maintain original proportions.

Available options:
keep,
1:1,
16:9,
9:16,
4:5,
5:4,
3:2,
2:3,
4:3,
3:4
Example:

"keep"

crop_mode
enum<string>
default:letterbox

How to handle aspect ratio changes when aspect_ratio is not 'keep'.

Available options:
letterbox,
crop,
stretch
Example:

"letterbox"

output_format
enum<string>
default:jpeg

Output image format.

Available options:
jpeg,
jpg,
png,
tiff,
tif
Example:

"jpeg"

face_enhancement_level
enum<string>
default:moderate

AI-powered face enhancement strength.

Available options:
off,
none,
subtle,
moderate,
strong
Example:

"moderate"

callback
string<uri>

Webhook URL for task completion notifications.

Example:

"https://your-domain.com/webhook"

Response

Enhancement task created successfully