Skip to main content
POST
Edit Images
Create variations or edits of existing images using AI models.

Edit Images

POST /images/edits Create edited or extended versions of an existing image.

Request Body

file
required
The image to edit. Must be a valid PNG file, less than 4MB, and square.
file
Additional image whose fully transparent areas indicate where image should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as image.
string
required
A text description of the desired image(s)
string
The model to use for image editing (“flux-1-kontext-pro”, “flux-1-kontext-max”, etc)
integer
Number of images to generate (1-10)
string
Size of the generated images (“256x256”, “512x512”, “1024x1024”)
string
Format of the generated images (“url” or “b64_json”)

Response

Returns an array of image objects with URLs or base64-encoded images.

Example

Image Variations

POST /images/variations Create variations of an existing image.

Request Body

file
required
The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
string
The model to use for generating variations (“flux-1-kontext-pro”, “flux-1-kontext-max”, etc)
integer
Number of images to generate (1-10)
string
Size of the generated images (“256x256”, “512x512”, “1024x1024”)
string
Format of the generated images (“url” or “b64_json”)

Authorizations

Authorization
string
header
required

Enter your API key (starts with 'ek-')

Body

multipart/form-data
image
file
required

The image to edit

prompt
string
required

A text description of the desired image

model
string
required
Example:

"flux-1-kontext-pro"

n
integer
default:1
Required range: 1 <= x <= 10
size
enum<string>
default:1024x1024
Available options:
256x256,
512x512,
1024x1024
response_format
enum<string>
default:url
Available options:
url,
b64_json

Response

200 - application/json

Success

created
integer
required
data
object[]
required