---
title: "Edit image"
method: POST
path: "/v1/images/edits"
---

# Edit image

`POST /v1/images/edits`

Edit or extend an existing image from a text prompt using image editing models. Accepts multipart/form-data (for file uploads) or application/json (with image references as base64 data URLs or file IDs).

## Request body

- ImageEditRequest
  - `model` string, required — The model to use for image editing
  - `prompt` string, required — A text description of the desired edit
  - `images` ImageReference[], required — The list of input image references to edit. Up to 16 images for GPT image models.
    - `file_id` string — The File API ID of an uploaded image to use as input
    - `image_url` string — A public URL or a base64 encoded data URL for the input image
  - `size` 'auto' | '1024x1024' | '1536x1024' | '1024x1536' — The size of the edited images. Defaults to auto.
  - `quality` 'auto' | 'high' | 'medium' | 'low' — The quality of the edited image. Defaults to auto.
  - `mask` ImageReference — A reference to an input image by uploaded file ID or by URL. Provide exactly one of file_id or image_url. image_url accepts a public URL or a base64 data URL (for example data:image/png;base64,iVBORw0KGgo...).
    - `file_id` string — The File API ID of an uploaded image to use as input
    - `image_url` string — A public URL or a base64 encoded data URL for the input image

## Response `200`

Image edit response

- ImageGenerationResponse
  - `created` integer, required — The Unix timestamp of when the image was created
  - `data` ImageData[], required — The list of generated images
    - `url` string — The URL of the generated image (when response_format is url)
    - `b64_json` string — The base64-encoded JSON of the generated image (when response_format is b64_json)

## Other responses

- `400` — Bad request - malformed payload or invalid parameters.
- `401` — Unauthorized - missing or empty Authorization header.
- `402` — Payment required - organization balance exhausted.
- `403` — Forbidden - invalid token or model not in access list.
- `404` — Not found - provider/model not supported.
- `413` — Payload too large
- `429` — Rate limit exceeded. Retry after the Retry-After header value.
- `500` — Internal server error.
- `502` — Bad gateway - upstream provider returned an invalid response.

---

[API](https://skmtc.dev/requesty/apis/requesty-api.md) · [All operations](https://skmtc.dev/requesty/apis/requesty-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/requesty/requesty-api/revisions/63bc7d99ccde/schema)
