Create image edit
Edit images using a reference image and text prompt, with support for masks and multiple references
Multiple reference images
Pass 1–16 additional reference images via theimages field
(URL, base64, or File ID) alongside the primary image to enable
multi-reference generation.
Request formats
Two request formats are supported:multipart/form-data: Upload images as filesapplication/json: Pass images as base64 data URLs (e.g.data:image/jpeg;base64,...)
Mask fields
- The
maskandinput_image_maskparameters are accepted but currently have no effect — edits are always applied to the entire image. For partial editing, consider compositing on the client side.
Output size
It is recommended to explicitly pass thesize parameter for
predictable output dimensions. Without size, the output dimensions
may vary depending on the input images.
gpt-image-2 parameters
| Parameter | Notes |
|---|---|
images (multi-reference) | Supports 1–16 reference images |
input_fidelity | Auto high-fidelity; the API ignores manual settings |
Authorizations
Body
Image edit request body (JSON format). Images are passed as base64
data URLs (e.g. data:image/jpeg;base64,...) or image URLs.
The image model to use. Pass gpt-image-2.
Snapshot versions (e.g. gpt-image-2-2026-04-21) are currently unavailable.
"gpt-image-2"
A text description of the desired edit. Maximum 1,000 characters.
"Replace the pen tip in the main image with the round soft brush tip from the reference image, keep everything else unchanged"
The primary image. Accepts a base64 data URL
(e.g. data:image/jpeg;base64,...) or an image URL.
Additional reference images (1–16 items). Accepts base64 data URLs
or image URLs. Use alongside the primary image for multi-reference editing.
The n parameter is not currently supported. Defaults to n=1,
returning one image per request. To generate multiple images,
call the endpoint in a loop.
x >= 1Size of the output image. Follows the same rules as the generation
endpoint; defaults to auto. It is recommended to pass this
explicitly for predictable output dimensions.
"1024x1024"
"1536x1024"
Format in which the generated image is returned. Defaults to
b64_json (Base64-encoded data); set to url for a temporary
access URL.
b64_json, url Output format of the generated image. Defaults to png;
options: png, jpeg, webp.
png, jpeg, webp Output compression quality (0–100). Applies only when
output_format is jpeg or webp.
0 <= x <= 100Background setting for the generated image. Defaults to auto;
supports opaque or auto. gpt-image-2 does not support
transparent — passing it returns a 400 error.
opaque, auto Quality tiers are not currently supported; all requests use the
auto level. The parameter is accepted but has no observable
difference between levels.
low, medium, high, auto Mask image as a base64 data URL. Masking is not currently supported — the parameter is accepted but has no effect; edits are applied to the entire image.
gpt-image-2-specific mask field as a base64 data URL. Masking
is not currently supported — the parameter is accepted but has
no effect; edits are applied to the entire image.
Input fidelity setting. For gpt-image-2, high fidelity is
enforced automatically; the API ignores this parameter.
A unique identifier for your end user, useful for abuse monitoring.