Skip to main content
This API endpoint allows you to edit images using AI models. You can provide one or more base64-encoded images along with a text prompt describing the desired edit.
The Image Edits API supports both single and multiple image editing, with optional mask support for targeted edits.
Images stored via URL are only available for 1 hour after generation. Make sure to download and save important images locally.

Create Image Edit

To edit an image, use the following endpoint: POST /v1/images/edits

Request Body

array of string
required
Base64-encoded images (PNG format, < 4MB each)
string
Base64-encoded mask image (PNG format, < 4MB) for targeted edits
string
required
Text description of the desired edit
string
Model to use for image editing
integer
Number of images to generate (1-10, default: 1)
string
Image size (options: “256x256”, “512x512”, “1024x1024”)
string
Response format (options: “url” or “b64_json”, default: “url”)
number
Transformation strength (0.0-1.0)
number
Guidance scale for the edit (0.0-20.0)
integer
Number of inference steps (1-100)
integer
Random seed for reproducible results
string
Kontext max mode configuration

Response

The response includes the edited image(s) with either a URL or base64-encoded data, depending on the response_format parameter.
When response_format is set to b64_json, the response will include base64-encoded image data instead of a URL:

Error Response