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>"
}
'
Extend existing images in all directions using outpainting to expand the visual content beyond the original boundaries.

Endpoint

POST https://api.legnext.ai/api/v1/outpaint

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": "completed",
    "config": {
        "service_mode": "public",
        "webhook_config": {
            "endpoint": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d",
            "secret": ""
        }
    },
    "input": null,
    "output": {
        "image_url": "https://cdn.legnext.ai/mj/c4e210ca-6cf1-4453-a204-00f26a8e75cc_grid.png",
        "image_urls": [
            "https://cdn.legnext.ai/temp/1760685677368.png",
            "https://cdn.legnext.ai/temp/1760685676016.png",
            "https://cdn.legnext.ai/temp/1760685676460.png",
            "https://cdn.legnext.ai/temp/1760685677121.png"
        ],
        "seed": "3982085446",
        "available_actions": {
            "edit": [
                0,
                1,
                2,
                3
            ],
            "inpaint": [
                0,
                1,
                2,
                3
            ],
            "outpaint": [
                0,
                1,
                2,
                3
            ],
            "pan": [
                0,
                1,
                2,
                3
            ],
            "remix": [
                0,
                1,
                2,
                3
            ],
            "reroll": true,
            "upscale": [
                0,
                1,
                2,
                3
            ],
            "variation": [
                0,
                1,
                2,
                3
            ]
        }
    },
    "meta": {
        "created_at": "2025-10-17T07:20:15Z",
        "started_at": "2025-10-17T07:20:16Z",
        "ended_at": "2025-10-17T07:21:25Z",
        "usage": {
            "type": "point",
            "frozen": 80,
            "consume": 80
        }
    },
    "detail": null,
    "logs": [],
    "error": {
        "code": 0,
        "raw_message": "",
        "message": "",
        "detail": null
    }
}

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

200

Outpaint task created successfully