# Outpainting - Documentation

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown is available with `Accept: text/markdown` and `.md` URL variants.

Source: /docs/api-reference/model-apis-outpainting

# Outpainting

POST

/

v3

/

outpainting

Try it

Outpainting

cURL

```
curl --request POST \
--url https://api.novita.ai/v3/outpainting \
--header 'Authorization: &#x3C;authorization>' \
--header 'Content-Type: &#x3C;content-type>' \
--data '
{
"extra": {
"response_image_type": "&#x3C;string>",
"enterprise_plan": {
"enabled": true
}
},
"image_file": "&#x3C;string>",
"prompt": "&#x3C;string>",
"negative_prompt": "&#x3C;string>",
"width": 123,
"height": 123,
"center_x": 123,
"center_y": 123
}
'
```

```
import requestsurl = "https://api.novita.ai/v3/outpainting"payload = { "extra": { "response_image_type": "&#x3C;string>", "enterprise_plan": { "enabled": True } }, "image_file": "&#x3C;string>", "prompt": "&#x3C;string>", "negative_prompt": "&#x3C;string>", "width": 123, "height": 123, "center_x": 123, "center_y": 123}headers = { "Content-Type": "&#x3C;content-type>", "Authorization": "&#x3C;authorization>"}response = requests.post(url, json=payload, headers=headers)print(response.text)
```

```
const options = { method: 'POST', headers: {'Content-Type': '&#x3C;content-type>', Authorization: '&#x3C;authorization>'}, body: JSON.stringify({ extra: {response_image_type: '&#x3C;string>', enterprise_plan: {enabled: true}}, image_file: '&#x3C;string>', prompt: '&#x3C;string>', negative_prompt: '&#x3C;string>', width: 123, height: 123, center_x: 123, center_y: 123 })};fetch('https://api.novita.ai/v3/outpainting', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err));
```

```
&#x3C;?php$curl = curl_init();curl_setopt_array($curl, [ CURLOPT_URL => "https://api.novita.ai/v3/outpainting", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode([ 'extra' => [ 'response_image_type' => '&#x3C;string>', 'enterprise_plan' => [ 'enabled' => true ] ], 'image_file' => '&#x3C;string>', 'prompt' => '&#x3C;string>', 'negative_prompt' => '&#x3C;string>', 'width' => 123, 'height' => 123, 'center_x' => 123, 'center_y' => 123 ]), CURLOPT_HTTPHEADER => [ "Authorization: &#x3C;authorization>", "Content-Type: &#x3C;content-type>" ],]);$response = curl_exec($curl);$err = curl_error($curl);curl_close($curl);if ($err) { echo "cURL Error #:" . $err;} else { echo $response;}
```

```
package mainimport (	"fmt"	"strings"	"net/http"	"io")func main() {	url := "https://api.novita.ai/v3/outpainting"	payload := strings.NewReader("{\n \"extra\": {\n \"response_image_type\": \"&#x3C;string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"&#x3C;string>\",\n \"prompt\": \"&#x3C;string>\",\n \"negative_prompt\": \"&#x3C;string>\",\n \"width\": 123,\n \"height\": 123,\n \"center_x\": 123,\n \"center_y\": 123\n}")	req, _ := http.NewRequest("POST", url, payload)	req.Header.Add("Content-Type", "&#x3C;content-type>")	req.Header.Add("Authorization", "&#x3C;authorization>")	res, _ := http.DefaultClient.Do(req)	defer res.Body.Close()	body, _ := io.ReadAll(res.Body)	fmt.Println(string(body))}
```

```
HttpResponse&#x3C;String> response = Unirest.post("https://api.novita.ai/v3/outpainting") .header("Content-Type", "&#x3C;content-type>") .header("Authorization", "&#x3C;authorization>") .body("{\n \"extra\": {\n \"response_image_type\": \"&#x3C;string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"&#x3C;string>\",\n \"prompt\": \"&#x3C;string>\",\n \"negative_prompt\": \"&#x3C;string>\",\n \"width\": 123,\n \"height\": 123,\n \"center_x\": 123,\n \"center_y\": 123\n}") .asString();
```

