---
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

---

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