---
title: "Edit Image"
method: POST
path: "/api/message/edit_image"
tags: ["Message"]
---

# Edit Image

`POST /api/message/edit_image`

Uses `gpt-image-1` to edit an images based on a given prompt. Note that the images must be
base64 encoded and all must have the same mime type.

## Headers

- `TR-Dataset` string, uuid, required

## Request body

- EditImageReqPayload
  - `input_images` ImageUpload[], required — The images to edit
    - `file_name` string, required — The file name of the image
    - `image_src` union, required
      - object
        - `base64` string, required — Base64 encoded image data
      - object
        - `url` string, required — URL of the image
  - `mime_type` string, nullable — The mime type of the uploaded image(s)
  - `n` integer, nullable — The number of images to generate (default: 1)
  - `prompt` string, required — The prompt describing the desired edit
  - `quality` 'low' | 'medium' | 'high'
  - `size` '1024x1024' | '1024x1536' | '1536x1024'

## Response `200`

A list of base64 encoded images

- ImageEditResponse
  - `image_urls` string[], required — The URL of the generated image

## Other responses

- `400` — Service error relating to editing the image

## Changes

> 50 revisions in range; 1 could not be searched.

- **2025-05-09** `f86adcbeb66d` — 2 breaking, 1 warning, 1 info
  - added the new required request property `input_images/items/image_src`
  - removed the required property `images` from the response with the `200` status
  - removed the request property `input_images/items/base64_image`
  - added the required property `image_urls` to the response with the `200` status
- **2025-05-09** `216ae1603310` — 1 info
  - added the media type `application/json` for the response with the status `200`
- **2025-05-05** `bdab6140c652` — 1 info
  - endpoint added
- **2025-04-24** `661f8d6f359b` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/devflowinc/apis/trieve-api/changes/api/message/edit_image/post.md)

---

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