```
require 'uri'require 'net/http'url = URI("https://api.novita.ai/v3/outpainting")http = Net::HTTP.new(url.host, url.port)http.use_ssl = truerequest = Net::HTTP::Post.new(url)request["Content-Type"] = '&#x3C;content-type>'request["Authorization"] = '&#x3C;authorization>'request.body = "{\n \"extra\": {\n \"response_image_type\": \"&#x3C;string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"&#x3C;string>\",\n \"prompt\": \"&#x3C;string>\",\n \"negative_prompt\": \"&#x3C;string>\",\n \"width\": 123,\n \"height\": 123,\n \"center_x\": 123,\n \"center_y\": 123\n}"response = http.request(request)puts response.read_body
```

200

```
{
"image_file": "&#x3C;string>",
"image_type": "&#x3C;string>"
}
```

Extending the borders of the image or providing additional variations to the edges of the image.

##

[​](#request-headers)

Request Headers

[​](#param-content-type)

Content-Type

string

required

Enum: `application/json`

[​](#param-authorization)

Authorization

string

required

Bearer authentication format, for example: Bearer {{API Key}}.

##

[​](#request-body)

Request Body

[​](#param-extra)

extra

object

Optional extra parameters for the request.

Show properties

[​](#param-response-image-type)

response_image_type

string

The returned image type.

Enum: `png`, `webp`, `jpeg`

[​](#param-enterprise-plan)

enterprise_plan

object

Dedicated Endpoints settings, which only take effect for users who have already subscribed to the [Dedicated Endpoints Documentation](/docs/guides/model-apis-dedicated-endpoints).

Show properties

[​](#param-enabled)

enabled

boolean

Set to true to schedule this task to use your Dedicated Endpoints’s dedicated resources. Default is false.

[​](#param-image-file)

image_file

string

required

The base64 original image, with a maximum resolution of 1024 x 1024 and a maximum file size of 30 Mb.

[​](#param-prompt)

prompt

string

required

Text input required to guide the image generation, divided by `,` . Range [1, 1024].

[​](#param-negative-prompt)

negative_prompt

string

Text input that specifies what to exclude from the generated images, divided by `,` . Range [1, 1024].

[​](#param-width)

width

integer

required

The width of the outpainting image (px), which needs to be larger than the width of the original image. Maximum: 4096px.

[​](#param-height)

height

integer

required

The height of the outpainting image (px), which needs to be larger than the height of the original image. Maximum: 4096px.

[​](#param-center-x)

center_x

integer

required

The offset (px) between the center of the original image and the center of the expanded image in the X-axis direction. Default is 0. The allowed value range is -(width + original image width)/2 to (width + original image width)/2.

[​](#param-center-y)

center_y

integer

required

The offset (px) between the center of the original image and the center of the expanded image in the Y-axis direction. Default is 0. The allowed value range is -(height + original image height)/2 to (height + original image height)/2.

##

[​](#response)

Response

[​](#param-image-file-1)

image_file

string

The Base64-encoded content of the returned image.

[​](#param-image-type)

image_type

string

The returned image type.

Enum: `png`, `webp`, `jpeg`

##

[​](#example)

Example

Extending the borders of the image or providing additional variations to the edges of the image.
Try it in [playground](https://novita.ai/playground#outpainting).
`Request:`

```
curl --location --request POST 'https://api.novita.ai/v3/outpainting' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"image_file":"{{Base64 encoded image}}",
"width": 1024,
"height": 1024,
"center_x": 0,
"center_y": 0
}'
```

HTTP status codes in the 2xx range indicate that the request has been successfully accepted. A code 400 means there is a request parameter error, while status codes in the 5xx range indicate internal server errors.
You can obtain the image URL in the `image_file` of the response in base64 format.
`Response:`

```
{
"image_file": "{{Base64 encoded image}}",
"image_type": "png"
}
```

![Outpainting](https://next-app-static.s3.ap-southeast-1.amazonaws.com/get-started/UseCase_outpainting01.png)

![Outpainting](https://next-app-static.s3.ap-southeast-1.amazonaws.com/get-started/UseCase_outpainting02.png)

Last modified on June 9, 2026
