Skip to main content
POST
/
v1
/
images
/
edits
curl -X POST "https://api.lemondata.cc/v1/images/edits" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "image=@sunlit_lounge.png" \
  -F "[email protected]" \
  -F "prompt=A sunlit indoor lounge area with a pool" \
  -F "n=1" \
  -F "size=1024x1024"
{
  "created": 1706000000,
  "data": [
    {
      "url": "https://..."
    }
  ]
}

Overview

Creates an edited or extended image given an original image and a prompt. Requires multipart/form-data content type.

Request Body

image
file
required
The image to edit. Must be a valid PNG file, less than 4MB, and square. The image should have transparency where edits are desired.
prompt
string
required
A text description of the desired edit.
mask
file
An additional image whose fully transparent areas indicate where the image should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as image.
model
string
default:"dall-e-2"
The model to use for image edit. Currently only dall-e-2 is supported.
n
integer
default:"1"
The number of images to generate. Must be between 1 and 10.
size
string
The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.
response_format
string
default:"url"
The format in which the generated images are returned. Must be url or b64_json.
user
string
A unique identifier representing your end-user for abuse monitoring.

Response

created
integer
Unix timestamp of when the images were created.
data
array
Array of generated images.Each object contains:
  • url (string): URL of the edited image (if response_format is url)
  • b64_json (string): Base64-encoded image (if response_format is b64_json)
curl -X POST "https://api.lemondata.cc/v1/images/edits" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "image=@sunlit_lounge.png" \
  -F "[email protected]" \
  -F "prompt=A sunlit indoor lounge area with a pool" \
  -F "n=1" \
  -F "size=1024x1024"
{
  "created": 1706000000,
  "data": [
    {
      "url": "https://..."
    }
  ]
}

Notes

Image edits are only available with DALL-E 2. The image must have transparent areas indicating where the edit should be applied, or you can provide a separate mask image.

Body

application/json
image
file
required

The image to edit. Must be a valid PNG file, less than 4MB, and square. The image should have transparency where edits are desired.

prompt
string
required

A text description of the desired edit.

mask
file

An additional image whose fully transparent areas indicate where the image should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as image .

model
string

The model to use for image edit. Currently only dall-e-2 is supported.

n
integer

The number of images to generate. Must be between 1 and 10.

size
string

The size of the generated images. Must be one of 256x256 , 512x512 , or 1024x1024 .

response_format
string

The format in which the generated images are returned. Must be url or b64_json .

user
string

A unique identifier representing your end-user for abuse monitoring.

Response

200 - application/json

Response 200

created
integer

Unix timestamp of when the images were created.

data
object[]

Array of generated images. Each object contains: url (string): URL of the edited image (if response_format is url ) b64_json (string): Base64-encoded image (if response_format is b64_json )