Skip to main content
POST
/
v1
/
outpaint
Outpaint
curl --request POST \
  --url https://api.legnext.ai/api/v1/outpaint \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "imageNo": 0,
  "scale": 1.55,
  "remixPrompt": "<string>",
  "callback": "<string>"
}
'
{
  "code": 400,
  "message": "Invalid request parameters",
  "raw_message": "Invalid request parameters",
  "detail": null
}

Headers

HeaderTypeRequiredDescription
x-api-keystringYesYour API key

Request Body

ParameterTypeRequiredDescription
jobIdstringYesID of the original image generation task
imageNointegerYesImage number to extend (0/1/2/3)
scalefloatYesExtension scale ratio (1.1-2.0)
remixPromptstringNoText prompt for the extended areas (1-8192 characters)
callbackstringNoCallback URL for task completion notifications

Parameters Detail

Scale Parameter

The scale parameter defines how much larger the final image will be compared to the original:
  • Range: 1.1 to 2.0
  • Example: For a 1:1 aspect ratio image:
    • scale = 1.2 means the original image will occupy 83% of the new image (20% extension)
    • scale = 2.0 means the original image will occupy 50% of the new image (100% extension)

Example Request

curl -X POST "https://api.legnext.ai/api/v1/outpaint" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jobId": "5dd94ec3-7282-4f04-9445-59e850ef1822",
    "imageNo": 0,
    "scale": 1.5,
    "remixPrompt": "clouds over the sky",
    "callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
  }'

Response

Returns a task object containing the task information.
{
    "job_id": "c4e210ca-6cf1-4453-a204-00f26a8e75cc",
    "model": "midjourney",
    "task_type": "outpaint",
    "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": 80,
            "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.

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json
jobId
string<uuid>
required

ID of the original image

imageNo
integer
required

Image number to extend (0, 1, 2, or 3)

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

0

scale
number<float>
required

Extension scale ratio (1.1-2.0)

Required range: 1.1 <= x <= 2
remixPrompt
string

Text prompt for the extended areas

Required string length: 1 - 8192
callback
string<uri>

Callback URL for task completion notifications

Response

Outpaint task created successfully