curl --request POST \
--url https://api.moda.app/v1/media/outpaint \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"aspect_ratio": "<string>",
"expand_top": 123,
"expand_bottom": 123,
"expand_left": 123,
"expand_right": 123,
"mode": "<string>",
"idempotency_key": "<string>"
}
'import requests
url = "https://api.moda.app/v1/media/outpaint"
payload = {
"image": "<string>",
"aspect_ratio": "<string>",
"expand_top": 123,
"expand_bottom": 123,
"expand_left": 123,
"expand_right": 123,
"mode": "<string>",
"idempotency_key": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image: '<string>',
aspect_ratio: '<string>',
expand_top: 123,
expand_bottom: 123,
expand_left: 123,
expand_right: 123,
mode: '<string>',
idempotency_key: '<string>'
})
};
fetch('https://api.moda.app/v1/media/outpaint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moda.app/v1/media/outpaint",
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([
'image' => '<string>',
'aspect_ratio' => '<string>',
'expand_top' => 123,
'expand_bottom' => 123,
'expand_left' => 123,
'expand_right' => 123,
'mode' => '<string>',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moda.app/v1/media/outpaint"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"expand_top\": 123,\n \"expand_bottom\": 123,\n \"expand_left\": 123,\n \"expand_right\": 123,\n \"mode\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moda.app/v1/media/outpaint")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"expand_top\": 123,\n \"expand_bottom\": 123,\n \"expand_left\": 123,\n \"expand_right\": 123,\n \"mode\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moda.app/v1/media/outpaint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"expand_top\": 123,\n \"expand_bottom\": 123,\n \"expand_left\": 123,\n \"expand_right\": 123,\n \"mode\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}Outpaint Image
Extend one image past its own borders onto a larger canvas (metered provider call).
The two argument surfaces and every refusal they carry are resolved inside the runner, against the source Moda measured — so the 422s here are the same ones the agent and the connector get, worded once. That includes the model’s output ceiling, which the per-side cap does not imply.
The response carries applied: the effective mode, the requested aspect
ratio, the resolved four-side expansion, the source’s dimensions, the canvas
those expansions add up to, and the dimensions actually delivered.
curl --request POST \
--url https://api.moda.app/v1/media/outpaint \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"aspect_ratio": "<string>",
"expand_top": 123,
"expand_bottom": 123,
"expand_left": 123,
"expand_right": 123,
"mode": "<string>",
"idempotency_key": "<string>"
}
'import requests
url = "https://api.moda.app/v1/media/outpaint"
payload = {
"image": "<string>",
"aspect_ratio": "<string>",
"expand_top": 123,
"expand_bottom": 123,
"expand_left": 123,
"expand_right": 123,
"mode": "<string>",
"idempotency_key": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image: '<string>',
aspect_ratio: '<string>',
expand_top: 123,
expand_bottom: 123,
expand_left: 123,
expand_right: 123,
mode: '<string>',
idempotency_key: '<string>'
})
};
fetch('https://api.moda.app/v1/media/outpaint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moda.app/v1/media/outpaint",
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([
'image' => '<string>',
'aspect_ratio' => '<string>',
'expand_top' => 123,
'expand_bottom' => 123,
'expand_left' => 123,
'expand_right' => 123,
'mode' => '<string>',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moda.app/v1/media/outpaint"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"expand_top\": 123,\n \"expand_bottom\": 123,\n \"expand_left\": 123,\n \"expand_right\": 123,\n \"mode\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moda.app/v1/media/outpaint")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"expand_top\": 123,\n \"expand_bottom\": 123,\n \"expand_left\": 123,\n \"expand_right\": 123,\n \"mode\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moda.app/v1/media/outpaint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"expand_top\": 123,\n \"expand_bottom\": 123,\n \"expand_left\": 123,\n \"expand_right\": 123,\n \"mode\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}Authorizations
API key from Settings > Developer > REST API
Headers
Calendar-dated API version pin. New integrations should pin 2026-05-01 to opt into the newest response shapes. For back-compat the server also accepts requests with no header and resolves them to the current default (today: 2026-04-12); that default advances on each sunset date. Any unsupported value returns 400 unsupported_version.
2026-04-12, 2026-05-01 "2026-05-01"
Body
file_ id of an image Moda has measured. This verb's price counts the source AND the rendered canvas together, so an unmeasured http(s) URL is rejected — and a bigger source costs more even for a small expansion.
Target shape, one of 1:1, 21:9, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5. The four expansions are computed for you and split evenly on whichever axis is short. Rejected for a ratio the image already has — that would expand nothing while still billing a render. Mutually exclusive with the expand_* values. The expanded canvas must also stay within 4MP (4,194,304 pixels), which the per-side cap does not imply — a request past it is rejected naming the size, never resized down, and a source already at or past it must be downscaled before it can be outpainted at all.
Pixels to add on this side, 0 to 2048. Supply one or more of the four for precise control ('extend the sky upward'); mutually exclusive with aspect_ratio, and supplying both is rejected rather than silently honouring one. An all-zero request is rejected: it would bill a full render for a copy of the input. The expanded canvas must also stay within 4MP (4,194,304 pixels), which the per-side cap does not imply — a request past it is rejected naming the size, never resized down, and a source already at or past it must be downscaled before it can be outpainted at all.
Pixels to add on this side, 0 to 2048. Supply one or more of the four for precise control ('extend the sky upward'); mutually exclusive with aspect_ratio, and supplying both is rejected rather than silently honouring one. An all-zero request is rejected: it would bill a full render for a copy of the input. The expanded canvas must also stay within 4MP (4,194,304 pixels), which the per-side cap does not imply — a request past it is rejected naming the size, never resized down, and a source already at or past it must be downscaled before it can be outpainted at all.
Pixels to add on this side, 0 to 2048. Supply one or more of the four for precise control ('extend the sky upward'); mutually exclusive with aspect_ratio, and supplying both is rejected rather than silently honouring one. An all-zero request is rejected: it would bill a full render for a copy of the input. The expanded canvas must also stay within 4MP (4,194,304 pixels), which the per-side cap does not imply — a request past it is rejected naming the size, never resized down, and a source already at or past it must be downscaled before it can be outpainted at all.
Pixels to add on this side, 0 to 2048. Supply one or more of the four for precise control ('extend the sky upward'); mutually exclusive with aspect_ratio, and supplying both is rejected rather than silently honouring one. An all-zero request is rejected: it would bill a full render for a copy of the input. The expanded canvas must also stay within 4MP (4,194,304 pixels), which the per-side cap does not imply — a request past it is rejected naming the size, never resized down, and a source already at or past it must be downscaled before it can be outpainted at all.
high or fast (default high). fast trades fidelity for speed at the same price.
A retried call with the same key replays the stored response (replayed:true) instead of paying for a second provider render.
200Response
Successful Response
The response is of type Response Mediaoutpaintimage · object.