Skip to main content
POST
/
v1
/
pan
Pan Extend
curl --request POST \
  --url https://api.legnext.ai/api/v1/pan \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "imageNo": 0,
  "direction": 1,
  "scale": 1.5,
  "remixPrompt": "<string>",
  "callback": "<string>"
}
'
Extend existing images in a single specified direction, allowing for precise directional expansion of your content.

Endpoint

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

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)
directionintegerYesExtension direction (0-3)
scalefloatYesExtension scale ratio (1.1-3.0)
remixPromptstringNoText prompt for the extended area (1-8192 characters)
callbackstringNoCallback URL for task completion notifications

Direction Values

ValueDirection
0Down
1Right
2Up
3Left

Scale Parameter

The scale parameter defines the ratio of the new image area to the original in the extension direction:
  • Range: 1.1 to 3.0
  • Example: For a 1:1 aspect ratio image extending right by 13%:
    • scale = 1.13 means the final image will be 13% wider in the specified direction

Example Requests

Extend Right

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

Response

Returns a task object containing the task information.
{
    "job_id": "d0caddaa-028b-4074-985e-7894b2aef5a0",
    "model": "midjourney",
    "task_type": "pan",
    "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/d0caddaa-028b-4074-985e-7894b2aef5a0_grid.png",
        "image_urls": [
            "https://cdn.legnext.ai/temp/1760684625099.png",
            "https://cdn.legnext.ai/temp/1760684624919.png",
            "https://cdn.legnext.ai/temp/1760684624901.png",
            "https://cdn.legnext.ai/temp/1760684624797.png"
        ],
        "seed": "855742389",
        "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:03:07Z",
        "started_at": "2025-10-17T07:03:07Z",
        "ended_at": "2025-10-17T07:03:54Z",
        "usage": {
            "type": "point",
            "frozen": 80,
            "consume": 80
        }
    },
    "detail": null,
    "logs": [],
    "error": {
        "code": 0,
        "raw_message": "",
        "message": "",
        "detail": null
    }
}

Technical Notes

  • Extends in only one specified direction (unlike outpaint which extends in all directions)
  • Scale parameter determines extension ratio (1.1-3.0)
  • AI maintains visual continuity with the original image
  • Use descriptive prompts to guide the content of the extended area

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json
jobId
string<uuid>
required

ID of the original image generation task

imageNo
integer
required

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

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

0

direction
integer
required

Extension direction (0=Down, 1=Right, 2=Up, 3=Left)

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

1

scale
number<float>
required

Extension scale ratio (1.1-3.0)

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

1.5

remixPrompt
string

Text prompt for the extended area

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

Callback URL for task completion notifications

Response

200

Pan task created successfully