---
title: "Outpaint Image"
method: POST
path: "/media/outpaint"
tags: ["media"]
---

# Outpaint Image

`POST /media/outpaint`

## Request

- Base URL: `https://api.moda.app/v1`
- URL: `https://api.moda.app/v1/media/outpaint`
- Auth: HTTP bearer

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.

## Headers

- `Moda-Version` '2026-04-12' | '2026-05-01'

## Request body

- OutpaintRequest
  - `image` string, required: 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.
  - `aspect_ratio` string, nullable: 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.
  - `expand_top` integer, nullable: 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.
  - `expand_bottom` integer, nullable: 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.
  - `expand_left` integer, nullable: 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.
  - `expand_right` integer, nullable: 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.
  - `mode` string, nullable: high or fast (default high). fast trades fidelity for speed at the same price.
  - `idempotency_key` string, nullable: A retried call with the same key replays the stored response (replayed:true) instead of paying for a second provider render.

## Response `200`

Successful Response

- object

## Other responses

- `401`: Authentication required.
- `402`: Insufficient credits for a metered operation.
- `403`: Permission denied for this scope.
- `404`: Resource not found.
- `409`: Conflict (idempotency / resource state).
- `422`: Request validation failed.
- `429`: Rate limit exceeded.
- `500`: Internal error.

## Changes

- **2026-11-03** `9ac6a3abc0f8`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/moda/apis/moda-public-api/changes/media/outpaint/post.md)

---

[API](https://skmtc.dev/moda/apis/moda-public-api.md) - [All operations](https://skmtc.dev/moda/apis/moda-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/moda/apis/moda-public-api/revisions/9ac6a3abc0f8?raw)
