---
title: "Flux Pro - Expand image"
method: POST
path: "/v1/ai/image-expand/flux-pro"
tags: ["image-expand"]
---

# Flux Pro - Expand image

`POST /v1/ai/image-expand/flux-pro`

## Request

- Base URL: `https://api.magnific.com`
- URL: `https://api.magnific.com/v1/ai/image-expand/flux-pro`
- Auth: API key in header `x-magnific-api-key`

This endpoint allows you to expand an image using the AI Flux Pro model. The image will be expanded based on the provided parameters.

### Input size

The image you send must be **at least 256 pixels on each side** and **no
larger than 20 megapixels** (`width * height <= 20,000,000`). Neither side
is capped on its own and there is no aspect ratio restriction: a 30000x600
image is accepted, while a 255x70500 one is rejected because one of its
sides is below 256, even though it is only 18 megapixels.

File size is irrelevant — what counts is the decoded pixel count, so a
heavily compressed 60 megapixel photo is rejected just the same. An image
outside these bounds is rejected with an error naming the rule it broke.

Sending more than 20 megapixels buys you nothing anyway: the output is
capped at roughly 1.6 megapixels regardless of how large the input was, so
resize before uploading.

### Output size

`left`, `right`, `top` and `bottom` describe the expansion you are asking for,
but **this model does not guarantee that exact output size**. The requested
canvas is `input_width + left + right` by `input_height + top + bottom`, and
two rules are then applied to it:

1. **Maximum output size of roughly 1.6 megapixels.** If the requested canvas
   is larger, the whole image is scaled down proportionally until it fits. The
   aspect ratio is preserved, so there is no single maximum width or height:
   the cap applies to the total pixel count. A 1200x400 image expanded by 400
   pixels on each edge asks for a 2000x1200 canvas and comes back as 1632x976.
2. **Each side is rounded to the nearest multiple of 16.** A requested
   916x692 comes back as 912x688; a requested 936x712 comes back as 944x720.

Both rules apply on every request, including small ones, so an output that
matches your requested pixels exactly is the exception rather than the rule.

Omitting an edge applies its default (512 left, 512 right, 256 top, 256
bottom). Sending `0` leaves that edge unexpanded; sending `0` on all four
edges returns a `400`, since there is nothing to expand.

That said, **this is the expand endpoint that stays closest to the pixel
values you request**: below the 1.6 megapixel cap, the rounding to 16 is the
only deviation. Expanding an 896x672 image by 500 pixels on the top edge
alone asks for 896x1172 and returns 896x1168. The other two expand endpoints
diverge much further:
`ideogram` always renders at about 1 megapixel and only preserves the aspect
ratio, and `seedream-v4-5` scales any canvas below 3.7 megapixels up. If you
need exact output dimensions, resize the result yourself after generation.

## Request body

- ImageExpandRequest
  - `webhook_url` string, uri: Optional callback URL that will receive asynchronous notifications whenever the task changes status. The payload sent to this URL is the same as the corresponding GET endpoint response, but without the data field.
  - `image` string, byte, required: Base64 image to expand
  - `prompt` string: The description of the changes you want to make. This text guides the expansion process, allowing you to specify features, styles, or modifications for the expanded areas.
  - `left` integer, nullable: Pixels to expand on the left. Omit the field to use the default of `512`; send `0` to leave this edge unexpanded. The requested size is not always the size you get back — see the description of this endpoint.
  - `right` integer, nullable: Pixels to expand on the right. Omit the field to use the default of `512`; send `0` to leave this edge unexpanded.
  - `top` integer, nullable: Pixels to expand on the top. Omit the field to use the default of `256`; send `0` to leave this edge unexpanded.
  - `bottom` integer, nullable: Pixels to expand on the bottom. Omit the field to use the default of `256`; send `0` to leave this edge unexpanded.

## Response `200`

OK - The task exists and the status is returned

- InlineObject4
  - `data` TaskDetail1, required
    - `task_id` string, uuid, required: Task identifier
    - `status` 'CREATED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED', required: Task status
    - `generated` string[], required

## Other responses

- `400`: Bad Request - The server could not understand the request due to invalid syntax.
- `401`: Unauthorized - The client must authenticate itself to get the requested response.
- `500`: Internal Server Error - The server has encountered a situation it doesn't know how to handle.
- `503`: Service Unavailable

---

[API](https://skmtc.dev/magnific/apis/magnific-api.md) · [All operations](https://skmtc.dev/magnific/apis/magnific-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magnific/apis/magnific-api/revisions/60711fb082c7?raw)
